PAPI  5.4.0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
perfmon.h
Go to the documentation of this file.
1 #ifndef _PAPI_PERFMON_H
2 #define _PAPI_PERFMON_H
3 /*
4 * File: perfmon.h
5 * Author: Philip Mucci
6 * mucci@cs.utk.edu
7 *
8 */
9 
10 #include <stdio.h>
11 #include <stdlib.h>
12 #include <stdarg.h>
13 #include <unistd.h>
14 #include <assert.h>
15 #include <errno.h>
16 #include <string.h>
17 #include <math.h>
18 #include <limits.h>
19 #include <time.h>
20 #include <fcntl.h>
21 #include <ctype.h>
22 #include <inttypes.h>
23 #include <libgen.h>
24 #include <sys/mman.h>
25 #include <sys/syscall.h>
26 #include <sys/types.h>
27 #include <sys/time.h>
28 #include <sys/times.h>
29 #include <sys/ucontext.h>
30 #include <sys/ptrace.h>
31 #include "perfmon/pfmlib.h"
32 #include "perfmon/perfmon_dfl_smpl.h"
33 #include "papi_lock.h"
34 
35 
36 #include "linux-context.h"
37 
38 #if defined(DEBUG)
39 #define DEBUGCALL(a,b) { if (ISLEVEL(a)) { b; } }
40 #else
41 #define DEBUGCALL(a,b)
42 #endif
43 
44 typedef pfmlib_event_t pfm_register_t;
45 typedef int pfm_register_map_t;
46 typedef int pfm_reg_alloc_t;
47 
48 #define MAX_COUNTERS PFMLIB_MAX_PMCS
49 #define MAX_COUNTER_TERMS PFMLIB_MAX_PMCS
50 
51 typedef struct
52 {
53  /* Context structure to kernel, different for attached */
54  int ctx_fd;
55  pfarg_ctx_t *ctx;
56  /* Load structure to kernel, different for attached */
57  pfarg_load_t *load;
58  /* Which counters to use? Bits encode counters to use, may be duplicates */
60  /* Buffer to pass to library to control the counters */
61  pfmlib_input_param_t in;
62  /* Buffer to pass from the library to control the counters */
63  pfmlib_output_param_t out;
64  /* Is this eventset multiplexed? Actually it holds the microseconds of the switching interval, 0 if not mpx. */
66  /* Arguments to kernel for multiplexing, first number of sets */
67  int num_sets;
68  /* Arguments to kernel to set up the sets */
69  pfarg_setdesc_t set[PFMLIB_MAX_PMDS];
70  /* Buffer to get information out of the sets when reading */
71  pfarg_setinfo_t setinfo[PFMLIB_MAX_PMDS];
72  /* Arguments to the kernel */
73  pfarg_pmc_t pc[PFMLIB_MAX_PMCS];
74  /* Arguments to the kernel */
75  pfarg_pmd_t pd[PFMLIB_MAX_PMDS];
76  /* Buffer to gather counters */
77  long long counts[PFMLIB_MAX_PMDS];
79 
80 typedef struct
81 {
82 #if defined(USE_PROC_PTTIMER)
83  int stat_fd;
84 #endif
85  /* Main context structure to kernel */
86  int ctx_fd;
87  pfarg_ctx_t ctx;
88  /* Main load structure to kernel */
89  pfarg_load_t load;
90  /* Structure to inform the kernel about sampling */
91  pfm_dfl_smpl_arg_t smpl;
92  /* Address of mmap()'ed sample buffer */
93  void *smpl_buf;
95 
96 /* typedefs to conform to PAPI component layer code. */
97 /* these are void * in the PAPI framework layer code. */
102 
103 #endif
pfm_register_map_t bits
Definition: perfmon.h:59
pfarg_load_t load
Definition: perfmon.h:89
int pfm_register_map_t
Definition: perfmon.h:45
pfmlib_output_param_t out
Definition: perfmon.h:63
void * smpl_buf
Definition: perfmon.h:93
pfarg_ctx_t ctx
Definition: perfmon.h:87
int pfm_reg_alloc_t
Definition: perfmon.h:46
pfm_dfl_smpl_arg_t smpl
Definition: perfmon.h:91
pfmlib_input_param_t in
Definition: perfmon.h:61
pfarg_load_t * load
Definition: perfmon.h:57
pfmlib_event_t pfm_register_t
Definition: perfctr-x86.h:140
pfm_control_state_t cmp_control_state_t
Definition: perfmon.h:100
pfm_context_t cmp_context_t
Definition: perfmon.h:101
pfm_reg_alloc_t cmp_reg_alloc_t
Definition: perfmon.h:98
pfm_register_t cmp_register_t
Definition: perfmon.h:99
pfarg_ctx_t * ctx
Definition: perfmon.h:55
int ctx_fd
Definition: perfmon.h:86