PAPI 7.1.0.0
Loading...
Searching...
No Matches
papi.h
Go to the documentation of this file.
1/****************************/
2/* THIS IS OPEN SOURCE CODE */
3/****************************/
4
22#ifndef _PAPI
23#define _PAPI
24
25#pragma GCC visibility push(default)
26
210/* Definition of PAPI_VERSION format. Note that each of the four
211 * components _must_ be less than 256. Also, the PAPI_VER_CURRENT
212 * masks out the revision and increment. Any revision change is supposed
213 * to be binary compatible between the user application code and the
214 * run-time library. Any modification that breaks this compatibility
215 * _should_ modify the minor version number as to force user applications
216 * to re-compile.
217 */
218#define PAPI_VERSION_NUMBER(maj,min,rev,inc) (((maj)<<24) | ((min)<<16) | ((rev)<<8) | (inc))
219#define PAPI_VERSION_MAJOR(x) (((x)>>24) & 0xff)
220#define PAPI_VERSION_MINOR(x) (((x)>>16) & 0xff)
221#define PAPI_VERSION_REVISION(x) (((x)>>8) & 0xff)
222#define PAPI_VERSION_INCREMENT(x)((x) & 0xff)
223
224/* This is the official PAPI version */
225/* The final digit represents the patch count */
226#define PAPI_VERSION PAPI_VERSION_NUMBER(7,1,0,0)
227#define PAPI_VER_CURRENT (PAPI_VERSION & 0xffff0000)
228
229 /* Tests for checking event code type */
230#define IS_NATIVE( EventCode ) ( ( EventCode & PAPI_NATIVE_MASK ) && !(EventCode & PAPI_PRESET_MASK) )
231#define IS_PRESET( EventCode ) ( ( EventCode & PAPI_PRESET_MASK ) && !(EventCode & PAPI_NATIVE_MASK) )
232#define IS_USER_DEFINED( EventCode ) ( ( EventCode & PAPI_PRESET_MASK ) && (EventCode & PAPI_NATIVE_MASK) )
233
234#ifdef __cplusplus
235extern "C"
236{
237#endif
238
239/* Include files */
240
241#include <sys/types.h>
242#include <limits.h>
243#include "papiStdEventDefs.h"
244
254#define PAPI_OK 0
255#define PAPI_EINVAL -1
256#define PAPI_ENOMEM -2
257#define PAPI_ESYS -3
258#define PAPI_ECMP -4
259#define PAPI_ESBSTR -4
260#define PAPI_ECLOST -5
261#define PAPI_EBUG -6
262#define PAPI_ENOEVNT -7
263#define PAPI_ECNFLCT -8
264#define PAPI_ENOTRUN -9
265#define PAPI_EISRUN -10
266#define PAPI_ENOEVST -11
267#define PAPI_ENOTPRESET -12
268#define PAPI_ENOCNTR -13
269#define PAPI_EMISC -14
270#define PAPI_EPERM -15
271#define PAPI_ENOINIT -16
272#define PAPI_ENOCMP -17
273#define PAPI_ENOSUPP -18
274#define PAPI_ENOIMPL -19
275#define PAPI_EBUF -20
276#define PAPI_EINVAL_DOM -21
277#define PAPI_EATTR -22
278#define PAPI_ECOUNT -23
279#define PAPI_ECOMBO -24
280#define PAPI_ECMP_DISABLED -25
281#define PAPI_EDELAY_INIT -26
282#define PAPI_EMULPASS -27
283#define PAPI_NUM_ERRORS 28
285#define PAPI_NOT_INITED 0
286#define PAPI_LOW_LEVEL_INITED 1 /* Low level has called library init */
287#define PAPI_HIGH_LEVEL_INITED 2 /* High level has called library init */
288#define PAPI_THREAD_LEVEL_INITED 4 /* Threads have been inited */
289
298#define PAPI_NULL -1
304#define PAPI_DOM_USER 0x1
305#define PAPI_DOM_MIN PAPI_DOM_USER
306#define PAPI_DOM_KERNEL 0x2
307#define PAPI_DOM_OTHER 0x4
308#define PAPI_DOM_SUPERVISOR 0x8
309#define PAPI_DOM_ALL (PAPI_DOM_USER|PAPI_DOM_KERNEL|PAPI_DOM_OTHER|PAPI_DOM_SUPERVISOR)
310/* #define PAPI_DOM_DEFAULT PAPI_DOM_USER NOW DEFINED BY COMPONENT */
311#define PAPI_DOM_MAX PAPI_DOM_ALL
312#define PAPI_DOM_HWSPEC 0x80000000
323#define PAPI_USR1_TLS 0x0
324#define PAPI_USR2_TLS 0x1
325#define PAPI_TLS_HIGH_LEVEL 0x2
326#define PAPI_NUM_TLS 0x3
327#define PAPI_TLS_USR1 PAPI_USR1_TLS
328#define PAPI_TLS_USR2 PAPI_USR2_TLS
329#define PAPI_TLS_NUM PAPI_NUM_TLS
330#define PAPI_TLS_ALL_THREADS 0x10
336#define PAPI_USR1_LOCK 0x0
337#define PAPI_USR2_LOCK 0x1
338#define PAPI_NUM_LOCK 0x2
339#define PAPI_LOCK_USR1 PAPI_USR1_LOCK
340#define PAPI_LOCK_USR2 PAPI_USR2_LOCK
341#define PAPI_LOCK_NUM PAPI_NUM_LOCK
344/* Remove this! If it breaks userspace we might have to add it back :( */
345/* #define PAPI_MPX_DEF_DEG 32 */
346
350#define PAPI_VENDOR_UNKNOWN 0
351#define PAPI_VENDOR_INTEL 1
352#define PAPI_VENDOR_AMD 2
353#define PAPI_VENDOR_IBM 3
354#define PAPI_VENDOR_CRAY 4
355#define PAPI_VENDOR_SUN 5
356#define PAPI_VENDOR_FREESCALE 6
357#define PAPI_VENDOR_ARM 7
358#define PAPI_VENDOR_MIPS 8
359#define PAPI_VENDOR_ARM_ARM 0x41
360#define PAPI_VENDOR_ARM_BROADCOM 0x42
361#define PAPI_VENDOR_ARM_CAVIUM 0x43
362#define PAPI_VENDOR_ARM_FUJITSU 0x46
363#define PAPI_VENDOR_ARM_HISILICON 0x48
364#define PAPI_VENDOR_ARM_APM 0x50
365#define PAPI_VENDOR_ARM_QUALCOMM 0x51
372#define PAPI_GRN_THR 0x1
373#define PAPI_GRN_MIN PAPI_GRN_THR
374#define PAPI_GRN_PROC 0x2
375#define PAPI_GRN_PROCG 0x4
376#define PAPI_GRN_SYS 0x8
377#define PAPI_GRN_SYS_CPU 0x10
378#define PAPI_GRN_MAX PAPI_GRN_SYS_CPU
384#define PAPI_STOPPED 0x01
385#define PAPI_RUNNING 0x02
386#define PAPI_PAUSED 0x04
387#define PAPI_NOT_INIT 0x08
388#define PAPI_OVERFLOWING 0x10
389#define PAPI_PROFILING 0x20
390#define PAPI_MULTIPLEXING 0x40
391#define PAPI_ATTACHED 0x80
392#define PAPI_CPU_ATTACHED 0x100
398#define PAPI_QUIET 0
399#define PAPI_VERB_ECONT 1
400#define PAPI_VERB_ESTOP 2
406#define PAPI_PROFIL_POSIX 0x0
407#define PAPI_PROFIL_RANDOM 0x1
408#define PAPI_PROFIL_WEIGHTED 0x2
409#define PAPI_PROFIL_COMPRESS 0x4
410#define PAPI_PROFIL_BUCKET_16 0x8
411#define PAPI_PROFIL_BUCKET_32 0x10
412#define PAPI_PROFIL_BUCKET_64 0x20
413#define PAPI_PROFIL_FORCE_SW 0x40
414#define PAPI_PROFIL_DATA_EAR 0x80
415#define PAPI_PROFIL_INST_EAR 0x100
416#define PAPI_PROFIL_BUCKETS (PAPI_PROFIL_BUCKET_16 | PAPI_PROFIL_BUCKET_32 | PAPI_PROFIL_BUCKET_64)
419/* @defgroup overflow_defns Overflow definitions
420 @{ */
421#define PAPI_OVERFLOW_FORCE_SW 0x40
422#define PAPI_OVERFLOW_HARDWARE 0x80
428#define PAPI_MULTIPLEX_DEFAULT 0x0
429#define PAPI_MULTIPLEX_FORCE_SW 0x1
435#define PAPI_INHERIT_ALL 1
436#define PAPI_INHERIT_NONE 0
439#define PAPI_DETACH 1
440#define PAPI_DEBUG 2
441#define PAPI_MULTIPLEX 3
442#define PAPI_DEFDOM 4
443#define PAPI_DOMAIN 5
444#define PAPI_DEFGRN 6
445#define PAPI_GRANUL 7
446#define PAPI_DEF_MPX_NS 8
447#define PAPI_MAX_MPX_CTRS 11
448#define PAPI_PROFIL 12
449#define PAPI_PRELOAD 13
450#define PAPI_CLOCKRATE 14
451#define PAPI_MAX_HWCTRS 15
452#define PAPI_HWINFO 16
453#define PAPI_EXEINFO 17
454#define PAPI_MAX_CPUS 18
455#define PAPI_ATTACH 19
456#define PAPI_SHLIBINFO 20
457#define PAPI_LIB_VERSION 21
458#define PAPI_COMPONENTINFO 22
459/* Currently the following options are only available on Itanium; they may be supported elsewhere in the future */
460#define PAPI_DATA_ADDRESS 23
461#define PAPI_INSTR_ADDRESS 24
462#define PAPI_DEF_ITIMER 25
463#define PAPI_DEF_ITIMER_NS 26
464/* Currently the following options are only available on systems using the perf_events component within papi */
465#define PAPI_CPU_ATTACH 27
466#define PAPI_INHERIT 28
467#define PAPI_USER_EVENTS_FILE 29
469#define PAPI_INIT_SLOTS 64 /*Number of initialized slots in
470 DynamicArray of EventSets */
472#define PAPI_MIN_STR_LEN 64 /* For small strings, like names & stuff */
473#define PAPI_MAX_STR_LEN 128 /* For average run-of-the-mill strings */
474#define PAPI_2MAX_STR_LEN 256 /* For somewhat longer run-of-the-mill strings */
475#define PAPI_HUGE_STR_LEN 1024 /* This should be defined in terms of a system parameter */
477#define PAPI_PMU_MAX 80 /* maximum number of pmu's supported by one component */
478#define PAPI_DERIVED 0x1 /* Flag to indicate that the event is derived */
488enum {
493 /* PAPI PRESET section */
507 /* PAPI native event related section */
516};
518#define PAPI_ENUM_ALL PAPI_ENUM_EVENTS
520#define PAPI_PRESET_BIT_MSC (1 << PAPI_PRESET_ENUM_MSC) /* Miscellaneous preset event bit */
521#define PAPI_PRESET_BIT_INS (1 << PAPI_PRESET_ENUM_INS) /* Instruction related preset event bit */
522#define PAPI_PRESET_BIT_IDL (1 << PAPI_PRESET_ENUM_IDL) /* Stalled or Idle preset event bit */
523#define PAPI_PRESET_BIT_BR (1 << PAPI_PRESET_ENUM_BR) /* branch related preset events */
524#define PAPI_PRESET_BIT_CND (1 << PAPI_PRESET_ENUM_CND) /* conditional preset events */
525#define PAPI_PRESET_BIT_MEM (1 << PAPI_PRESET_ENUM_MEM) /* memory related preset events */
526#define PAPI_PRESET_BIT_CACH (1 << PAPI_PRESET_ENUM_CACH) /* cache related preset events */
527#define PAPI_PRESET_BIT_L1 (1 << PAPI_PRESET_ENUM_L1) /* L1 cache related preset events */
528#define PAPI_PRESET_BIT_L2 (1 << PAPI_PRESET_ENUM_L2) /* L2 cache related preset events */
529#define PAPI_PRESET_BIT_L3 (1 << PAPI_PRESET_ENUM_L3) /* L3 cache related preset events */
530#define PAPI_PRESET_BIT_TLB (1 << PAPI_PRESET_ENUM_TLB) /* Translation Lookaside Buffer events */
531#define PAPI_PRESET_BIT_FP (1 << PAPI_PRESET_ENUM_FP) /* Floating Point related preset events */
533#define PAPI_NTV_GROUP_AND_MASK 0x00FF0000 /* bits occupied by group number */
534#define PAPI_NTV_GROUP_SHIFT 16 /* bit shift to encode group number */
537/*
538The Low Level API
539
540The following functions represent the low level portion of the
541PerfAPI. These functions provide greatly increased efficiency and
542functionality over the high level API presented in the next
543section. All of the following functions are callable from both C and
544Fortran except where noted. As mentioned in the introduction, the low
545level API is only as powerful as the component upon which it is
546built. Thus some features may not be available on every platform. The
547converse may also be true, that more advanced features may be
548available and defined in the header file. The user is encouraged to
549read the documentation carefully. */
550
551
552#include <signal.h>
553
554/* Earlier versions of PAPI define a special long_long type to mask
555 an incompatibility between the Windows compiler and gcc-style compilers.
556 That problem no longer exists, so long_long has been purged from the source.
557 The defines below preserve backward compatibility. Their use is deprecated,
558 but will continue to be supported in the near term.
560#define long_long long long
561#define u_long_long unsigned long long
562
565 typedef unsigned long PAPI_thread_id_t;
566
568 typedef struct _papi_all_thr_spec {
569 int num;
571 void **data;
574 typedef void (*PAPI_overflow_handler_t) (int EventSet, void *address,
575 long long overflow_vector, void *context);
577typedef void *vptr_t;
578
580 typedef struct _papi_sprofil {
581 void *pr_base;
582 unsigned pr_size;
583 vptr_t pr_off;
584 unsigned pr_scale;
589
591 typedef struct _papi_itimer_option {
592 int itimer_num;
593 int itimer_sig;
594 int ns;
595 int flags;
597
599 typedef struct _papi_inherit_option {
600 int eventset;
601 int inherit;
603
605 typedef struct _papi_domain_option {
606 int def_cidx;
607 int eventset;
608 int domain;
610
612 typedef struct _papi_granularity_option {
613 int def_cidx;
614 int eventset;
615 int granularity;
617
619 typedef struct _papi_preload_option {
620 char lib_preload_env[PAPI_MAX_STR_LEN];
621 char lib_preload_sep;
622 char lib_dir_env[PAPI_MAX_STR_LEN];
623 char lib_dir_sep;
625
627 typedef struct _papi_component_option {
629 char short_name[PAPI_MIN_STR_LEN];
631 char description[PAPI_MAX_STR_LEN];
633 char support_version[PAPI_MIN_STR_LEN];
634 char kernel_version[PAPI_MIN_STR_LEN];
635 char disabled_reason[PAPI_HUGE_STR_LEN];
636 int disabled;
637 int initialized;
638 int CmpIdx;
639 int num_cntrs;
640 int num_mpx_cntrs;
641 int num_preset_events;
643 int default_domain;
644 int available_domains;
645 int default_granularity;
646 int available_granularities;
647 int hardware_intr_sig;
648 int component_type;
649 char *pmu_names[PAPI_PMU_MAX];
650 int reserved[8]; /* */
651 unsigned int hardware_intr:1;
652 unsigned int precise_intr:1;
653 unsigned int posix1b_timers:1;
654 unsigned int kernel_profile:1;
655 unsigned int kernel_multiplex:1;
656 unsigned int fast_counter_read:1;
657 unsigned int fast_real_timer:1;
658 unsigned int fast_virtual_timer:1;
659 unsigned int attach:1;
660 unsigned int attach_must_ptrace:1;
661 unsigned int cntr_umasks:1;
662 /* This should be a granularity option */
663 unsigned int cpu:1;
664 unsigned int inherit:1;
665 unsigned int reserved_bits:19;
667
669 typedef struct _papi_mpx_info {
670 int timer_sig;
671 int timer_num;
672 int timer_us;
675 typedef int (*PAPI_debug_handler_t) (int code);
676
678 typedef struct _papi_debug_option {
679 int level;
682
685 typedef struct _papi_address_map {
687 vptr_t text_start;
688 vptr_t text_end;
689 vptr_t data_start;
690 vptr_t data_end;
691 vptr_t bss_start;
692 vptr_t bss_end;
694
697 typedef struct _papi_program_info {
698 char fullname[PAPI_HUGE_STR_LEN];
699 PAPI_address_map_t address_info;
701
703 typedef struct _papi_shared_lib_info {
705 int count;
707
710
711 /* The following defines and next for structures define the memory hierarchy */
712 /* All sizes are in BYTES */
713 /* Associativity:
714 0: Undefined;
715 1: Direct Mapped
716 SHRT_MAX: Full
717 Other values == associativity
718 */
719#define PAPI_MH_TYPE_EMPTY 0x0
720#define PAPI_MH_TYPE_INST 0x1
721#define PAPI_MH_TYPE_DATA 0x2
722#define PAPI_MH_TYPE_VECTOR 0x4
723#define PAPI_MH_TYPE_TRACE 0x8
724#define PAPI_MH_TYPE_UNIFIED (PAPI_MH_TYPE_INST|PAPI_MH_TYPE_DATA)
725#define PAPI_MH_CACHE_TYPE(a) (a & 0xf)
726#define PAPI_MH_TYPE_WT 0x00 /* write-through cache */
727#define PAPI_MH_TYPE_WB 0x10 /* write-back cache */
728#define PAPI_MH_CACHE_WRITE_POLICY(a) (a & 0xf0)
729#define PAPI_MH_TYPE_UNKNOWN 0x000
730#define PAPI_MH_TYPE_LRU 0x100
731#define PAPI_MH_TYPE_PSEUDO_LRU 0x200
732#define PAPI_MH_TYPE_FIFO 0x400
733#define PAPI_MH_CACHE_REPLACEMENT_POLICY(a) (a & 0xf00)
734#define PAPI_MH_TYPE_TLB 0x1000 /* tlb, not memory cache */
735#define PAPI_MH_TYPE_PREF 0x2000 /* prefetch buffer */
736#define PAPI_MH_TYPE_RD_ALLOC 0x10000 /* read-allocation cache */
737#define PAPI_MH_TYPE_WR_ALLOC 0x20000 /* write-allocation cache */
738#define PAPI_MH_TYPE_RW_ALLOC 0x40000 /* read-write-allocation cache */
739#define PAPI_MH_CACHE_ALLOCATION_POLICY(a) (a & 0xf0000)
740#define PAPI_MH_MAX_LEVELS 6 /* # descriptors for each TLB or cache level */
741#define PAPI_MAX_MEM_HIERARCHY_LEVELS 4
742
744 typedef struct _papi_mh_tlb_info {
745 int type;
746 int num_entries;
747 int page_size;
748 int associativity;
750
752 typedef struct _papi_mh_cache_info {
753 int type;
754 int size;
755 int line_size;
756 int num_lines;
757 int associativity;
759
761 typedef struct _papi_mh_level_info {
765
768 typedef struct _papi_mh_info {
769 int levels;
772
775 typedef struct _papi_hw_info {
776 int ncpu;
777 int threads;
778 int cores;
779 int sockets;
780 int nnodes;
781 int totalcpus;
782 int vendor;
783 char vendor_string[PAPI_MAX_STR_LEN];
784 int model;
785 char model_string[PAPI_MAX_STR_LEN];
786 float revision;
787 int cpuid_family;
788 int cpuid_model;
789 int cpuid_stepping;
791 int cpu_max_mhz;
792 int cpu_min_mhz;
794 PAPI_mh_info_t mem_hierarchy;
795 int virtualized;
796 char virtual_vendor_string[PAPI_MAX_STR_LEN];
798 char virtual_vendor_version[PAPI_MAX_STR_LEN];
801 /* Legacy Values, do not use */
802 float mhz;
803 int clock_mhz;
805 /* For future expansion */
806 int reserved[8];
807
809
811 typedef struct _papi_attach_option {
812 int eventset;
813 unsigned long tid;
815
817 typedef struct _papi_cpu_option {
818 int eventset;
819 unsigned int cpu_num;
821
823 typedef struct _papi_multiplex_option {
824 int eventset;
825 int ns;
826 int flags;
828
831 typedef struct _papi_addr_range_option {
832 int eventset;
834 vptr_t end;
835 int start_off;
836 int end_off;
838
843 typedef union
857 PAPI_shlib_info_t *shlib_info;
863
866 typedef struct _dmem_t {
867 long long peak;
868 long long size;
869 long long resident;
870 long long high_water_mark;
871 long long shared;
872 long long text;
873 long long library;
874 long long heap;
875 long long locked;
876 long long stack;
877 long long pagesize;
878 long long pte;
880
881/* Fortran offsets into PAPI_dmem_info_t structure. */
883#define PAPIF_DMEM_VMPEAK 1
884#define PAPIF_DMEM_VMSIZE 2
885#define PAPIF_DMEM_RESIDENT 3
886#define PAPIF_DMEM_HIGH_WATER 4
887#define PAPIF_DMEM_SHARED 5
888#define PAPIF_DMEM_TEXT 6
889#define PAPIF_DMEM_LIBRARY 7
890#define PAPIF_DMEM_HEAP 8
891#define PAPIF_DMEM_LOCKED 9
892#define PAPIF_DMEM_STACK 10
893#define PAPIF_DMEM_PAGESIZE 11
894#define PAPIF_DMEM_PTE 12
895#define PAPIF_DMEM_MAXVAL 12
897#define PAPI_MAX_INFO_TERMS 12 /* should match PAPI_EVENTS_IN_DERIVED_EVENT defined in papi_internal.h */
898
899
920enum {
925};
926
928enum {
933};
934
936enum {
939};
940
942enum {
947};
948
950enum {
955};
956
958 typedef struct event_info {
959 unsigned int event_code;
961 char symbol[PAPI_HUGE_STR_LEN];
962 char short_descr[PAPI_MIN_STR_LEN];
964 char long_descr[PAPI_HUGE_STR_LEN];
969 int component_index;
973 int value_type;
974 int timescope;
975 int update_type;
976 int update_freq;
978 /* PRESET SPECIFIC FIELDS FOLLOW */
979
980
982 unsigned int count;
987 unsigned int event_type;
990 char derived[PAPI_MIN_STR_LEN];
993 char postfix[PAPI_2MAX_STR_LEN];
998 unsigned int code[PAPI_MAX_INFO_TERMS];
1008 char note[PAPI_HUGE_STR_LEN];
1014
1015
1023typedef enum {
1029
1038enum {
1044};
1045
1050typedef enum {
1057
1069typedef enum {
1135
1136
1140 int PAPI_accum(int EventSet, long long * values);
1141 int PAPI_add_event(int EventSet, int Event);
1142 int PAPI_add_named_event(int EventSet, const char *EventName);
1143 int PAPI_add_events(int EventSet, int *Events, int number);
1145 int PAPI_attach(int EventSet, unsigned long tid);
1147 int PAPI_create_eventset(int *EventSet);
1148 int PAPI_detach(int EventSet);
1150 int PAPI_enum_event(int *EventCode, int modifier);
1151 int PAPI_enum_cmp_event(int *EventCode, int modifier, int cidx);
1152 int PAPI_event_code_to_name(int EventCode, char *out);
1153 int PAPI_event_name_to_code(const char *in, int *out);
1155 int PAPI_get_event_info(int EventCode, PAPI_event_info_t * info);
1159 int PAPI_get_multiplex(int EventSet);
1160 int PAPI_get_opt(int option, PAPI_option_t * ptr);
1161 int PAPI_get_cmp_opt(int option, PAPI_option_t * ptr,int cidx);
1162 long long PAPI_get_real_cyc(void);
1163 long long PAPI_get_real_nsec(void);
1164 long long PAPI_get_real_usec(void);
1166 int PAPI_get_thr_specific(int tag, void **ptr);
1167 int PAPI_get_overflow_event_index(int Eventset, long long overflow_vector, int *array, int *number);
1168 long long PAPI_get_virt_cyc(void);
1169 long long PAPI_get_virt_nsec(void);
1170 long long PAPI_get_virt_usec(void);
1171 int PAPI_is_initialized(void);
1172 int PAPI_library_init(int version);
1173 int PAPI_list_events(int EventSet, int *Events, int *number);
1174 int PAPI_list_threads(unsigned long *tids, int *number);
1175 int PAPI_lock(int);
1176 int PAPI_multiplex_init(void);
1177 int PAPI_num_cmp_hwctrs(int cidx);
1178 int PAPI_num_events(int EventSet);
1179 int PAPI_overflow(int EventSet, int EventCode, int threshold,
1180 int flags, PAPI_overflow_handler_t handler);
1181 void PAPI_perror(const char *msg );
1182 int PAPI_profil(void *buf, unsigned bufsiz, vptr_t offset,
1183 unsigned scale, int EventSet, int EventCode,
1184 int threshold, int flags);
1185 int PAPI_query_event(int EventCode);
1186 int PAPI_query_named_event(const char *EventName);
1187 int PAPI_read(int EventSet, long long * values);
1188 int PAPI_read_ts(int EventSet, long long * values, long long *cyc);
1189 int PAPI_register_thread(void);
1190 int PAPI_remove_event(int EventSet, int EventCode);
1191 int PAPI_remove_named_event(int EventSet, const char *EventName);
1192 int PAPI_remove_events(int EventSet, int *Events, int number);
1193 int PAPI_reset(int EventSet);
1194 int PAPI_set_debug(int level);
1195 int PAPI_set_cmp_domain(int domain, int cidx);
1196 int PAPI_set_domain(int domain);
1197 int PAPI_set_cmp_granularity(int granularity, int cidx);
1198 int PAPI_set_granularity(int granularity);
1199 int PAPI_set_multiplex(int EventSet);
1200 int PAPI_set_opt(int option, PAPI_option_t * ptr);
1201 int PAPI_set_thr_specific(int tag, void *ptr);
1202 void PAPI_shutdown(void);
1203 int PAPI_sprofil(PAPI_sprofil_t * prof, int profcnt, int EventSet, int EventCode, int threshold, int flags);
1204 int PAPI_start(int EventSet);
1205 int PAPI_state(int EventSet, int *status);
1206 int PAPI_stop(int EventSet, long long * values);
1207 char *PAPI_strerror(int);
1208 unsigned long PAPI_thread_id(void);
1209 int PAPI_thread_init(unsigned long (*id_fn) (void));
1210 int PAPI_unlock(int);
1211 int PAPI_unregister_thread(void);
1212 int PAPI_write(int EventSet, long long * values);
1213 int PAPI_get_event_component(int EventCode);
1215 int PAPI_get_component_index(const char *name);
1216 int PAPI_disable_component(int cidx);
1217 int PAPI_disable_component_by_name(const char *name );
1218 int PAPI_num_components(void);
1220 int PAPI_flips_rate(int event, float *rtime, float *ptime, long long *flpins, float *mflips);
1221 int PAPI_flops_rate(int event, float *rtime, float *ptime, long long * flpops, float *mflops);
1222 int PAPI_ipc(float *rtime, float *ptime, long long * ins, float *ipc);
1223 int PAPI_epc(int event, float *rtime, float *ptime, long long *ref, long long *core, long long *evt, float *epc);
1224 int PAPI_rate_stop(void);
1226 int PAPI_enum_dev_type(int enum_modifier, void **handle);
1227 int PAPI_get_dev_type_attr(void *handle, PAPI_dev_type_attr_e attr, void *value);
1228 int PAPI_get_dev_attr(void *handle, int id, PAPI_dev_attr_e attr, void *value);
1238 int PAPI_hl_region_begin(const char* region);
1239 int PAPI_hl_read(const char* region);
1240 int PAPI_hl_region_end(const char* region);
1241 int PAPI_hl_stop(void);
1245/* Backwards compatibility hacks. Remove eventually? */
1247#define PAPI_COMPONENT_INDEX(a) PAPI_get_event_component(a)
1248#define PAPI_descr_error(a) PAPI_strerror(a)
1249
1250#ifdef __cplusplus
1251}
1252#endif
1253
1254#pragma GCC visibility pop
1255
1256#endif
static papi_handle_t handle
Definition: Gamum.c:21
static const PAPI_hw_info_t * hw_info
Definition: byte_profile.c:28
static long count
static int Event[MAX_EVENTS]
Accumulate and reset counters in an EventSet.
add PAPI preset or native hardware event to an event set
add multiple PAPI presets or native hardware events to an event set
add PAPI preset or native hardware event by name to an EventSet
Assign a component index to an existing but empty EventSet.
Attach PAPI event set to the specified thread id.
Empty and destroy an EventSet.
Create a new empty PAPI EventSet.
Empty and destroy an EventSet.
Detach PAPI event set from previously specified thread id and restore to executing thread.
disables the named component
disables the specified component
Enumerate PAPI preset or native events for a given component.
returns handle of next device type
Enumerate PAPI preset or native events.
Simplified call to get arbitrary events per cycle, real and processor time.
Convert a numeric hardware event code to a name.
Convert a name to a numeric hardware event code.
Simplified call to get Mflips/s (floating point instruction rate), real and processor time.
Simplified call to get Mflops/s (floating point operation rate), real and processor time.
Get component specific PAPI options.
returns the component index for the named component
get information about a specific software component
returns device attributes
returns device type attributes
Get information about the dynamic memory usage of the current program.
return component an event belongs to
Get the event's name and description info.
return index for component an eventset is assigned to
Get the multiplexing status of specified event set.
Get PAPI library or event set options.
converts an overflow vector into an array of indexes to overflowing events
Retrieve a pointer to a thread specific data structure.
Read performance events inside of a region and store the difference to the corresponding beginning of...
Read performance events at the beginning of a region.
Read performance events at the end of a region and store the difference to the corresponding beginnin...
Simplified call to get instructions per cycle, real and processor time.
initialize the PAPI library.
list the events in an event set
List the registered thread ids.
Lock one of two mutex variables defined in papi.h.
Return the number of hardware counters for the specified component.
Return the number of events in an event set.
Set up an event set to begin registering overflows.
Produces a string on standard error, describing the last library error.
Generate a histogram of hardware counter overflows vs. PC addresses.
Query if PAPI event exists.
Query if a named PAPI event exists.
Read hardware counters with a timestamp.
Read hardware counters from an event set.
removes a hardware event from a PAPI event set.
Remove an array of hardware event codes from a PAPI event set.
removes a named hardware event from a PAPI event set.
Reset the hardware event counts in an event set.
Set the default counting domain for new event sets bound to the specified component.
Set the default counting granularity for eventsets bound to the specified component.
Set the current debug level for error output from PAPI.
Set the default counting domain for new event sets bound to the cpu component.
Set the default counting granularity for eventsets bound to the cpu component.
Convert a standard event set to a multiplexed event set.
Set PAPI library or event set options.
Store a pointer to a thread specific data structure.
Generate PC histogram data from multiple code regions where hardware counter overflow occurs.
Start counting hardware events in an event set.
Return the counting state of an EventSet.
Stop counting hardware events in an event set.
Returns a string describing the PAPI error code.
Initialize thread support in the PAPI library.
Unlock one of the mutex variables defined in papi.h.
Write counter values into counters.
volatile int buf[CACHE_FLUSH_BUFFER_SIZE_INTS]
Definition: do_loops.c:12
#define PAPI_MIN_STR_LEN
Definition: f90papi.h:208
#define PAPI_PMU_MAX
Definition: f90papi.h:101
#define PAPI_MAX_STR_LEN
Definition: f90papi.h:77
#define PAPI_MAX_MEM_HIERARCHY_LEVELS
Definition: f90papi.h:103
#define PAPI_2MAX_STR_LEN
Definition: f90papi.h:180
#define PAPI_MAX_INFO_TERMS
Definition: f90papi.h:147
#define PAPI_HUGE_STR_LEN
Definition: f90papi.h:120
int PAPI_hl_stop(void)
Definition: papi_hl.c:2184
long long PAPI_get_virt_cyc(void)
Definition: papi.c:6860
long long PAPI_get_real_cyc(void)
Definition: papi.c:6777
int PAPI_register_thread(void)
Definition: papi.c:750
int PAPI_num_components(void)
Definition: papi.c:4947
long long PAPI_get_virt_nsec(void)
Definition: papi.c:6890
int PAPI_is_initialized(void)
Definition: papi.c:7023
long long PAPI_get_real_nsec(void)
Definition: papi.c:6797
int PAPI_multiplex_init(void)
Definition: papi.c:3541
unsigned long PAPI_thread_id(void)
Definition: papi.c:704
void PAPI_shutdown(void)
Definition: papi.c:5021
long long PAPI_get_virt_usec(void)
Definition: papi.c:6932
int PAPI_unregister_thread(void)
Definition: papi.c:786
const PAPI_exe_info_t * PAPI_get_executable_info(void)
Definition: papi.c:6674
long long PAPI_get_real_usec(void)
Definition: papi.c:6824
const PAPI_shlib_info_t * PAPI_get_shared_lib_info(void)
Definition: papi.c:6704
int PAPI_rate_stop(void)
Definition: papi.c:415
const PAPI_hw_info_t * PAPI_get_hardware_info(void)
Definition: papi.c:6745
PAPI_dev_type_attr_e
Definition: papi.h:1049
@ PAPI_DEV_TYPE_ATTR__INT_COUNT
Definition: papi.h:1053
@ PAPI_DEV_TYPE_ATTR__INT_PAPI_ID
Definition: papi.h:1050
@ PAPI_DEV_TYPE_ATTR__CHAR_STATUS
Definition: papi.h:1054
@ PAPI_DEV_TYPE_ATTR__INT_VENDOR_ID
Definition: papi.h:1051
@ PAPI_DEV_TYPE_ATTR__CHAR_NAME
Definition: papi.h:1052
PAPI_dev_type_id_e
Definition: papi.h:1022
@ PAPI_DEV_TYPE_ID__ROCM
Definition: papi.h:1025
@ PAPI_DEV_TYPE_ID__CUDA
Definition: papi.h:1024
@ PAPI_DEV_TYPE_ID__MAX_NUM
Definition: papi.h:1026
@ PAPI_DEV_TYPE_ID__CPU
Definition: papi.h:1023
PAPI_dev_attr_e
Definition: papi.h:1068
@ PAPI_DEV_ATTR__CPU_UINT_L2U_CACHE_LINE_SIZE
Definition: papi.h:1076
@ PAPI_DEV_ATTR__CPU_UINT_SOCKET_COUNT
Definition: papi.h:1086
@ PAPI_DEV_ATTR__CPU_UINT_L3U_CACHE_LINE_SIZE
Definition: papi.h:1077
@ PAPI_DEV_ATTR__ROCM_CHAR_DEVICE_NAME
Definition: papi.h:1118
@ PAPI_DEV_ATTR__CPU_UINT_L1I_CACHE_LINE_COUNT
Definition: papi.h:1078
@ PAPI_DEV_ATTR__CPU_UINT_CORE_COUNT
Definition: papi.h:1088
@ PAPI_DEV_ATTR__ROCM_UINT_WG_DIM_Z
Definition: papi.h:1125
@ PAPI_DEV_ATTR__CPU_UINT_L1D_CACHE_SIZE
Definition: papi.h:1071
@ PAPI_DEV_ATTR__CUDA_UINT_WARP_SIZE
Definition: papi.h:1098
@ PAPI_DEV_ATTR__CUDA_UINT_BLK_DIM_X
Definition: papi.h:1101
@ PAPI_DEV_ATTR__CUDA_UINT_COMP_CAP_MINOR
Definition: papi.h:1115
@ PAPI_DEV_ATTR__CPU_CHAR_NAME
Definition: papi.h:1069
@ PAPI_DEV_ATTR__CUDA_CHAR_DEVICE_NAME
Definition: papi.h:1097
@ PAPI_DEV_ATTR__CPU_UINT_L1D_CACHE_LINE_SIZE
Definition: papi.h:1075
@ PAPI_DEV_ATTR__CUDA_UINT_GRD_DIM_X
Definition: papi.h:1104
@ PAPI_DEV_ATTR__CUDA_UINT_MANAGED_MEM
Definition: papi.h:1113
@ PAPI_DEV_ATTR__CUDA_UINT_SM_COUNT
Definition: papi.h:1108
@ PAPI_DEV_ATTR__CUDA_UINT_SHM_PER_BLK
Definition: papi.h:1099
@ PAPI_DEV_ATTR__ROCM_UINT_CU_COUNT
Definition: papi.h:1129
@ PAPI_DEV_ATTR__ROCM_UINT_WG_DIM_Y
Definition: papi.h:1124
@ PAPI_DEV_ATTR__CUDA_UINT_COMP_CAP_MAJOR
Definition: papi.h:1114
@ PAPI_DEV_ATTR__ROCM_UINT_WAVEFRONT_SIZE
Definition: papi.h:1119
@ PAPI_DEV_ATTR__CPU_UINT_NUMA_COUNT
Definition: papi.h:1087
@ PAPI_DEV_ATTR__CPU_UINT_THR_PER_NUMA
Definition: papi.h:1095
@ PAPI_DEV_ATTR__CUDA_UINT_MAP_HOST_MEM
Definition: papi.h:1110
@ PAPI_DEV_ATTR__CUDA_UINT_MULTI_KERNEL
Definition: papi.h:1109
@ PAPI_DEV_ATTR__CPU_UINT_L3U_CACHE_ASSOC
Definition: papi.h:1085
@ PAPI_DEV_ATTR__CPU_UINT_L3U_CACHE_LINE_COUNT
Definition: papi.h:1081
@ PAPI_DEV_ATTR__CUDA_UINT_BLK_PER_SM
Definition: papi.h:1116
@ PAPI_DEV_ATTR__CPU_UINT_L2U_CACHE_SIZE
Definition: papi.h:1072
@ PAPI_DEV_ATTR__CUDA_UINT_MEMCPY_OVERLAP
Definition: papi.h:1111
@ PAPI_DEV_ATTR__ROCM_UINT_GRD_DIM_Y
Definition: papi.h:1127
@ PAPI_DEV_ATTR__CUDA_ULONG_UID
Definition: papi.h:1096
@ PAPI_DEV_ATTR__CUDA_UINT_GRD_DIM_Y
Definition: papi.h:1105
@ PAPI_DEV_ATTR__ROCM_UINT_WG_DIM_X
Definition: papi.h:1123
@ PAPI_DEV_ATTR__CPU_UINT_THREAD_COUNT
Definition: papi.h:1089
@ PAPI_DEV_ATTR__ROCM_UINT_WAVE_PER_CU
Definition: papi.h:1121
@ PAPI_DEV_ATTR__CPU_UINT_L1D_CACHE_LINE_COUNT
Definition: papi.h:1079
@ PAPI_DEV_ATTR__ROCM_UINT_SHM_PER_WG
Definition: papi.h:1122
@ PAPI_DEV_ATTR__CPU_UINT_L1I_CACHE_SIZE
Definition: papi.h:1070
@ PAPI_DEV_ATTR__CPU_UINT_L3U_CACHE_SIZE
Definition: papi.h:1073
@ PAPI_DEV_ATTR__ROCM_UINT_COMP_CAP_MAJOR
Definition: papi.h:1131
@ PAPI_DEV_ATTR__CUDA_UINT_BLK_DIM_Y
Definition: papi.h:1102
@ PAPI_DEV_ATTR__CPU_UINT_MODEL
Definition: papi.h:1091
@ PAPI_DEV_ATTR__CUDA_UINT_SHM_PER_SM
Definition: papi.h:1100
@ PAPI_DEV_ATTR__CPU_UINT_THR_NUMA_AFFINITY
Definition: papi.h:1094
@ PAPI_DEV_ATTR__CUDA_UINT_THR_PER_BLK
Definition: papi.h:1107
@ PAPI_DEV_ATTR__CPU_UINT_L2U_CACHE_ASSOC
Definition: papi.h:1084
@ PAPI_DEV_ATTR__ROCM_UINT_GRD_DIM_X
Definition: papi.h:1126
@ PAPI_DEV_ATTR__CPU_UINT_L1D_CACHE_ASSOC
Definition: papi.h:1083
@ PAPI_DEV_ATTR__CPU_UINT_L1I_CACHE_ASSOC
Definition: papi.h:1082
@ PAPI_DEV_ATTR__CUDA_UINT_UNIFIED_ADDR
Definition: papi.h:1112
@ PAPI_DEV_ATTR__CPU_UINT_FAMILY
Definition: papi.h:1090
@ PAPI_DEV_ATTR__ROCM_UINT_COMP_CAP_MINOR
Definition: papi.h:1132
@ PAPI_DEV_ATTR__ROCM_UINT_GRD_DIM_Z
Definition: papi.h:1128
@ PAPI_DEV_ATTR__CPU_UINT_L2U_CACHE_LINE_COUNT
Definition: papi.h:1080
@ PAPI_DEV_ATTR__CPU_UINT_NUMA_MEM_SIZE
Definition: papi.h:1093
@ PAPI_DEV_ATTR__CUDA_UINT_BLK_DIM_Z
Definition: papi.h:1103
@ PAPI_DEV_ATTR__ROCM_ULONG_UID
Definition: papi.h:1117
@ PAPI_DEV_ATTR__ROCM_UINT_WORKGROUP_SIZE
Definition: papi.h:1120
@ PAPI_DEV_ATTR__CUDA_UINT_GRD_DIM_Z
Definition: papi.h:1106
@ PAPI_DEV_ATTR__CPU_UINT_L1I_CACHE_LINE_SIZE
Definition: papi.h:1074
@ PAPI_DEV_ATTR__ROCM_UINT_SIMD_PER_CU
Definition: papi.h:1130
@ PAPI_DEV_ATTR__CPU_UINT_STEPPING
Definition: papi.h:1092
@ PAPI_DEV_TYPE_ENUM__CUDA
Definition: papi.h:1040
@ PAPI_DEV_TYPE_ENUM__ALL
Definition: papi.h:1042
@ PAPI_DEV_TYPE_ENUM__ROCM
Definition: papi.h:1041
@ PAPI_DEV_TYPE_ENUM__CPU
Definition: papi.h:1039
@ PAPI_DEV_TYPE_ENUM__FIRST
Definition: papi.h:1038
@ PAPI_LOCATION_CPU
Definition: papi.h:921
@ PAPI_LOCATION_PACKAGE
Definition: papi.h:922
@ PAPI_LOCATION_CORE
Definition: papi.h:920
@ PAPI_LOCATION_UNCORE
Definition: papi.h:923
static int EventSet
Definition: init_fini.c:8
static long long values[NUM_EVENTS]
Definition: init_fini.c:10
static int threshold
static struct timeval start
uint16_t location
uint16_t reserved
uint8_t version
uint16_t type
static struct counter_info * event_info
int multiplex(void)
Definition: multiplex.c:35
char * PAPI_user_defined_events_file_t
Definition: papi.h:708
@ PAPI_UPDATETYPE_FIXEDFREQ
Definition: papi.h:953
@ PAPI_UPDATETYPE_PUSH
Definition: papi.h:951
@ PAPI_UPDATETYPE_ARBITRARY
Definition: papi.h:950
@ PAPI_UPDATETYPE_PULL
Definition: papi.h:952
@ PAPI_DATATYPE_UINT64
Definition: papi.h:929
@ PAPI_DATATYPE_FP64
Definition: papi.h:930
@ PAPI_DATATYPE_INT64
Definition: papi.h:928
@ PAPI_DATATYPE_BIT64
Definition: papi.h:931
@ PAPI_PRESET_ENUM_L3
Definition: papi.h:502
@ PAPI_ENUM_EVENTS
Definition: papi.h:488
@ PAPI_PRESET_ENUM_FP
Definition: papi.h:504
@ PAPI_PRESET_ENUM_CACH
Definition: papi.h:499
@ PAPI_PRESET_ENUM_MEM
Definition: papi.h:498
@ PAPI_PRESET_ENUM_MSC
Definition: papi.h:493
@ PAPI_ENUM_FIRST
Definition: papi.h:489
@ PAPI_NTV_ENUM_DEAR
Definition: papi.h:513
@ PAPI_NTV_ENUM_UMASKS
Definition: papi.h:507
@ PAPI_PRESET_ENUM_AVAIL
Definition: papi.h:490
@ PAPI_PRESET_ENUM_L2
Definition: papi.h:501
@ PAPI_NTV_ENUM_DARR
Definition: papi.h:510
@ PAPI_PRESET_ENUM_L1
Definition: papi.h:500
@ PAPI_NTV_ENUM_GROUPS
Definition: papi.h:514
@ PAPI_PRESET_ENUM_INS
Definition: papi.h:494
@ PAPI_PRESET_ENUM_CND
Definition: papi.h:497
@ PAPI_NTV_ENUM_UMASK_COMBOS
Definition: papi.h:508
@ PAPI_NTV_ENUM_IEAR
Definition: papi.h:512
@ PAPI_NTV_ENUM_IARR
Definition: papi.h:509
@ PAPI_PRESET_ENUM_TLB
Definition: papi.h:503
@ PAPI_NTV_ENUM_OPCM
Definition: papi.h:511
@ PAPI_PRESET_ENUM_IDL
Definition: papi.h:495
@ PAPI_PRESET_ENUM_BR
Definition: papi.h:496
void(* PAPI_overflow_handler_t)(int EventSet, void *address, long long overflow_vector, void *context)
Definition: papi.h:573
#define PAPI_MH_MAX_LEVELS
Definition: papi.h:739
unsigned long PAPI_thread_id_t
Definition: papi.h:564
int(* PAPI_debug_handler_t)(int code)
Definition: papi.h:674
@ PAPI_VALUETYPE_ABSOLUTE
Definition: papi.h:937
@ PAPI_VALUETYPE_RUNNING_SUM
Definition: papi.h:936
int PAPI_num_hwctrs(void)
Definition: papi.c:4468
@ PAPI_TIMESCOPE_UNTIL_NEXT
Definition: papi.h:944
@ PAPI_TIMESCOPE_POINT
Definition: papi.h:945
@ PAPI_TIMESCOPE_SINCE_LAST
Definition: papi.h:943
@ PAPI_TIMESCOPE_SINCE_START
Definition: papi.h:942
void * vptr_t
Definition: papi.h:576
i inherit inherit
static int num_native_events
Definition: papi_internal.c:81
static double array[ARRAYSIZE]
Definition: papi_l1_dca.c:23
static char stack[2 *PAPI_HUGE_STR_LEN]
Definition: papi_preset.c:791
static int cidx
static int attach(hwd_control_state_t *ctl, unsigned long tid)
Definition: perfctr.c:248
int model
Definition: pfmlib_amd64.c:86
amd64_rev_t revision
Definition: pfmlib_amd64.c:81
int data_type[MAX_EVENTS]
Definition: powercap_plot.c:16
char units[MAX_EVENTS][BUFSIZ]
Definition: powercap_plot.c:15
void handler(int EventSet, void *address, long long overflow_vector, void *context)
Definition: rapl_overflow.c:21
const char * name
Definition: rocs.c:225
int
Definition: sde_internal.h:89
address range specification for range restricted counting if both are zero, range is disabled
Definition: papi.h:830
get the executable's address space info
Definition: papi.h:684
A pointer to the following is passed to PAPI_get_dmem_info()
Definition: papi.h:865
get the executable's info
Definition: papi.h:696
Hardware info structure.
Definition: papi.h:774
mh for mem hierarchy maybe?
Definition: papi.h:767
A pointer to the following is passed to PAPI_set/get_opt()
Definition: papi.h:843
char * PAPI_user_defined_events_file_t
void * vptr_t