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