Go to the source code of this file.
|
| void * | ThreadIO (void *arg) |
| |
| int | main (int argc, char **argv) |
| |
◆ NUM_EVENTS
◆ NUM_INFILES
◆ main()
| int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 80 of file appio_test_pthreads.c.
91 fprintf(stderr,
"PAPI_library_init version mismatch\n");
96 pthread_attr_init(&attr);
98 fprintf(stderr,
"PAPI_thread_init returned an error\n");
101 #ifdef PTHREAD_CREATE_UNDETACHED 102 pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
104 #ifdef PTHREAD_SCOPE_SYSTEM 105 retval = pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
107 fprintf(stderr,
"This system does not support kernel scheduled pthreads.\n");
117 for (
i=0;
i<(numthrds-1);
i++) {
119 if (
rc != 0) perror(
"Error creating thread using pthread_create()");
122 pthread_attr_destroy(&attr);
124 for (
i=0;
i<(numthrds-1);
i++)
125 pthread_join(callThd[
i], NULL);
void test_pass(const char *filename)
unsigned long int pthread_t
int PAPI_thread_init(unsigned long int(*id_fn)(void))
int PAPI_library_init(int version)
void * ThreadIO(void *arg)
int tests_quiet(int argc, char **argv)
static const char * files[NUM_INFILES]
◆ ThreadIO()
| void* ThreadIO |
( |
void * |
arg | ) |
|
Definition at line 30 of file appio_test_pthreads.c.
31 unsigned long tid = (
unsigned long)pthread_self();
32 if (!
TESTS_QUIET) printf(
"\nThread %#lx: will read %s and write it to /dev/null\n", tid,(
const char*) arg);
40 fprintf(stderr,
"Error getting code for %s\n",
names[e]);
47 fprintf(stderr,
"Error in PAPI_start_counters\n");
55 int fdin =
open((
const char*)arg, O_RDONLY);
56 if (fdin < 0) perror(
"Could not open file for reading: \n");
61 int fdout =
open(
"/dev/null", O_WRONLY);
62 if (fdout < 0) perror(
"Could not open /dev/null for writing: \n");
63 while ((bytes =
read(fdin,
buf, 1024)) > 0) {
70 fprintf(stderr,
"Error in PAPI_stop_counters\n");
75 printf(
"Thread %#lx: %s: %lld\n", tid,
names[e],
values[e]);
ssize_t read(int fd, void *buf, size_t count)
static int Events[NUM_EVENTS]
int PAPI_event_name_to_code(const char *in, int *out)
int open(const char *pathname, int flags, mode_t mode)
ssize_t write(int fd, const void *buf, size_t count)
int PAPI_stop_counters(long long *values, int array_len)
int PAPI_start_counters(int *events, int array_len)
static long long values[NUM_EVENTS]
volatile int buf[CACHE_FLUSH_BUFFER_SIZE_INTS]
const char * names[NUM_EVENTS]
◆ files
| const char* files[NUM_INFILES] = {"/etc/passwd", "/etc/group", "/etc/protocols", "/etc/nsswitch.conf"} |
|
static |
◆ names