init_fini.c File Reference

Include dependency graph for init_fini.c:

Go to the source code of this file.

Defines

#define NUM_EVENTS   6

Functions

 __attribute__ ((constructor))
 __attribute__ ((destructor))

Variables

static int Events [NUM_EVENTS]
static const char * names [NUM_EVENTS] = {"READ_CALLS", "READ_BYTES","READ_USEC","WRITE_CALLS","WRITE_BYTES","WRITE_USEC"}
static long long values [NUM_EVENTS]

Define Documentation

#define NUM_EVENTS   6

Definition at line 7 of file init_fini.c.


Function Documentation

__attribute__ ( (destructor)   ) 

Definition at line 41 of file init_fini.c.

00041                                                 {
00042   int e;
00043   //fprintf(stderr, "appio: destructor called\n");
00044   if (PAPI_stop_counters(values, NUM_EVENTS) != PAPI_OK) {
00045     fprintf(stderr, "Error in PAPI_stop_counters\n");
00046   }
00047   fprintf(stderr, "\nappio: PAPI counts (for pid=%6d)\n"
00048                   "appio: ----------------------------\n", (int)getpid());
00049   for (e=0; e<NUM_EVENTS; e++)
00050     fprintf(stderr, "appio: %s : %lld\n", names[e], values[e]);
00051   return;
00052 }

Here is the call graph for this function:

__attribute__ ( (constructor)   ) 

Definition at line 12 of file init_fini.c.

00012                                                  {
00013   //fprintf(stderr, "appio: constructor started\n");
00014   int version = PAPI_library_init (PAPI_VER_CURRENT);
00015   if (version != PAPI_VER_CURRENT) {
00016     fprintf(stderr, "PAPI_library_init version mismatch\n");
00017     exit(1);
00018   }
00019   else {
00020     fprintf(stderr, "appio: PAPI library initialized\n");
00021   }
00022   int retval;
00023   int e;
00024   for (e=0; e<NUM_EVENTS; e++) {
00025     retval = PAPI_event_name_to_code((char*)names[e], &Events[e]);
00026     if (retval != PAPI_OK) {
00027       fprintf(stderr, "Error getting code for %s\n", names[e]);
00028       exit(2);
00029     }
00030   }
00031 
00032   /* Start counting events */
00033   fprintf(stderr, "appio: starting PAPI counters; main program will follow\n");
00034   if (PAPI_start_counters(Events, NUM_EVENTS) != PAPI_OK) {
00035     fprintf(stderr, "Error in PAPI_start_counters\n");
00036     exit(1);
00037   }
00038   return;
00039 }

Here is the call graph for this function:


Variable Documentation

int Events[NUM_EVENTS] [static]

Definition at line 8 of file init_fini.c.

const char* names[NUM_EVENTS] = {"READ_CALLS", "READ_BYTES","READ_USEC","WRITE_CALLS","WRITE_BYTES","WRITE_USEC"} [static]

Definition at line 9 of file init_fini.c.

long long values[NUM_EVENTS] [static]

Definition at line 10 of file init_fini.c.


Generated on 8 Sep 2016 for PAPI by  doxygen 1.6.1