PAPI  5.0.1.0
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 [6]
static const char * names [6] = {"READ_CALLS", "READ_BYTES","READ_USEC","WRITE_CALLS","WRITE_BYTES","WRITE_USEC"}
static long long values [6]

Define Documentation

#define NUM_EVENTS   6

Definition at line 7 of file init_fini.c.


Function Documentation

__attribute__ ( (constructor)  )

Definition at line 12 of file init_fini.c.

                                                 {
  //fprintf(stderr, "appio: constructor started\n");
  int version = PAPI_library_init (PAPI_VER_CURRENT);
  if (version != PAPI_VER_CURRENT) {
    fprintf(stderr, "PAPI_library_init version mismatch\n");
    exit(1);
  }
  else {
    fprintf(stderr, "appio: PAPI library initialized\n");
  }
  int retval;
  int e;
  for (e=0; e<NUM_EVENTS; e++) {
    retval = PAPI_event_name_to_code((char*)names[e], &Events[e]);
    if (retval != PAPI_OK) {
      fprintf(stderr, "Error getting code for %s\n", names[e]);
      exit(2);
    }
  }

  /* Start counting events */
  fprintf(stderr, "appio: starting PAPI counters; main program will follow\n");
  if (PAPI_start_counters(Events, NUM_EVENTS) != PAPI_OK) {
    fprintf(stderr, "Error in PAPI_start_counters\n");
    exit(1);
  }
  return;
}

Here is the call graph for this function:

__attribute__ ( (destructor)  )

Definition at line 41 of file init_fini.c.

                                                {
  int e;
  //fprintf(stderr, "appio: destructor called\n");
  if (PAPI_stop_counters(values, NUM_EVENTS) != PAPI_OK) {
    fprintf(stderr, "Error in PAPI_stop_counters\n");
  }
  fprintf(stderr, "\nappio: PAPI counts (for pid=%6d)\n"
                  "appio: ----------------------------\n", (int)getpid());
  for (e=0; e<NUM_EVENTS; e++)
    fprintf(stderr, "appio: %s : %lld\n", names[e], values[e]);
  return;
}

Here is the call graph for this function:


Variable Documentation

int Events[6] [static]

Definition at line 8 of file init_fini.c.

const char* names[6] = {"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[6] [static]

Definition at line 10 of file init_fini.c.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines