PAPI  5.0.1.0
perfmon.h
Go to the documentation of this file.
00001 #ifndef _PAPI_PERFMON_H
00002 #define _PAPI_PERFMON_H
00003 /* 
00004 * File:    perfmon.h
00005 * Author:  Philip Mucci
00006 *          mucci@cs.utk.edu
00007 *
00008 */
00009 
00010 #include <stdio.h>
00011 #include <stdlib.h>
00012 #include <stdarg.h>
00013 #include <unistd.h>
00014 #include <assert.h>
00015 #include <errno.h>
00016 #include <string.h>
00017 #include <math.h>
00018 #include <limits.h>
00019 #include <time.h>
00020 #include <fcntl.h>
00021 #include <ctype.h>
00022 #include <inttypes.h>
00023 #include <libgen.h>
00024 #include <sys/mman.h>
00025 #include <sys/syscall.h>
00026 #include <sys/types.h>
00027 #include <sys/time.h>
00028 #include <sys/times.h>
00029 #include <sys/ucontext.h>
00030 #include <sys/ptrace.h>
00031 #include "perfmon/pfmlib.h"
00032 #include "perfmon/perfmon_dfl_smpl.h"
00033 #include "papi_lock.h"
00034 
00035 
00036 #include "linux-context.h"
00037 
00038 #if defined(DEBUG)
00039 #define DEBUGCALL(a,b) { if (ISLEVEL(a)) { b; } }
00040 #else
00041 #define DEBUGCALL(a,b)
00042 #endif
00043 
00044 typedef pfmlib_event_t pfm_register_t;
00045 typedef int pfm_register_map_t;
00046 typedef int pfm_reg_alloc_t;
00047 
00048 #define MAX_COUNTERS PFMLIB_MAX_PMCS
00049 #define MAX_COUNTER_TERMS PFMLIB_MAX_PMCS
00050 
00051 typedef struct
00052 {
00053     /* Context structure to kernel, different for attached */
00054     int ctx_fd;
00055     pfarg_ctx_t *ctx;
00056     /* Load structure to kernel, different for attached */
00057     pfarg_load_t *load;
00058     /* Which counters to use? Bits encode counters to use, may be duplicates */
00059     pfm_register_map_t bits;
00060     /* Buffer to pass to library to control the counters */
00061     pfmlib_input_param_t in;
00062     /* Buffer to pass from the library to control the counters */
00063     pfmlib_output_param_t out;
00064     /* Is this eventset multiplexed? Actually it holds the microseconds of the switching interval, 0 if not mpx. */
00065     int multiplexed;
00066     /* Arguments to kernel for multiplexing, first number of sets */
00067     int num_sets;
00068     /* Arguments to kernel to set up the sets */
00069     pfarg_setdesc_t set[PFMLIB_MAX_PMDS];
00070     /* Buffer to get information out of the sets when reading */
00071     pfarg_setinfo_t setinfo[PFMLIB_MAX_PMDS];
00072     /* Arguments to the kernel */
00073     pfarg_pmc_t pc[PFMLIB_MAX_PMCS];
00074     /* Arguments to the kernel */
00075     pfarg_pmd_t pd[PFMLIB_MAX_PMDS];
00076     /* Buffer to gather counters */
00077     long long counts[PFMLIB_MAX_PMDS];
00078 } pfm_control_state_t;
00079 
00080 typedef struct
00081 {
00082 #if defined(USE_PROC_PTTIMER)
00083     int stat_fd;
00084 #endif
00085     /* Main context structure to kernel */
00086     int ctx_fd;
00087     pfarg_ctx_t ctx;
00088     /* Main load structure to kernel */
00089     pfarg_load_t load;
00090     /* Structure to inform the kernel about sampling */
00091     pfm_dfl_smpl_arg_t smpl;
00092     /* Address of mmap()'ed sample buffer */
00093     void *smpl_buf;
00094 } pfm_context_t;
00095 
00096 /* typedefs to conform to PAPI component layer code. */
00097 /* these are void * in the PAPI framework layer code. */
00098 typedef pfm_reg_alloc_t cmp_reg_alloc_t;
00099 typedef pfm_register_t cmp_register_t;
00100 typedef pfm_control_state_t cmp_control_state_t;
00101 typedef pfm_context_t cmp_context_t;
00102 
00103 #endif
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines