|
PAPI
5.1.0.2
|
00001 /****************************/ 00002 /* THIS IS OPEN SOURCE CODE */ 00003 /****************************/ 00004 00022 #ifndef _PAPI 00023 #define _PAPI 00024 00206 /* Definition of PAPI_VERSION format. Note that each of the four 00207 * components _must_ be less than 256. Also, the PAPI_VER_CURRENT 00208 * masks out the revision and increment. Any revision change is supposed 00209 * to be binary compatible between the user application code and the 00210 * run-time library. Any modification that breaks this compatibility 00211 * _should_ modify the minor version number as to force user applications 00212 * to re-compile. 00213 */ 00214 #define PAPI_VERSION_NUMBER(maj,min,rev,inc) (((maj)<<24) | ((min)<<16) | ((rev)<<8) | (inc)) 00215 #define PAPI_VERSION_MAJOR(x) (((x)>>24) & 0xff) 00216 #define PAPI_VERSION_MINOR(x) (((x)>>16) & 0xff) 00217 #define PAPI_VERSION_REVISION(x) (((x)>>8) & 0xff) 00218 #define PAPI_VERSION_INCREMENT(x)((x) & 0xff) 00219 00220 /* This is the official PAPI version */ 00221 /* The final digit represents the patch count */ 00222 #define PAPI_VERSION PAPI_VERSION_NUMBER(5,1,0,2) 00223 #define PAPI_VER_CURRENT (PAPI_VERSION & 0xffff0000) 00224 00225 /* Tests for checking event code type */ 00226 #define IS_NATIVE( EventCode ) ( ( EventCode & PAPI_NATIVE_MASK ) && !(EventCode & PAPI_PRESET_MASK) ) 00227 #define IS_PRESET( EventCode ) ( ( EventCode & PAPI_PRESET_MASK ) && !(EventCode & PAPI_NATIVE_MASK) ) 00228 #define IS_USER_DEFINED( EventCode ) ( ( EventCode & PAPI_PRESET_MASK ) && (EventCode & PAPI_NATIVE_MASK) ) 00229 00230 #ifdef __cplusplus 00231 extern "C" 00232 { 00233 #endif 00234 00235 /* Include files */ 00236 00237 #include <sys/types.h> 00238 #include <limits.h> 00239 #include "papiStdEventDefs.h" 00240 00250 #define PAPI_OK 0 00251 #define PAPI_EINVAL -1 00252 #define PAPI_ENOMEM -2 00253 #define PAPI_ESYS -3 00254 #define PAPI_ECMP -4 00255 #define PAPI_ESBSTR -4 00256 #define PAPI_ECLOST -5 00257 #define PAPI_EBUG -6 00258 #define PAPI_ENOEVNT -7 00259 #define PAPI_ECNFLCT -8 00260 #define PAPI_ENOTRUN -9 00261 #define PAPI_EISRUN -10 00262 #define PAPI_ENOEVST -11 00263 #define PAPI_ENOTPRESET -12 00264 #define PAPI_ENOCNTR -13 00265 #define PAPI_EMISC -14 00266 #define PAPI_EPERM -15 00267 #define PAPI_ENOINIT -16 00268 #define PAPI_ENOCMP -17 00269 #define PAPI_ENOSUPP -18 00270 #define PAPI_ENOIMPL -19 00271 #define PAPI_EBUF -20 00272 #define PAPI_EINVAL_DOM -21 00273 #define PAPI_EATTR -22 00274 #define PAPI_ECOUNT -23 00275 #define PAPI_ECOMBO -24 00276 #define PAPI_NUM_ERRORS 25 00278 #define PAPI_NOT_INITED 0 00279 #define PAPI_LOW_LEVEL_INITED 1 /* Low level has called library init */ 00280 #define PAPI_HIGH_LEVEL_INITED 2 /* High level has called library init */ 00281 #define PAPI_THREAD_LEVEL_INITED 4 /* Threads have been inited */ 00282 00290 #define PAPI_NULL -1 00296 #define PAPI_DOM_USER 0x1 00297 #define PAPI_DOM_MIN PAPI_DOM_USER 00298 #define PAPI_DOM_KERNEL 0x2 00299 #define PAPI_DOM_OTHER 0x4 00300 #define PAPI_DOM_SUPERVISOR 0x8 00301 #define PAPI_DOM_ALL (PAPI_DOM_USER|PAPI_DOM_KERNEL|PAPI_DOM_OTHER|PAPI_DOM_SUPERVISOR) 00302 /* #define PAPI_DOM_DEFAULT PAPI_DOM_USER NOW DEFINED BY COMPONENT */ 00303 #define PAPI_DOM_MAX PAPI_DOM_ALL 00304 #define PAPI_DOM_HWSPEC 0x80000000 00315 #define PAPI_USR1_TLS 0x0 00316 #define PAPI_USR2_TLS 0x1 00317 #define PAPI_HIGH_LEVEL_TLS 0x2 00318 #define PAPI_NUM_TLS 0x3 00319 #define PAPI_TLS_USR1 PAPI_USR1_TLS 00320 #define PAPI_TLS_USR2 PAPI_USR2_TLS 00321 #define PAPI_TLS_HIGH_LEVEL PAPI_HIGH_LEVEL_TLS 00322 #define PAPI_TLS_NUM PAPI_NUM_TLS 00323 #define PAPI_TLS_ALL_THREADS 0x10 00324 00329 #define PAPI_USR1_LOCK 0x0 00330 #define PAPI_USR2_LOCK 0x1 00331 #define PAPI_NUM_LOCK 0x2 00332 #define PAPI_LOCK_USR1 PAPI_USR1_LOCK 00333 #define PAPI_LOCK_USR2 PAPI_USR2_LOCK 00334 #define PAPI_LOCK_NUM PAPI_NUM_LOCK 00335 00337 /* Remove this! If it breaks userspace we might have to add it back :( */ 00338 /* #define PAPI_MPX_DEF_DEG 32 */ 00339 00343 #define PAPI_VENDOR_UNKNOWN 0 00344 #define PAPI_VENDOR_INTEL 1 00345 #define PAPI_VENDOR_AMD 2 00346 #define PAPI_VENDOR_IBM 3 00347 #define PAPI_VENDOR_CRAY 4 00348 #define PAPI_VENDOR_SUN 5 00349 #define PAPI_VENDOR_FREESCALE 6 00350 #define PAPI_VENDOR_ARM 7 00351 #define PAPI_VENDOR_MIPS 8 00352 00358 #define PAPI_GRN_THR 0x1 00359 #define PAPI_GRN_MIN PAPI_GRN_THR 00360 #define PAPI_GRN_PROC 0x2 00361 #define PAPI_GRN_PROCG 0x4 00362 #define PAPI_GRN_SYS 0x8 00363 #define PAPI_GRN_SYS_CPU 0x10 00364 #define PAPI_GRN_MAX PAPI_GRN_SYS_CPU 00365 00370 #define PAPI_STOPPED 0x01 00371 #define PAPI_RUNNING 0x02 00372 #define PAPI_PAUSED 0x04 00373 #define PAPI_NOT_INIT 0x08 00374 #define PAPI_OVERFLOWING 0x10 00375 #define PAPI_PROFILING 0x20 00376 #define PAPI_MULTIPLEXING 0x40 00377 #define PAPI_ATTACHED 0x80 00378 #define PAPI_CPU_ATTACHED 0x100 00384 #define PAPI_QUIET 0 00385 #define PAPI_VERB_ECONT 1 00386 #define PAPI_VERB_ESTOP 2 00392 #define PAPI_PROFIL_POSIX 0x0 00393 #define PAPI_PROFIL_RANDOM 0x1 00394 #define PAPI_PROFIL_WEIGHTED 0x2 00395 #define PAPI_PROFIL_COMPRESS 0x4 00396 #define PAPI_PROFIL_BUCKET_16 0x8 00397 #define PAPI_PROFIL_BUCKET_32 0x10 00398 #define PAPI_PROFIL_BUCKET_64 0x20 00399 #define PAPI_PROFIL_FORCE_SW 0x40 00400 #define PAPI_PROFIL_DATA_EAR 0x80 00401 #define PAPI_PROFIL_INST_EAR 0x100 00402 #define PAPI_PROFIL_BUCKETS (PAPI_PROFIL_BUCKET_16 | PAPI_PROFIL_BUCKET_32 | PAPI_PROFIL_BUCKET_64) 00403 00405 /* @defgroup overflow_defns Overflow definitions 00406 @{ */ 00407 #define PAPI_OVERFLOW_FORCE_SW 0x40 00408 #define PAPI_OVERFLOW_HARDWARE 0x80 00414 #define PAPI_MULTIPLEX_DEFAULT 0x0 00415 #define PAPI_MULTIPLEX_FORCE_SW 0x1 00421 #define PAPI_INHERIT_ALL 1 00422 #define PAPI_INHERIT_NONE 0 00425 #define PAPI_DETACH 1 00426 #define PAPI_DEBUG 2 00427 #define PAPI_MULTIPLEX 3 00428 #define PAPI_DEFDOM 4 00429 #define PAPI_DOMAIN 5 00430 #define PAPI_DEFGRN 6 00431 #define PAPI_GRANUL 7 00432 #define PAPI_DEF_MPX_NS 8 00433 //#define PAPI_EDGE_DETECT 9 00434 //#define PAPI_INVERT 10 00435 #define PAPI_MAX_MPX_CTRS 11 00436 #define PAPI_PROFIL 12 00437 #define PAPI_PRELOAD 13 00438 #define PAPI_CLOCKRATE 14 00439 #define PAPI_MAX_HWCTRS 15 00440 #define PAPI_HWINFO 16 00441 #define PAPI_EXEINFO 17 00442 #define PAPI_MAX_CPUS 18 00443 #define PAPI_ATTACH 19 00444 #define PAPI_SHLIBINFO 20 00445 #define PAPI_LIB_VERSION 21 00446 #define PAPI_COMPONENTINFO 22 00447 /* Currently the following options are only available on Itanium; they may be supported elsewhere in the future */ 00448 #define PAPI_DATA_ADDRESS 23 00449 #define PAPI_INSTR_ADDRESS 24 00450 #define PAPI_DEF_ITIMER 25 00451 #define PAPI_DEF_ITIMER_NS 26 00452 /* Currently the following options are only available on systems using the perf_events component within papi */ 00453 #define PAPI_CPU_ATTACH 27 00454 #define PAPI_INHERIT 28 00455 #define PAPI_USER_EVENTS_FILE 29 00457 #define PAPI_INIT_SLOTS 64 /*Number of initialized slots in 00458 DynamicArray of EventSets */ 00459 00460 #define PAPI_MIN_STR_LEN 64 /* For small strings, like names & stuff */ 00461 #define PAPI_MAX_STR_LEN 128 /* For average run-of-the-mill strings */ 00462 #define PAPI_2MAX_STR_LEN 256 /* For somewhat longer run-of-the-mill strings */ 00463 #define PAPI_HUGE_STR_LEN 1024 /* This should be defined in terms of a system parameter */ 00464 00465 #define PAPI_DERIVED 0x1 /* Flag to indicate that the event is derived */ 00466 00475 enum { 00476 PAPI_ENUM_EVENTS = 0, 00477 PAPI_ENUM_FIRST, 00478 PAPI_PRESET_ENUM_AVAIL, 00480 /* PAPI PRESET section */ 00481 PAPI_PRESET_ENUM_MSC, 00482 PAPI_PRESET_ENUM_INS, 00483 PAPI_PRESET_ENUM_IDL, 00484 PAPI_PRESET_ENUM_BR, 00485 PAPI_PRESET_ENUM_CND, 00486 PAPI_PRESET_ENUM_MEM, 00487 PAPI_PRESET_ENUM_CACH, 00488 PAPI_PRESET_ENUM_L1, 00489 PAPI_PRESET_ENUM_L2, 00490 PAPI_PRESET_ENUM_L3, 00491 PAPI_PRESET_ENUM_TLB, 00492 PAPI_PRESET_ENUM_FP, 00494 /* PAPI native event related section */ 00495 PAPI_NTV_ENUM_UMASKS, 00496 PAPI_NTV_ENUM_UMASK_COMBOS, 00497 PAPI_NTV_ENUM_IARR, 00498 PAPI_NTV_ENUM_DARR, 00499 PAPI_NTV_ENUM_OPCM, 00500 PAPI_NTV_ENUM_IEAR, 00501 PAPI_NTV_ENUM_DEAR, 00502 PAPI_NTV_ENUM_GROUPS 00503 }; 00504 00505 #define PAPI_ENUM_ALL PAPI_ENUM_EVENTS 00506 00507 #define PAPI_PRESET_BIT_MSC (1 << PAPI_PRESET_ENUM_MSC) /* Miscellaneous preset event bit */ 00508 #define PAPI_PRESET_BIT_INS (1 << PAPI_PRESET_ENUM_INS) /* Instruction related preset event bit */ 00509 #define PAPI_PRESET_BIT_IDL (1 << PAPI_PRESET_ENUM_IDL) /* Stalled or Idle preset event bit */ 00510 #define PAPI_PRESET_BIT_BR (1 << PAPI_PRESET_ENUM_BR) /* branch related preset events */ 00511 #define PAPI_PRESET_BIT_CND (1 << PAPI_PRESET_ENUM_CND) /* conditional preset events */ 00512 #define PAPI_PRESET_BIT_MEM (1 << PAPI_PRESET_ENUM_MEM) /* memory related preset events */ 00513 #define PAPI_PRESET_BIT_CACH (1 << PAPI_PRESET_ENUM_CACH) /* cache related preset events */ 00514 #define PAPI_PRESET_BIT_L1 (1 << PAPI_PRESET_ENUM_L1) /* L1 cache related preset events */ 00515 #define PAPI_PRESET_BIT_L2 (1 << PAPI_PRESET_ENUM_L2) /* L2 cache related preset events */ 00516 #define PAPI_PRESET_BIT_L3 (1 << PAPI_PRESET_ENUM_L3) /* L3 cache related preset events */ 00517 #define PAPI_PRESET_BIT_TLB (1 << PAPI_PRESET_ENUM_TLB) /* Translation Lookaside Buffer events */ 00518 #define PAPI_PRESET_BIT_FP (1 << PAPI_PRESET_ENUM_FP) /* Floating Point related preset events */ 00519 00520 #define PAPI_NTV_GROUP_AND_MASK 0x00FF0000 /* bits occupied by group number */ 00521 #define PAPI_NTV_GROUP_SHIFT 16 /* bit shift to encode group number */ 00522 00524 /* 00525 The Low Level API 00526 00527 The following functions represent the low level portion of the 00528 PerfAPI. These functions provide greatly increased efficiency and 00529 functionality over the high level API presented in the next 00530 section. All of the following functions are callable from both C and 00531 Fortran except where noted. As mentioned in the introduction, the low 00532 level API is only as powerful as the component upon which it is 00533 built. Thus some features may not be available on every platform. The 00534 converse may also be true, that more advanced features may be 00535 available and defined in the header file. The user is encouraged to 00536 read the documentation carefully. */ 00537 00538 00539 #include <signal.h> 00540 00541 /* Earlier versions of PAPI define a special long_long type to mask 00542 an incompatibility between the Windows compiler and gcc-style compilers. 00543 That problem no longer exists, so long_long has been purged from the source. 00544 The defines below preserve backward compatibility. Their use is deprecated, 00545 but will continue to be supported in the near term. 00546 */ 00547 #define long_long long long 00548 #define u_long_long unsigned long long 00549 00552 typedef unsigned long PAPI_thread_id_t; 00553 00555 typedef struct _papi_all_thr_spec { 00556 int num; 00557 PAPI_thread_id_t *id; 00558 void **data; 00559 } PAPI_all_thr_spec_t; 00560 00561 typedef void (*PAPI_overflow_handler_t) (int EventSet, void *address, 00562 long long overflow_vector, void *context); 00563 00564 /* Handle C99 compilation */ 00565 /* All caddr_ts should become unsigned longs eventually. */ 00566 #ifdef __STDC_VERSION__ 00567 #if (__STDC_VERSION__ == 199901L) 00568 typedef char *caddr_t; 00569 #else 00570 00571 #endif 00572 #endif 00573 00575 typedef struct _papi_sprofil { 00576 void *pr_base; 00577 unsigned pr_size; 00578 caddr_t pr_off; 00579 unsigned pr_scale; 00583 } PAPI_sprofil_t; 00584 00586 typedef struct _papi_itimer_option { 00587 int itimer_num; 00588 int itimer_sig; 00589 int ns; 00590 int flags; 00591 } PAPI_itimer_option_t; 00592 00594 typedef struct _papi_inherit_option { 00595 int eventset; 00596 int inherit; 00597 } PAPI_inherit_option_t; 00598 00600 typedef struct _papi_domain_option { 00601 int def_cidx; 00602 int eventset; 00603 int domain; 00604 } PAPI_domain_option_t; 00605 00607 typedef struct _papi_granularity_option { 00608 int def_cidx; 00609 int eventset; 00610 int granularity; 00611 } PAPI_granularity_option_t; 00612 00614 typedef struct _papi_preload_option { 00615 char lib_preload_env[PAPI_MAX_STR_LEN]; 00616 char lib_preload_sep; 00617 char lib_dir_env[PAPI_MAX_STR_LEN]; 00618 char lib_dir_sep; 00619 } PAPI_preload_info_t; 00620 00622 typedef struct _papi_component_option { 00623 char name[PAPI_MAX_STR_LEN]; 00624 char short_name[PAPI_MIN_STR_LEN]; 00626 char description[PAPI_MAX_STR_LEN]; 00627 char version[PAPI_MIN_STR_LEN]; 00628 char support_version[PAPI_MIN_STR_LEN]; 00629 char kernel_version[PAPI_MIN_STR_LEN]; 00630 char disabled_reason[PAPI_MAX_STR_LEN]; 00631 int disabled; 00632 int CmpIdx; 00633 int num_cntrs; 00634 int num_mpx_cntrs; 00635 int num_preset_events; 00636 int num_native_events; 00637 int default_domain; 00638 int available_domains; 00639 int default_granularity; 00640 int available_granularities; 00641 int hardware_intr_sig; 00642 // int opcode_match_width; /**< Width of opcode matcher if exists, 0 if not */ 00643 int component_type; 00644 int reserved[8]; /* */ 00645 unsigned int hardware_intr:1; 00646 unsigned int precise_intr:1; 00647 unsigned int posix1b_timers:1; 00648 unsigned int kernel_profile:1; 00649 unsigned int kernel_multiplex:1; 00650 // unsigned int data_address_range:1; /**< Supports data address range limiting */ 00651 // unsigned int instr_address_range:1; /**< Supports instruction address range limiting */ 00652 unsigned int fast_counter_read:1; 00653 unsigned int fast_real_timer:1; 00654 unsigned int fast_virtual_timer:1; 00655 unsigned int attach:1; 00656 unsigned int attach_must_ptrace:1; 00657 // unsigned int edge_detect:1; /**< Supports edge detection on events */ 00658 // unsigned int invert:1; /**< Supports invert detection on events */ 00659 // unsigned int profile_ear:1; /**< Supports data/instr/tlb miss address sampling */ 00660 // unsigned int cntr_groups:1; /**< Underlying hardware uses counter groups (e.g. POWER5)*/ 00661 unsigned int cntr_umasks:1; 00662 // unsigned int cntr_IEAR_events:1; /**< counters support instr event addr register */ 00663 // unsigned int cntr_DEAR_events:1; /**< counters support data event addr register */ 00664 // unsigned int cntr_OPCM_events:1; /**< counter events support opcode matching */ 00665 /* This should be a granularity option */ 00666 unsigned int cpu:1; 00667 unsigned int inherit:1; 00668 unsigned int reserved_bits:12; 00669 } PAPI_component_info_t; 00670 00672 typedef struct _papi_mpx_info { 00673 int timer_sig; 00674 int timer_num; 00675 int timer_us; 00676 } PAPI_mpx_info_t; 00677 00678 typedef int (*PAPI_debug_handler_t) (int code); 00679 00681 typedef struct _papi_debug_option { 00682 int level; 00683 PAPI_debug_handler_t handler; 00684 } PAPI_debug_option_t; 00685 00688 typedef struct _papi_address_map { 00689 char name[PAPI_HUGE_STR_LEN]; 00690 caddr_t text_start; 00691 caddr_t text_end; 00692 caddr_t data_start; 00693 caddr_t data_end; 00694 caddr_t bss_start; 00695 caddr_t bss_end; 00696 } PAPI_address_map_t; 00697 00700 typedef struct _papi_program_info { 00701 char fullname[PAPI_HUGE_STR_LEN]; 00702 PAPI_address_map_t address_info; 00703 } PAPI_exe_info_t; 00704 00706 typedef struct _papi_shared_lib_info { 00707 PAPI_address_map_t *map; 00708 int count; 00709 } PAPI_shlib_info_t; 00710 00712 typedef char* PAPI_user_defined_events_file_t; 00713 00714 /* The following defines and next for structures define the memory heirarchy */ 00715 /* All sizes are in BYTES */ 00716 /* Associativity: 00717 0: Undefined; 00718 1: Direct Mapped 00719 SHRT_MAX: Full 00720 Other values == associativity 00721 */ 00722 #define PAPI_MH_TYPE_EMPTY 0x0 00723 #define PAPI_MH_TYPE_INST 0x1 00724 #define PAPI_MH_TYPE_DATA 0x2 00725 #define PAPI_MH_TYPE_VECTOR 0x4 00726 #define PAPI_MH_TYPE_TRACE 0x8 00727 #define PAPI_MH_TYPE_UNIFIED (PAPI_MH_TYPE_INST|PAPI_MH_TYPE_DATA) 00728 #define PAPI_MH_CACHE_TYPE(a) (a & 0xf) 00729 #define PAPI_MH_TYPE_WT 0x00 /* write-through cache */ 00730 #define PAPI_MH_TYPE_WB 0x10 /* write-back cache */ 00731 #define PAPI_MH_CACHE_WRITE_POLICY(a) (a & 0xf0) 00732 #define PAPI_MH_TYPE_UNKNOWN 0x000 00733 #define PAPI_MH_TYPE_LRU 0x100 00734 #define PAPI_MH_TYPE_PSEUDO_LRU 0x200 00735 #define PAPI_MH_CACHE_REPLACEMENT_POLICY(a) (a & 0xf00) 00736 #define PAPI_MH_TYPE_TLB 0x1000 /* tlb, not memory cache */ 00737 #define PAPI_MH_TYPE_PREF 0x2000 /* prefetch buffer */ 00738 #define PAPI_MH_MAX_LEVELS 6 /* # descriptors for each TLB or cache level */ 00739 #define PAPI_MAX_MEM_HIERARCHY_LEVELS 4 00740 00742 typedef struct _papi_mh_tlb_info { 00743 int type; 00744 int num_entries; 00745 int page_size; 00746 int associativity; 00747 } PAPI_mh_tlb_info_t; 00748 00750 typedef struct _papi_mh_cache_info { 00751 int type; 00752 int size; 00753 int line_size; 00754 int num_lines; 00755 int associativity; 00756 } PAPI_mh_cache_info_t; 00757 00759 typedef struct _papi_mh_level_info { 00760 PAPI_mh_tlb_info_t tlb[PAPI_MH_MAX_LEVELS]; 00761 PAPI_mh_cache_info_t cache[PAPI_MH_MAX_LEVELS]; 00762 } PAPI_mh_level_t; 00763 00766 typedef struct _papi_mh_info { 00767 int levels; 00768 PAPI_mh_level_t level[PAPI_MAX_MEM_HIERARCHY_LEVELS]; 00769 } PAPI_mh_info_t; 00770 00773 typedef struct _papi_hw_info { 00774 int ncpu; 00775 int threads; 00776 int cores; 00777 int sockets; 00778 int nnodes; 00779 int totalcpus; 00780 int vendor; 00781 char vendor_string[PAPI_MAX_STR_LEN]; 00782 int model; 00783 char model_string[PAPI_MAX_STR_LEN]; 00784 float revision; 00785 int cpuid_family; 00786 int cpuid_model; 00787 int cpuid_stepping; 00789 int cpu_max_mhz; 00790 int cpu_min_mhz; 00792 PAPI_mh_info_t mem_hierarchy; 00793 int virtualized; 00794 char virtual_vendor_string[PAPI_MAX_STR_LEN]; 00796 char virtual_vendor_version[PAPI_MAX_STR_LEN]; 00799 /* Legacy Values, do not use */ 00800 float mhz; 00801 int clock_mhz; 00803 /* For future expansion */ 00804 int reserved[8]; 00805 00806 } PAPI_hw_info_t; 00807 00809 typedef struct _papi_attach_option { 00810 int eventset; 00811 unsigned long tid; 00812 } PAPI_attach_option_t; 00813 00815 typedef struct _papi_cpu_option { 00816 int eventset; 00817 unsigned int cpu_num; 00818 } PAPI_cpu_option_t; 00819 00821 typedef struct _papi_multiplex_option { 00822 int eventset; 00823 int ns; 00824 int flags; 00825 } PAPI_multiplex_option_t; 00826 00829 typedef struct _papi_addr_range_option { 00830 int eventset; 00831 caddr_t start; 00832 caddr_t end; 00833 int start_off; 00834 int end_off; 00835 } PAPI_addr_range_option_t; 00836 00841 typedef union 00842 { 00843 PAPI_preload_info_t preload; 00844 PAPI_debug_option_t debug; 00845 PAPI_inherit_option_t inherit; 00846 PAPI_granularity_option_t granularity; 00847 PAPI_granularity_option_t defgranularity; 00848 PAPI_domain_option_t domain; 00849 PAPI_domain_option_t defdomain; 00850 PAPI_attach_option_t attach; 00851 PAPI_cpu_option_t cpu; 00852 PAPI_multiplex_option_t multiplex; 00853 PAPI_itimer_option_t itimer; 00854 PAPI_hw_info_t *hw_info; 00855 PAPI_shlib_info_t *shlib_info; 00856 PAPI_exe_info_t *exe_info; 00857 PAPI_component_info_t *cmp_info; 00858 PAPI_addr_range_option_t addr; 00859 PAPI_user_defined_events_file_t events_file; 00860 } PAPI_option_t; 00861 00864 typedef struct _dmem_t { 00865 long long peak; 00866 long long size; 00867 long long resident; 00868 long long high_water_mark; 00869 long long shared; 00870 long long text; 00871 long long library; 00872 long long heap; 00873 long long locked; 00874 long long stack; 00875 long long pagesize; 00876 long long pte; 00877 } PAPI_dmem_info_t; 00878 00879 /* Fortran offsets into PAPI_dmem_info_t structure. */ 00880 00881 #define PAPIF_DMEM_VMPEAK 1 00882 #define PAPIF_DMEM_VMSIZE 2 00883 #define PAPIF_DMEM_RESIDENT 3 00884 #define PAPIF_DMEM_HIGH_WATER 4 00885 #define PAPIF_DMEM_SHARED 5 00886 #define PAPIF_DMEM_TEXT 6 00887 #define PAPIF_DMEM_LIBRARY 7 00888 #define PAPIF_DMEM_HEAP 8 00889 #define PAPIF_DMEM_LOCKED 9 00890 #define PAPIF_DMEM_STACK 10 00891 #define PAPIF_DMEM_PAGESIZE 11 00892 #define PAPIF_DMEM_PTE 12 00893 #define PAPIF_DMEM_MAXVAL 12 00894 00895 #define PAPI_MAX_INFO_TERMS 12 /* should match PAPI_EVENTS_IN_DERIVED_EVENT defined in papi_internal.h */ 00896 00897 00918 enum { 00919 PAPI_LOCATION_CORE = 0, 00920 PAPI_LOCATION_CPU, 00921 PAPI_LOCATION_PACKAGE, 00922 PAPI_LOCATION_UNCORE, 00923 }; 00924 00926 enum { 00927 PAPI_DATATYPE_INT64 = 0, 00928 PAPI_DATATYPE_UINT64, 00929 PAPI_DATATYPE_FP64, 00930 PAPI_DATATYPE_BIT64, 00931 }; 00932 00934 enum { 00935 PAPI_VALUETYPE_RUNNING_SUM = 0, 00936 PAPI_VALUETYPE_ABSOLUTE, 00937 }; 00938 00940 enum { 00941 PAPI_TIMESCOPE_SINCE_START = 0, 00942 PAPI_TIMESCOPE_SINCE_LAST, 00943 PAPI_TIMESCOPE_UNTIL_NEXT, 00944 PAPI_TIMESCOPE_POINT, 00945 }; 00946 00948 enum { 00949 PAPI_UPDATETYPE_ARBITRARY = 0, 00950 PAPI_UPDATETYPE_PUSH, 00951 PAPI_UPDATETYPE_PULL, 00952 PAPI_UPDATETYPE_FIXEDFREQ, 00953 }; 00954 00955 00956 typedef struct event_info { 00957 unsigned int event_code; 00959 char symbol[PAPI_HUGE_STR_LEN]; 00960 char short_descr[PAPI_MIN_STR_LEN]; 00962 char long_descr[PAPI_HUGE_STR_LEN]; 00967 int component_index; 00968 char units[PAPI_MIN_STR_LEN]; 00969 int location; 00970 int data_type; 00971 int value_type; 00972 int timescope; 00973 int update_type; 00974 int update_freq; 00976 /* PRESET SPECIFIC FIELDS FOLLOW */ 00977 00978 00979 00980 unsigned int count; 00985 unsigned int event_type; 00988 char derived[PAPI_MIN_STR_LEN]; 00991 char postfix[PAPI_2MAX_STR_LEN]; 00996 unsigned int code[PAPI_MAX_INFO_TERMS]; 01001 char name[PAPI_MAX_INFO_TERMS] 01002 [PAPI_2MAX_STR_LEN]; 01006 char note[PAPI_HUGE_STR_LEN]; 01011 } PAPI_event_info_t; 01012 01013 01014 01015 01019 int PAPI_accum(int EventSet, long long * values); 01020 int PAPI_add_event(int EventSet, int Event); 01021 int PAPI_add_named_event(int EventSet, char *EventName); 01022 int PAPI_add_events(int EventSet, int *Events, int number); 01023 int PAPI_assign_eventset_component(int EventSet, int cidx); 01024 int PAPI_attach(int EventSet, unsigned long tid); 01025 int PAPI_cleanup_eventset(int EventSet); 01026 int PAPI_create_eventset(int *EventSet); 01027 int PAPI_detach(int EventSet); 01028 int PAPI_destroy_eventset(int *EventSet); 01029 int PAPI_enum_event(int *EventCode, int modifier); 01030 int PAPI_enum_cmp_event(int *EventCode, int modifier, int cidx); 01031 int PAPI_event_code_to_name(int EventCode, char *out); 01032 int PAPI_event_name_to_code(char *in, int *out); 01033 int PAPI_get_dmem_info(PAPI_dmem_info_t *dest); 01034 int PAPI_get_event_info(int EventCode, PAPI_event_info_t * info); 01035 const PAPI_exe_info_t *PAPI_get_executable_info(void); 01036 const PAPI_hw_info_t *PAPI_get_hardware_info(void); 01037 const PAPI_component_info_t *PAPI_get_component_info(int cidx); 01038 int PAPI_get_multiplex(int EventSet); 01039 int PAPI_get_opt(int option, PAPI_option_t * ptr); 01040 int PAPI_get_cmp_opt(int option, PAPI_option_t * ptr,int cidx); 01041 long long PAPI_get_real_cyc(void); 01042 long long PAPI_get_real_nsec(void); 01043 long long PAPI_get_real_usec(void); 01044 const PAPI_shlib_info_t *PAPI_get_shared_lib_info(void); 01045 int PAPI_get_thr_specific(int tag, void **ptr); 01046 int PAPI_get_overflow_event_index(int Eventset, long long overflow_vector, int *array, int *number); 01047 long long PAPI_get_virt_cyc(void); 01048 long long PAPI_get_virt_nsec(void); 01049 long long PAPI_get_virt_usec(void); 01050 int PAPI_is_initialized(void); 01051 int PAPI_library_init(int version); 01052 int PAPI_list_events(int EventSet, int *Events, int *number); 01053 int PAPI_list_threads(unsigned long *tids, int *number); 01054 int PAPI_lock(int); 01055 int PAPI_multiplex_init(void); 01056 int PAPI_num_cmp_hwctrs(int cidx); 01057 int PAPI_num_events(int EventSet); 01058 int PAPI_overflow(int EventSet, int EventCode, int threshold, 01059 int flags, PAPI_overflow_handler_t handler); 01060 void PAPI_perror(char *msg ); 01061 int PAPI_profil(void *buf, unsigned bufsiz, caddr_t offset, 01062 unsigned scale, int EventSet, int EventCode, 01063 int threshold, int flags); 01064 int PAPI_query_event(int EventCode); 01065 int PAPI_query_named_event(char *EventName); 01066 int PAPI_read(int EventSet, long long * values); 01067 int PAPI_read_ts(int EventSet, long long * values, long long *cyc); 01068 int PAPI_register_thread(void); 01069 int PAPI_remove_event(int EventSet, int EventCode); 01070 int PAPI_remove_named_event(int EventSet, char *EventName); 01071 int PAPI_remove_events(int EventSet, int *Events, int number); 01072 int PAPI_reset(int EventSet); 01073 int PAPI_set_debug(int level); 01074 int PAPI_set_cmp_domain(int domain, int cidx); 01075 int PAPI_set_domain(int domain); 01076 int PAPI_set_cmp_granularity(int granularity, int cidx); 01077 int PAPI_set_granularity(int granularity); 01078 int PAPI_set_multiplex(int EventSet); 01079 int PAPI_set_opt(int option, PAPI_option_t * ptr); 01080 int PAPI_set_thr_specific(int tag, void *ptr); 01081 void PAPI_shutdown(void); 01082 int PAPI_sprofil(PAPI_sprofil_t * prof, int profcnt, int EventSet, int EventCode, int threshold, int flags); 01083 int PAPI_start(int EventSet); 01084 int PAPI_state(int EventSet, int *status); 01085 int PAPI_stop(int EventSet, long long * values); 01086 char *PAPI_strerror(int); 01087 unsigned long PAPI_thread_id(void); 01088 int PAPI_thread_init(unsigned long (*id_fn) (void)); 01089 int PAPI_unlock(int); 01090 int PAPI_unregister_thread(void); 01091 int PAPI_write(int EventSet, long long * values); 01092 int PAPI_get_event_component(int EventCode); 01093 int PAPI_get_eventset_component(int EventSet); 01094 int PAPI_get_component_index(char *name); 01095 int PAPI_disable_component(int cidx); 01096 int PAPI_disable_component_by_name( char *name ); 01110 int PAPI_accum_counters(long long * values, int array_len); 01111 int PAPI_num_counters(void); 01112 int PAPI_num_components(void); 01113 int PAPI_read_counters(long long * values, int array_len); 01114 int PAPI_start_counters(int *events, int array_len); 01115 int PAPI_stop_counters(long long * values, int array_len); 01116 int PAPI_flips(float *rtime, float *ptime, long long * flpins, float *mflips); 01117 int PAPI_flops(float *rtime, float *ptime, long long * flpops, float *mflops); 01118 int PAPI_ipc(float *rtime, float *ptime, long long * ins, float *ipc); 01123 /* Backwards compatibility hacks. Remove eventually? */ 01124 int PAPI_num_hwctrs(void); 01125 #define PAPI_COMPONENT_INDEX(a) PAPI_get_event_component(a) 01126 #define PAPI_descr_error(a) PAPI_strerror(a) 01127 01128 #ifdef __cplusplus 01129 } 01130 #endif 01131 #endif