Blame src/papi.h

Packit Service a1973e
/****************************/
Packit Service a1973e
/* THIS IS OPEN SOURCE CODE */
Packit Service a1973e
/****************************/
Packit Service a1973e
Packit Service a1973e
/** 
Packit Service a1973e
* @file    papi.h
Packit Service a1973e
*
Packit Service a1973e
* @author  Philip Mucci
Packit Service a1973e
*          mucci@cs.utk.edu
Packit Service a1973e
* @author  dan terpstra
Packit Service a1973e
*          terpstra@cs.utk.edu
Packit Service a1973e
* @author  Haihang You
Packit Service a1973e
*	       you@cs.utk.edu
Packit Service a1973e
* @author  Kevin London
Packit Service a1973e
*	       london@cs.utk.edu
Packit Service a1973e
* @author  Maynard Johnson
Packit Service a1973e
*          maynardj@us.ibm.com
Packit Service a1973e
*
Packit Service a1973e
* @brief Return codes and api definitions.
Packit Service a1973e
*/
Packit Service a1973e
Packit Service a1973e
#ifndef _PAPI
Packit Service a1973e
#define _PAPI
Packit Service a1973e
Packit Service a1973e
#pragma GCC visibility push(default)
Packit Service a1973e
Packit Service a1973e
/**
Packit Service a1973e
 * @mainpage PAPI
Packit Service a1973e
 *  
Packit Service a1973e
 * @section papi_intro Introduction
Packit Service a1973e
 * The PAPI Performance Application Programming Interface provides machine and 
Packit Service a1973e
 * operating system independent access to hardware performance counters found 
Packit Service a1973e
 * on most modern processors. 
Packit Service a1973e
 * Any of over 100 preset events can be counted through either a simple high 
Packit Service a1973e
 * level programming interface or a more complete low level interface from 
Packit Service a1973e
 * either C or Fortran. 
Packit Service a1973e
 * A list of the function calls in these interfaces is given below, 
Packit Service a1973e
 * with references to other pages for more complete details. 
Packit Service a1973e
 *
Packit Service a1973e
 * @section papi_high_api High Level Functions
Packit Service a1973e
 * A simple interface for instrumenting end-user applications. 
Packit Service a1973e
 * Fully supported on both C and Fortran. 
Packit Service a1973e
 * See individual functions for details on usage.
Packit Service a1973e
 * 
Packit Service a1973e
 *	@ref high_api
Packit Service a1973e
 * 
Packit Service a1973e
 * Note that the high-level interface is self-initializing. 
Packit Service a1973e
 * You can mix high and low level calls, but you @b must call either 
Packit Service a1973e
 * @ref PAPI_library_init() or a high level routine before calling a low level routine.
Packit Service a1973e
 *
Packit Service a1973e
 * @section papi_low_api Low Level Functions
Packit Service a1973e
 * Advanced interface for all applications and performance tools.
Packit Service a1973e
 * Some functions may be implemented only for C or Fortran.
Packit Service a1973e
 * See individual functions for details on usage and support.
Packit Service a1973e
 * 
Packit Service a1973e
 * @ref low_api
Packit Service a1973e
 *
Packit Service a1973e
 * @section papi_Fortran Fortran API
Packit Service a1973e
 * The Fortran interface has some unique features and entry points.
Packit Service a1973e
 * See individual functions for details.
Packit Service a1973e
 * 
Packit Service a1973e
 * @ref PAPIF
Packit Service a1973e
 *
Packit Service a1973e
 * @section Components 
Packit Service a1973e
 *
Packit Service a1973e
 *	Components provide access to hardware information on specific subsystems.
Packit Service a1973e
 *
Packit Service a1973e
 *	Components can be found under the conponents directory or @ref papi_components "here". 
Packit Service a1973e
 *	and included in a build as an argument to configure, 
Packit Service a1973e
 *	'--with-components=< comma_seperated_list_of_components_to_build >'
Packit Service a1973e
 * 
Packit Service a1973e
 * @section papi_util PAPI Utility Commands
Packit Service a1973e
 * 
Packit Service a1973e
 *		
  • @ref papi_avail - provides availability and detail information for PAPI preset events
  • Packit Service a1973e
     *		
  • @ref papi_clockres - provides availability and detail information for PAPI preset events
  • Packit Service a1973e
     *		
  • @ref papi_cost - provides availability and detail information for PAPI preset events
  • Packit Service a1973e
     *		
  • @ref papi_command_line - executes PAPI preset or native events from the command line
  • Packit Service a1973e
     *		
  • @ref papi_decode - decodes PAPI preset events into a csv format suitable for
  • Packit Service a1973e
     *							PAPI_encode_events
    Packit Service a1973e
     *		
  • @ref papi_event_chooser - given a list of named events, lists other events
  • Packit Service a1973e
     *										that can be counted with them
    Packit Service a1973e
     *		
  • @ref papi_mem_info - provides information on the memory architecture
  • Packit Service a1973e
    									of the current processor
    Packit Service a1973e
     *		
  • @ref papi_native_avail - provides detailed information for PAPI native events
  • Packit Service a1973e
     * 
    Packit Service a1973e
     * @see The PAPI Website http://icl.cs.utk.edu/papi
    Packit Service a1973e
     */
    Packit Service a1973e
    Packit Service a1973e
    /** \htmlonly
    Packit Service a1973e
      * @page CDI PAPI Component Development Interface
    Packit Service a1973e
      * @par \em Introduction
    Packit Service a1973e
      *		PAPI-C consists of a Framework and between 1 and 16 Components. 
    Packit Service a1973e
      *		The Framework is platform independent and exposes the PAPI API to end users. 
    Packit Service a1973e
      *		The Components provide access to hardware information on specific subsystems. 
    Packit Service a1973e
      *		By convention, Component 0 is always a CPU Component. 
    Packit Service a1973e
      *		This allows default behavior for legacy code, and provides a universal 
    Packit Service a1973e
      *		place to define system-wide operations and parameters, 
    Packit Service a1973e
      *		like clock rates and interrupt structures. 
    Packit Service a1973e
      *		Currently only a single CPU Component can exist at a time. 
    Packit Service a1973e
      *
    Packit Service a1973e
      * @par No CPU
    Packit Service a1973e
      *		In certain cases it can be desirable to use a generic CPU component for 
    Packit Service a1973e
      *		testing instrumentation or for operation on systems that don't provide 
    Packit Service a1973e
      *		the proper patches for accessing cpu counters. 
    Packit Service a1973e
      *		For such a case, the configure option: 
    Packit Service a1973e
      *	@code
    Packit Service a1973e
      *		configure --with-no-cpu-counters = yes
    Packit Service a1973e
      *	@endcode 
    Packit Service a1973e
      *	is provided to build PAPI with an "empty" cpu component.
    Packit Service a1973e
      *
    Packit Service a1973e
      *	@par Exposed Interface
    Packit Service a1973e
      *		A Component for PAPI-C typically consists of a single header file and a 
    Packit Service a1973e
      *		single (or small number of) source file(s). 
    Packit Service a1973e
      *		All of the information for a Component needed by PAPI-C is exposed through 
    Packit Service a1973e
      *		a single data structure that is declared and initialized at the bottom 
    Packit Service a1973e
      *		of the main source file. 
    Packit Service a1973e
      *		This structure, @ref papi_vector_t , is defined in @ref papi_vector.h .
    Packit Service a1973e
      *	
    Packit Service a1973e
      *	@par Compiling With an Existing Component 
    Packit Service a1973e
      *		Components provided with the PAPI source distribution all appear in the 
    Packit Service a1973e
      *		src/components directory. 
    Packit Service a1973e
      *		Each component exists in its own directory, named the same as the component itself. 
    Packit Service a1973e
      *		To include a component in a PAPI build, use the configure command line as shown:
    Packit Service a1973e
      *	
    Packit Service a1973e
      *	@code
    Packit Service a1973e
      *		configure --with-components="component list"
    Packit Service a1973e
      *	@endcode
    Packit Service a1973e
      *	
    Packit Service a1973e
      * Replace the "component list" argument with either the name of a specific 
    Packit Service a1973e
      *	component directory or multiple component names separated by spaces and 
    Packit Service a1973e
      *	enclosed in quotes as shown below:
    Packit Service a1973e
      *
    Packit Service a1973e
      *	\c configure --with-components="acpi lustre infiniband"
    Packit Service a1973e
      *
    Packit Service a1973e
      *	In some cases components themselves require additional configuration. 
    Packit Service a1973e
      *	In these cases an error message will be produced when you run @code make @endcode . 
    Packit Service a1973e
      *	To fix this, run the configure script found in the component directory.
    Packit Service a1973e
      * 
    Packit Service a1973e
      *	@par Adding a New Component 
    Packit Service a1973e
      *	The mechanics of adding a new component to the PAPI 4.1 build are relatively straight-forward.
    Packit Service a1973e
      *	Add a directory to the papi/src/components directory that is named with 
    Packit Service a1973e
      *	the base name of the component. 
    Packit Service a1973e
      *	This directory will contain the source files and build files for the new component. 
    Packit Service a1973e
      *	If configuration of the component is necessary, 
    Packit Service a1973e
      *	additional configure and make files will be needed. 
    Packit Service a1973e
      *	The /example directory can be cloned and renamed as a starting point. 
    Packit Service a1973e
      *	Other components can be used as examples. 
    Packit Service a1973e
      *	This is described in more detail in /components/README.
    Packit Service a1973e
      *
    Packit Service a1973e
      *	@par Developing a New Component 
    Packit Service a1973e
      *		A PAPI-C component generally consists of a header file and one or a 
    Packit Service a1973e
      *		small number of source files. 
    Packit Service a1973e
      *		The source file must contain a @ref papi_vector_t structure that 
    Packit Service a1973e
      *		exposes the internal data and entry points of the component to the PAPI-C Framework. 
    Packit Service a1973e
      *		This structure must have a unique name that is exposed externally and 
    Packit Service a1973e
      *		contains the name of the directory containing the component source code.
    Packit Service a1973e
      *
    Packit Service a1973e
      *	Three types of information are exposed in the @ref papi_vector_t structure:
    Packit Service a1973e
      *		Configuration parameters are contained in the @ref PAPI_component_info_t structure;
    Packit Service a1973e
      *		Sizes of opaque data structures necessary for memory management are in the @ref cmp_struct_sizes_t structure;
    Packit Service a1973e
      *		An array of function entry points which, if implemented, provide access to the functionality of the component.
    Packit Service a1973e
      *
    Packit Service a1973e
      *	If a function is not implemented in a given component its value in the structure can be left unset. 
    Packit Service a1973e
      *	In this case it will be initialized to NULL, and result (generally) in benign, although unproductive, behavior.
    Packit Service a1973e
      *
    Packit Service a1973e
      *	During the development of a component, functions can be implemented and tested in blocks. 
    Packit Service a1973e
      *	Further information about an appropriate order for developing these functions 
    Packit Service a1973e
      *	can be found in the Component Development Cookbook .
    Packit Service a1973e
      *
    Packit Service a1973e
      * @par PAPI-C Open Research Issues:
    Packit Service a1973e
      *	
      Packit Service a1973e
        *	
    • Support for non-standard data types:
    • Packit Service a1973e
        *		Currently PAPI supports returned data values expressed as unsigned 64-bit integers. 
      Packit Service a1973e
        *		This is appropriate for counting events, but may not be as appropriate 
      Packit Service a1973e
        *		for expressing other values. 
      Packit Service a1973e
        *		Examples of some other possible data types are shown below. 
      Packit Service a1973e
        *		Data type might be expressed as a flag in the event definition.
      Packit Service a1973e
        *	
    • Signed Integer
    • Packit Service a1973e
        *		
        Packit Service a1973e
          *		
      • Float: 64-bit IEEE double precision
      • Packit Service a1973e
          *		
      • Fixed Point: 32-bit integer and 32-bit fraction
      • Packit Service a1973e
          *		
      • Ratios: 32 bit numerator and 32 bit denominator
      • Packit Service a1973e
          *		
        Packit Service a1973e
          *	
      • Synchronization:
      • Packit Service a1973e
          *		Components might report values with widely different time scales and 
        Packit Service a1973e
          *		remote measurements may be significantly skewed in time from local measurements. 
        Packit Service a1973e
          *		It would be desirable to have a mechanism to synchronize these values in time.
        Packit Service a1973e
          *	
      • Dynamic Component Discovery:
      • Packit Service a1973e
          *		Components currently must be included statically in the PAPI library build. 
        Packit Service a1973e
          *		This minimizes startup disruption and time lag, particularly for large parallel systems. 
        Packit Service a1973e
          *		In some instances it would also be desirable to support a run-time 
        Packit Service a1973e
          *		discovery process for components, possibly by searching a specific 
        Packit Service a1973e
          *		location for dynamic libraries.
        Packit Service a1973e
          *	
      • Component Repository:
      • Packit Service a1973e
          *		A small collection of components are currently maintained and 
        Packit Service a1973e
          *		supported inside the PAPI source distribution. 
        Packit Service a1973e
          *		It would be desirable to create a public component repository where 3rd 
        Packit Service a1973e
          *		parties could submit components for the use and benefit of the larger community.
        Packit Service a1973e
          *	
      • Multiple CPU Components:
      • Packit Service a1973e
          *		With the rise in popularity of heterogeneous computing systems, it may 
        Packit Service a1973e
          *		become desirable to have more than one CPU component. 
        Packit Service a1973e
          *		Issues must then be resolved relating to which cpu time-base is used, 
        Packit Service a1973e
          *		how are interrupts handled, etc. 
        Packit Service a1973e
          *	
        Packit Service a1973e
          * \endhtmlonly
        Packit Service a1973e
          */
        Packit Service a1973e
        Packit Service a1973e
        /* Definition of PAPI_VERSION format.  Note that each of the four 
        Packit Service a1973e
         * components _must_ be less than 256.  Also, the PAPI_VER_CURRENT
        Packit Service a1973e
         * masks out the revision and increment.  Any revision change is supposed 
        Packit Service a1973e
         * to be binary compatible between the user application code and the 
        Packit Service a1973e
         * run-time library. Any modification that breaks this compatibility 
        Packit Service a1973e
         * _should_ modify the minor version number as to force user applications 
        Packit Service a1973e
         * to re-compile.
        Packit Service a1973e
         */
        Packit Service a1973e
        #define PAPI_VERSION_NUMBER(maj,min,rev,inc) (((maj)<<24) | ((min)<<16) | ((rev)<<8) | (inc))
        Packit Service a1973e
        #define PAPI_VERSION_MAJOR(x)   	(((x)>>24)    & 0xff)
        Packit Service a1973e
        #define PAPI_VERSION_MINOR(x)		(((x)>>16)    & 0xff)
        Packit Service a1973e
        #define PAPI_VERSION_REVISION(x)	(((x)>>8)     & 0xff)
        Packit Service a1973e
        #define PAPI_VERSION_INCREMENT(x)((x)          & 0xff)
        Packit Service a1973e
        Packit Service a1973e
        /* This is the official PAPI version */
        Packit Service a1973e
        /* The final digit represents the patch count */
        Packit Service a1973e
        #define PAPI_VERSION  			PAPI_VERSION_NUMBER(5,6,0,0)
        Packit Service a1973e
        #define PAPI_VER_CURRENT 		(PAPI_VERSION & 0xffff0000)
        Packit Service a1973e
        Packit Service a1973e
          /* Tests for checking event code type */
        Packit Service a1973e
        #define IS_NATIVE( EventCode ) ( ( EventCode & PAPI_NATIVE_MASK ) && !(EventCode & PAPI_PRESET_MASK) )
        Packit Service a1973e
        #define IS_PRESET( EventCode ) ( ( EventCode & PAPI_PRESET_MASK ) && !(EventCode & PAPI_NATIVE_MASK) )
        Packit Service a1973e
        #define IS_USER_DEFINED( EventCode ) ( ( EventCode & PAPI_PRESET_MASK ) && (EventCode & PAPI_NATIVE_MASK) )
        Packit Service a1973e
        Packit Service a1973e
        #ifdef __cplusplus
        Packit Service a1973e
        extern "C"
        Packit Service a1973e
        {
        Packit Service a1973e
        #endif
        Packit Service a1973e
        Packit Service a1973e
        /* Include files */
        Packit Service a1973e
        Packit Service a1973e
        #include <sys/types.h>
        Packit Service a1973e
        #include <limits.h>
        Packit Service a1973e
        #include "papiStdEventDefs.h"
        Packit Service a1973e
        Packit Service a1973e
        /** \internal 
        Packit Service a1973e
        @defgroup ret_codes Return Codes
        Packit Service a1973e
        Return Codes
        Packit Service a1973e
        All of the functions contained in the PerfAPI return standardized error codes.
        Packit Service a1973e
        Values greater than or equal to zero indicate success, less than zero indicates
        Packit Service a1973e
        failure. 
        Packit Service a1973e
        @{
        Packit Service a1973e
        */
        Packit Service a1973e
        Packit Service a1973e
        #define PAPI_OK          0     /**< No error */
        Packit Service a1973e
        #define PAPI_EINVAL     -1     /**< Invalid argument */
        Packit Service a1973e
        #define PAPI_ENOMEM     -2     /**< Insufficient memory */
        Packit Service a1973e
        #define PAPI_ESYS       -3     /**< A System/C library call failed */
        Packit Service a1973e
        #define PAPI_ECMP       -4     /**< Not supported by component */
        Packit Service a1973e
        #define PAPI_ESBSTR     -4     /**< Backwards compatibility */
        Packit Service a1973e
        #define PAPI_ECLOST     -5     /**< Access to the counters was lost or interrupted */
        Packit Service a1973e
        #define PAPI_EBUG       -6     /**< Internal error, please send mail to the developers */
        Packit Service a1973e
        #define PAPI_ENOEVNT    -7     /**< Event does not exist */
        Packit Service a1973e
        #define PAPI_ECNFLCT    -8     /**< Event exists, but cannot be counted due to counter resource limitations */
        Packit Service a1973e
        #define PAPI_ENOTRUN    -9     /**< EventSet is currently not running */
        Packit Service a1973e
        #define PAPI_EISRUN     -10    /**< EventSet is currently counting */
        Packit Service a1973e
        #define PAPI_ENOEVST    -11    /**< No such EventSet Available */
        Packit Service a1973e
        #define PAPI_ENOTPRESET -12    /**< Event in argument is not a valid preset */
        Packit Service a1973e
        #define PAPI_ENOCNTR    -13    /**< Hardware does not support performance counters */
        Packit Service a1973e
        #define PAPI_EMISC      -14    /**< Unknown error code */
        Packit Service a1973e
        #define PAPI_EPERM      -15    /**< Permission level does not permit operation */
        Packit Service a1973e
        #define PAPI_ENOINIT    -16    /**< PAPI hasn't been initialized yet */
        Packit Service a1973e
        #define PAPI_ENOCMP     -17    /**< Component Index isn't set */
        Packit Service a1973e
        #define PAPI_ENOSUPP    -18    /**< Not supported */
        Packit Service a1973e
        #define PAPI_ENOIMPL    -19    /**< Not implemented */
        Packit Service a1973e
        #define PAPI_EBUF       -20    /**< Buffer size exceeded */
        Packit Service a1973e
        #define PAPI_EINVAL_DOM -21    /**< EventSet domain is not supported for the operation */
        Packit Service a1973e
        #define PAPI_EATTR		-22    /**< Invalid or missing event attributes */
        Packit Service a1973e
        #define PAPI_ECOUNT		-23    /**< Too many events or attributes */
        Packit Service a1973e
        #define PAPI_ECOMBO		-24    /**< Bad combination of features */
        Packit Service a1973e
        #define PAPI_NUM_ERRORS	 25    /**< Number of error messages specified in this API */
        Packit Service a1973e
        Packit Service a1973e
        #define PAPI_NOT_INITED		0
        Packit Service a1973e
        #define PAPI_LOW_LEVEL_INITED 	1       /* Low level has called library init */
        Packit Service a1973e
        #define PAPI_HIGH_LEVEL_INITED 	2       /* High level has called library init */
        Packit Service a1973e
        #define PAPI_THREAD_LEVEL_INITED 4      /* Threads have been inited */
        Packit Service a1973e
        /** @} */
        Packit Service a1973e
        Packit Service a1973e
        /** @internal 
        Packit Service a1973e
        @defgroup consts Constants
        Packit Service a1973e
        All of the functions in the PerfAPI should use the following set of constants.
        Packit Service a1973e
        @{
        Packit Service a1973e
        */
        Packit Service a1973e
        Packit Service a1973e
        #define PAPI_NULL       -1      /**
        Packit Service a1973e
        Packit Service a1973e
        /** @internal  
        Packit Service a1973e
        	@defgroup domain_defns Domain definitions 
        Packit Service a1973e
         	@{ */
        Packit Service a1973e
        Packit Service a1973e
        #define PAPI_DOM_USER    0x1    /**< User context counted */
        Packit Service a1973e
        #define PAPI_DOM_MIN     PAPI_DOM_USER
        Packit Service a1973e
        #define PAPI_DOM_KERNEL	 0x2    /**< Kernel/OS context counted */
        Packit Service a1973e
        #define PAPI_DOM_OTHER	 0x4    /**< Exception/transient mode (like user TLB misses ) */
        Packit Service a1973e
        #define PAPI_DOM_SUPERVISOR 0x8 /**< Supervisor/hypervisor context counted */
        Packit Service a1973e
        #define PAPI_DOM_ALL	 (PAPI_DOM_USER|PAPI_DOM_KERNEL|PAPI_DOM_OTHER|PAPI_DOM_SUPERVISOR) /**< All contexts counted */
        Packit Service a1973e
        /* #define PAPI_DOM_DEFAULT PAPI_DOM_USER NOW DEFINED BY COMPONENT */
        Packit Service a1973e
        #define PAPI_DOM_MAX     PAPI_DOM_ALL
        Packit Service a1973e
        #define PAPI_DOM_HWSPEC  0x80000000     /**< Flag that indicates we are not reading CPU like stuff.
        Packit Service a1973e
                                                   The lower 31 bits can be decoded by the component into something
        Packit Service a1973e
                                                   meaningful. i.e. SGI HUB counters */
        Packit Service a1973e
        /** @} */
        Packit Service a1973e
        Packit Service a1973e
        /** @internal 
        Packit Service a1973e
         *	@defgroup thread_defns Thread Definitions 
        Packit Service a1973e
         *		We define other levels in papi_internal.h
        Packit Service a1973e
         *		for internal PAPI use, so if you change anything
        Packit Service a1973e
         *		make sure to look at both places -KSL
        Packit Service a1973e
         *	@{ */
        Packit Service a1973e
        #define PAPI_USR1_TLS		0x0
        Packit Service a1973e
        #define PAPI_USR2_TLS		0x1
        Packit Service a1973e
        #define PAPI_HIGH_LEVEL_TLS     0x2
        Packit Service a1973e
        #define PAPI_NUM_TLS		0x3
        Packit Service a1973e
        #define PAPI_TLS_USR1		PAPI_USR1_TLS
        Packit Service a1973e
        #define PAPI_TLS_USR2		PAPI_USR2_TLS
        Packit Service a1973e
        #define PAPI_TLS_HIGH_LEVEL     PAPI_HIGH_LEVEL_TLS
        Packit Service a1973e
        #define PAPI_TLS_NUM		PAPI_NUM_TLS
        Packit Service a1973e
        #define PAPI_TLS_ALL_THREADS	0x10
        Packit Service a1973e
        /** @} */
        Packit Service a1973e
        Packit Service a1973e
        /** @internal 
        Packit Service a1973e
         *	@defgroup locking_defns Locking Mechanisms defines 
        Packit Service a1973e
         *	@{ */
        Packit Service a1973e
        #define PAPI_USR1_LOCK          	0x0    /**< User controlled locks */
        Packit Service a1973e
        #define PAPI_USR2_LOCK          	0x1    /**< User controlled locks */
        Packit Service a1973e
        #define PAPI_NUM_LOCK           	0x2    /**< Used with setting up array */
        Packit Service a1973e
        #define PAPI_LOCK_USR1          	PAPI_USR1_LOCK
        Packit Service a1973e
        #define PAPI_LOCK_USR2          	PAPI_USR2_LOCK
        Packit Service a1973e
        #define PAPI_LOCK_NUM			PAPI_NUM_LOCK
        Packit Service a1973e
        /** @} */
        Packit Service a1973e
        Packit Service a1973e
        /* Remove this!  If it breaks userspace we might have to add it back :( */
        Packit Service a1973e
        /* #define PAPI_MPX_DEF_DEG 32			                        */
        Packit Service a1973e
        Packit Service a1973e
        /**	@internal 
        Packit Service a1973e
        	@defgroup papi_vendors  Vendor definitions 
        Packit Service a1973e
        	@{ */
        Packit Service a1973e
        #define PAPI_VENDOR_UNKNOWN 0
        Packit Service a1973e
        #define PAPI_VENDOR_INTEL   1
        Packit Service a1973e
        #define PAPI_VENDOR_AMD     2
        Packit Service a1973e
        #define PAPI_VENDOR_IBM     3
        Packit Service a1973e
        #define PAPI_VENDOR_CRAY    4
        Packit Service a1973e
        #define PAPI_VENDOR_SUN     5
        Packit Service a1973e
        #define PAPI_VENDOR_FREESCALE 6
        Packit Service a1973e
        #define PAPI_VENDOR_ARM     7
        Packit Service a1973e
        #define PAPI_VENDOR_MIPS    8
        Packit Service a1973e
        /** @} */
        Packit Service a1973e
        Packit Service a1973e
        /** @internal 
        Packit Service a1973e
         *	@defgroup granularity_defns Granularity definitions 
        Packit Service a1973e
         *	@{ */
        Packit Service a1973e
        Packit Service a1973e
        #define PAPI_GRN_THR     0x1    /**< PAPI counters for each individual thread */
        Packit Service a1973e
        #define PAPI_GRN_MIN     PAPI_GRN_THR
        Packit Service a1973e
        #define PAPI_GRN_PROC    0x2    /**< PAPI counters for each individual process */
        Packit Service a1973e
        #define PAPI_GRN_PROCG   0x4    /**< PAPI counters for each individual process group */
        Packit Service a1973e
        #define PAPI_GRN_SYS     0x8    /**< PAPI counters for the current CPU, are you bound? */
        Packit Service a1973e
        #define PAPI_GRN_SYS_CPU 0x10   /**< PAPI counters for all CPUs individually */
        Packit Service a1973e
        #define PAPI_GRN_MAX     PAPI_GRN_SYS_CPU
        Packit Service a1973e
        /** @} */
        Packit Service a1973e
        Packit Service a1973e
        /** @internal 
        Packit Service a1973e
        	@defgroup evt_states States of an EventSet 
        Packit Service a1973e
        	@{ */
        Packit Service a1973e
        #define PAPI_STOPPED      0x01  /**< EventSet stopped */
        Packit Service a1973e
        #define PAPI_RUNNING      0x02  /**< EventSet running */
        Packit Service a1973e
        #define PAPI_PAUSED       0x04  /**< EventSet temp. disabled by the library */
        Packit Service a1973e
        #define PAPI_NOT_INIT     0x08  /**< EventSet defined, but not initialized */
        Packit Service a1973e
        #define PAPI_OVERFLOWING  0x10  /**< EventSet has overflowing enabled */
        Packit Service a1973e
        #define PAPI_PROFILING    0x20  /**< EventSet has profiling enabled */
        Packit Service a1973e
        #define PAPI_MULTIPLEXING 0x40  /**< EventSet has multiplexing enabled */
        Packit Service a1973e
        #define PAPI_ATTACHED	  0x80  /**< EventSet is attached to another thread/process */
        Packit Service a1973e
        #define PAPI_CPU_ATTACHED 0x100 /**< EventSet is attached to a specific cpu (not counting thread of execution) */
        Packit Service a1973e
        /** @} */
        Packit Service a1973e
        Packit Service a1973e
        /** @internal 
        Packit Service a1973e
        	@defgroup error_predef Error predefines 
        Packit Service a1973e
        	@{ */
        Packit Service a1973e
        #define PAPI_QUIET       0      /**< Option to turn off automatic reporting of return codes < 0 to stderr. */
        Packit Service a1973e
        #define PAPI_VERB_ECONT  1      /**< Option to automatically report any return codes < 0 to stderr and continue. */
        Packit Service a1973e
        #define PAPI_VERB_ESTOP  2      /**< Option to automatically report any return codes < 0 to stderr and exit. */
        Packit Service a1973e
        /** @} */
        Packit Service a1973e
        Packit Service a1973e
        /** @internal 
        Packit Service a1973e
        	@defgroup profile_defns Profile definitions 
        Packit Service a1973e
        	@{ */
        Packit Service a1973e
        #define PAPI_PROFIL_POSIX     0x0        /**< Default type of profiling, similar to 'man profil'. */
        Packit Service a1973e
        #define PAPI_PROFIL_RANDOM    0x1        /**< Drop a random 25% of the samples. */
        Packit Service a1973e
        #define PAPI_PROFIL_WEIGHTED  0x2        /**< Weight the samples by their value. */
        Packit Service a1973e
        #define PAPI_PROFIL_COMPRESS  0x4        /**< Ignore samples if hash buckets get big. */
        Packit Service a1973e
        #define PAPI_PROFIL_BUCKET_16 0x8        /**< Use 16 bit buckets to accumulate profile info (default) */
        Packit Service a1973e
        #define PAPI_PROFIL_BUCKET_32 0x10       /**< Use 32 bit buckets to accumulate profile info */
        Packit Service a1973e
        #define PAPI_PROFIL_BUCKET_64 0x20       /**< Use 64 bit buckets to accumulate profile info */
        Packit Service a1973e
        #define PAPI_PROFIL_FORCE_SW  0x40       /**< Force Software overflow in profiling */
        Packit Service a1973e
        #define PAPI_PROFIL_DATA_EAR  0x80       /**< Use data address register profiling */
        Packit Service a1973e
        #define PAPI_PROFIL_INST_EAR  0x100      /**< Use instruction address register profiling */
        Packit Service a1973e
        #define PAPI_PROFIL_BUCKETS   (PAPI_PROFIL_BUCKET_16 | PAPI_PROFIL_BUCKET_32 | PAPI_PROFIL_BUCKET_64)
        Packit Service a1973e
        /** @} */
        Packit Service a1973e
        Packit Service a1973e
        /* @defgroup overflow_defns Overflow definitions 
        Packit Service a1973e
           @{ */
        Packit Service a1973e
        #define PAPI_OVERFLOW_FORCE_SW 0x40	/**< Force using Software */
        Packit Service a1973e
        #define PAPI_OVERFLOW_HARDWARE 0x80	/**< Using Hardware */
        Packit Service a1973e
        /** @} */
        Packit Service a1973e
        Packit Service a1973e
        /** @internal 
        Packit Service a1973e
          *	@defgroup mpx_defns Multiplex flags definitions 
        Packit Service a1973e
          * @{ */
        Packit Service a1973e
        #define PAPI_MULTIPLEX_DEFAULT	0x0	/**< Use whatever method is available, prefer kernel of course. */
        Packit Service a1973e
        #define PAPI_MULTIPLEX_FORCE_SW 0x1	/**< Force PAPI multiplexing instead of kernel */
        Packit Service a1973e
        /** @} */
        Packit Service a1973e
        Packit Service a1973e
        /** @internal 
        Packit Service a1973e
        	@defgroup option_defns Option definitions 
        Packit Service a1973e
        	@{ */
        Packit Service a1973e
        #define PAPI_INHERIT_ALL  1     /**< The flag to this to inherit all children's counters */
        Packit Service a1973e
        #define PAPI_INHERIT_NONE 0     /**< The flag to this to inherit none of the children's counters */
        Packit Service a1973e
        Packit Service a1973e
        Packit Service a1973e
        #define PAPI_DETACH			1		/**< Detach */
        Packit Service a1973e
        #define PAPI_DEBUG          2       /**< Option to turn on  debugging features of the PAPI library */
        Packit Service a1973e
        #define PAPI_MULTIPLEX 		3       /**< Turn on/off or multiplexing for an eventset */
        Packit Service a1973e
        #define PAPI_DEFDOM  		4       /**< Domain for all new eventsets. Takes non-NULL option pointer. */
        Packit Service a1973e
        #define PAPI_DOMAIN  		5       /**< Domain for an eventset */
        Packit Service a1973e
        #define PAPI_DEFGRN  		6       /**< Granularity for all new eventsets */
        Packit Service a1973e
        #define PAPI_GRANUL  		7       /**< Granularity for an eventset */
        Packit Service a1973e
        #define PAPI_DEF_MPX_NS     8       /**< Multiplexing/overflowing interval in ns, same as PAPI_DEF_ITIMER_NS */
        Packit Service a1973e
          //#define PAPI_EDGE_DETECT    9       /**< Count cycles of events if supported [not implemented] */
        Packit Service a1973e
          //#define PAPI_INVERT         10		/**< Invert count detect if supported [not implemented] */
        Packit Service a1973e
        #define PAPI_MAX_MPX_CTRS	11      /**< Maximum number of counters we can multiplex */
        Packit Service a1973e
        #define PAPI_PROFIL  		12      /**< Option to turn on the overflow/profil reporting software [not implemented] */
        Packit Service a1973e
        #define PAPI_PRELOAD 		13      /**< Option to find out the environment variable that can preload libraries */
        Packit Service a1973e
        #define PAPI_CLOCKRATE  	14      /**< Clock rate in MHz */
        Packit Service a1973e
        #define PAPI_MAX_HWCTRS 	15      /**< Number of physical hardware counters */
        Packit Service a1973e
        #define PAPI_HWINFO  		16      /**< Hardware information */
        Packit Service a1973e
        #define PAPI_EXEINFO  		17      /**< Executable information */
        Packit Service a1973e
        #define PAPI_MAX_CPUS 		18      /**< Number of ncpus we can talk to from here */
        Packit Service a1973e
        #define PAPI_ATTACH			19      /**< Attach to a another tid/pid instead of ourself */
        Packit Service a1973e
        #define PAPI_SHLIBINFO      20      /**< Shared Library information */
        Packit Service a1973e
        #define PAPI_LIB_VERSION    21      /**< Option to find out the complete version number of the PAPI library */
        Packit Service a1973e
        #define PAPI_COMPONENTINFO  22      /**< Find out what the component supports */
        Packit Service a1973e
        /* Currently the following options are only available on Itanium; they may be supported elsewhere in the future */
        Packit Service a1973e
        #define PAPI_DATA_ADDRESS   23      /**< Option to set data address range restriction */
        Packit Service a1973e
        #define PAPI_INSTR_ADDRESS  24      /**< Option to set instruction address range restriction */
        Packit Service a1973e
        #define PAPI_DEF_ITIMER		25		/**< Option to set the type of itimer used in both software multiplexing, overflowing and profiling */
        Packit Service a1973e
        #define PAPI_DEF_ITIMER_NS	26		/**< Multiplexing/overflowing interval in ns, same as PAPI_DEF_MPX_NS */
        Packit Service a1973e
        /* Currently the following options are only available on systems using the perf_events component within papi */
        Packit Service a1973e
        #define PAPI_CPU_ATTACH		27      /**< Specify a cpu number the event set should be tied to */
        Packit Service a1973e
        #define PAPI_INHERIT		28      /**< Option to set counter inheritance flag */
        Packit Service a1973e
        #define PAPI_USER_EVENTS_FILE 29	/**< Option to set file from where to parse user defined events */
        Packit Service a1973e
        Packit Service a1973e
        #define PAPI_INIT_SLOTS    64     /*Number of initialized slots in
        Packit Service a1973e
                                           DynamicArray of EventSets */
        Packit Service a1973e
        Packit Service a1973e
        #define PAPI_MIN_STR_LEN        64      /* For small strings, like names & stuff */
        Packit Service a1973e
        #define PAPI_MAX_STR_LEN       128      /* For average run-of-the-mill strings */
        Packit Service a1973e
        #define PAPI_2MAX_STR_LEN      256      /* For somewhat longer run-of-the-mill strings */
        Packit Service a1973e
        #define PAPI_HUGE_STR_LEN     1024      /* This should be defined in terms of a system parameter */
        Packit Service a1973e
        Packit Service a1973e
        #define PAPI_PMU_MAX           40      /* maximum number of pmu's supported by one component */
        Packit Service a1973e
        #define PAPI_DERIVED           0x1      /* Flag to indicate that the event is derived */
        Packit Service a1973e
        /** @} */
        Packit Service a1973e
        Packit Service a1973e
        /** Possible values for the 'modifier' parameter of the PAPI_enum_event call.
        Packit Service a1973e
           A value of 0 (PAPI_ENUM_EVENTS) is always assumed to enumerate ALL 
        Packit Service a1973e
           events on every platform.
        Packit Service a1973e
           PAPI PRESET events are broken into related event categories.
        Packit Service a1973e
           Each supported component can have optional values to determine how 
        Packit Service a1973e
           native events on that component are enumerated.
        Packit Service a1973e
        */
        Packit Service a1973e
        enum {
        Packit Service a1973e
           PAPI_ENUM_EVENTS = 0,		/**< Always enumerate all events */
        Packit Service a1973e
           PAPI_ENUM_FIRST,				/**< Enumerate first event (preset or native) */
        Packit Service a1973e
           PAPI_PRESET_ENUM_AVAIL, 		/**< Enumerate events that exist here */
        Packit Service a1973e
        Packit Service a1973e
           /* PAPI PRESET section */
        Packit Service a1973e
           PAPI_PRESET_ENUM_MSC,		/**< Miscellaneous preset events */
        Packit Service a1973e
           PAPI_PRESET_ENUM_INS,		/**< Instruction related preset events */
        Packit Service a1973e
           PAPI_PRESET_ENUM_IDL,		/**< Stalled or Idle preset events */
        Packit Service a1973e
           PAPI_PRESET_ENUM_BR,			/**< Branch related preset events */
        Packit Service a1973e
           PAPI_PRESET_ENUM_CND,		/**< Conditional preset events */
        Packit Service a1973e
           PAPI_PRESET_ENUM_MEM,		/**< Memory related preset events */
        Packit Service a1973e
           PAPI_PRESET_ENUM_CACH,		/**< Cache related preset events */
        Packit Service a1973e
           PAPI_PRESET_ENUM_L1,			/**< L1 cache related preset events */
        Packit Service a1973e
           PAPI_PRESET_ENUM_L2,			/**< L2 cache related preset events */
        Packit Service a1973e
           PAPI_PRESET_ENUM_L3,			/**< L3 cache related preset events */
        Packit Service a1973e
           PAPI_PRESET_ENUM_TLB,		/**< Translation Lookaside Buffer events */
        Packit Service a1973e
           PAPI_PRESET_ENUM_FP,			/**< Floating Point related preset events */
        Packit Service a1973e
        Packit Service a1973e
           /* PAPI native event related section */
        Packit Service a1973e
           PAPI_NTV_ENUM_UMASKS,		/**< all individual bits for given group */
        Packit Service a1973e
           PAPI_NTV_ENUM_UMASK_COMBOS,	/**< all combinations of mask bits for given group */
        Packit Service a1973e
           PAPI_NTV_ENUM_IARR,			/**< Enumerate events that support IAR (instruction address ranging) */
        Packit Service a1973e
           PAPI_NTV_ENUM_DARR,			/**< Enumerate events that support DAR (data address ranging) */
        Packit Service a1973e
           PAPI_NTV_ENUM_OPCM,			/**< Enumerate events that support OPC (opcode matching) */
        Packit Service a1973e
           PAPI_NTV_ENUM_IEAR,			/**< Enumerate IEAR (instruction event address register) events */
        Packit Service a1973e
           PAPI_NTV_ENUM_DEAR,			/**< Enumerate DEAR (data event address register) events */
        Packit Service a1973e
           PAPI_NTV_ENUM_GROUPS			/**< Enumerate groups an event belongs to (e.g. POWER5) */
        Packit Service a1973e
        };
        Packit Service a1973e
        Packit Service a1973e
        #define PAPI_ENUM_ALL PAPI_ENUM_EVENTS
        Packit Service a1973e
        Packit Service a1973e
        #define PAPI_PRESET_BIT_MSC		(1 << PAPI_PRESET_ENUM_MSC)	/* Miscellaneous preset event bit */
        Packit Service a1973e
        #define PAPI_PRESET_BIT_INS		(1 << PAPI_PRESET_ENUM_INS)	/* Instruction related preset event bit */
        Packit Service a1973e
        #define PAPI_PRESET_BIT_IDL		(1 << PAPI_PRESET_ENUM_IDL)	/* Stalled or Idle preset event bit */
        Packit Service a1973e
        #define PAPI_PRESET_BIT_BR		(1 << PAPI_PRESET_ENUM_BR)	/* branch related preset events */
        Packit Service a1973e
        #define PAPI_PRESET_BIT_CND		(1 << PAPI_PRESET_ENUM_CND)	/* conditional preset events */
        Packit Service a1973e
        #define PAPI_PRESET_BIT_MEM		(1 << PAPI_PRESET_ENUM_MEM)	/* memory related preset events */
        Packit Service a1973e
        #define PAPI_PRESET_BIT_CACH	(1 << PAPI_PRESET_ENUM_CACH)	/* cache related preset events */
        Packit Service a1973e
        #define PAPI_PRESET_BIT_L1		(1 << PAPI_PRESET_ENUM_L1)	/* L1 cache related preset events */
        Packit Service a1973e
        #define PAPI_PRESET_BIT_L2		(1 << PAPI_PRESET_ENUM_L2)	/* L2 cache related preset events */
        Packit Service a1973e
        #define PAPI_PRESET_BIT_L3		(1 << PAPI_PRESET_ENUM_L3)	/* L3 cache related preset events */
        Packit Service a1973e
        #define PAPI_PRESET_BIT_TLB		(1 << PAPI_PRESET_ENUM_TLB)	/* Translation Lookaside Buffer events */
        Packit Service a1973e
        #define PAPI_PRESET_BIT_FP		(1 << PAPI_PRESET_ENUM_FP)	/* Floating Point related preset events */
        Packit Service a1973e
        Packit Service a1973e
        #define PAPI_NTV_GROUP_AND_MASK		0x00FF0000	/* bits occupied by group number */
        Packit Service a1973e
        #define PAPI_NTV_GROUP_SHIFT		16			/* bit shift to encode group number */
        Packit Service a1973e
        /** @} */
        Packit Service a1973e
        Packit Service a1973e
        /* 
        Packit Service a1973e
        The Low Level API
        Packit Service a1973e
        Packit Service a1973e
        The following functions represent the low level portion of the
        Packit Service a1973e
        PerfAPI. These functions provide greatly increased efficiency and
        Packit Service a1973e
        functionality over the high level API presented in the next
        Packit Service a1973e
        section. All of the following functions are callable from both C and
        Packit Service a1973e
        Fortran except where noted. As mentioned in the introduction, the low
        Packit Service a1973e
        level API is only as powerful as the component upon which it is
        Packit Service a1973e
        built. Thus some features may not be available on every platform. The
        Packit Service a1973e
        converse may also be true, that more advanced features may be
        Packit Service a1973e
        available and defined in the header file.  The user is encouraged to
        Packit Service a1973e
        read the documentation carefully.  */
        Packit Service a1973e
        Packit Service a1973e
        Packit Service a1973e
        #include <signal.h>
        Packit Service a1973e
        Packit Service a1973e
        /*  Earlier versions of PAPI define a special long_long type to mask
        Packit Service a1973e
        	an incompatibility between the Windows compiler and gcc-style compilers.
        Packit Service a1973e
        	That problem no longer exists, so long_long has been purged from the source.
        Packit Service a1973e
        	The defines below preserve backward compatibility. Their use is deprecated,
        Packit Service a1973e
        	but will continue to be supported in the near term.
        Packit Service a1973e
        */
        Packit Service a1973e
        #define long_long long long
        Packit Service a1973e
        #define u_long_long unsigned long long
        Packit Service a1973e
        Packit Service a1973e
        /** @defgroup papi_data_structures PAPI Data Structures */
        Packit Service a1973e
        Packit Service a1973e
        	typedef unsigned long PAPI_thread_id_t;
        Packit Service a1973e
        Packit Service a1973e
        	/** @ingroup papi_data_structures */
        Packit Service a1973e
        	typedef struct _papi_all_thr_spec {
        Packit Service a1973e
             int num;
        Packit Service a1973e
             PAPI_thread_id_t *id;
        Packit Service a1973e
             void **data;
        Packit Service a1973e
           } PAPI_all_thr_spec_t;
        Packit Service a1973e
        Packit Service a1973e
          typedef void (*PAPI_overflow_handler_t) (int EventSet, void *address,
        Packit Service a1973e
                                        long long overflow_vector, void *context);
        Packit Service a1973e
        Packit Service a1973e
                /* Handle C99 and more recent compilation */
        Packit Service a1973e
        	/* caddr_t was never approved by POSIX and is obsolete */
        Packit Service a1973e
        	/* We should probably switch all caddr_t to void * or long */
        Packit Service a1973e
        #ifdef __STDC_VERSION__
        Packit Service a1973e
          #if (__STDC_VERSION__ >= 199901L)
        Packit Service a1973e
        	typedef char *caddr_t;
        Packit Service a1973e
          #else
        Packit Service a1973e
        Packit Service a1973e
          #endif
        Packit Service a1973e
        #endif
        Packit Service a1973e
        Packit Service a1973e
        	/** @ingroup papi_data_structures */
        Packit Service a1973e
           typedef struct _papi_sprofil {
        Packit Service a1973e
              void *pr_base;          /**< buffer base */
        Packit Service a1973e
              unsigned pr_size;       /**< buffer size */
        Packit Service a1973e
              caddr_t pr_off;         /**< pc start address (offset) */
        Packit Service a1973e
              unsigned pr_scale;      /**< pc scaling factor: 
        Packit Service a1973e
                                         fixed point fraction
        Packit Service a1973e
                                         0xffff ~= 1, 0x8000 == .5, 0x4000 == .25, etc.
        Packit Service a1973e
                                         also, two extensions 0x1000 == 1, 0x2000 == 2 */
        Packit Service a1973e
           } PAPI_sprofil_t;
        Packit Service a1973e
        Packit Service a1973e
        /** @ingroup papi_data_structures */
        Packit Service a1973e
           typedef struct _papi_itimer_option {
        Packit Service a1973e
             int itimer_num;
        Packit Service a1973e
             int itimer_sig;
        Packit Service a1973e
             int ns;
        Packit Service a1973e
             int flags;
        Packit Service a1973e
           } PAPI_itimer_option_t;
        Packit Service a1973e
        Packit Service a1973e
        /** @ingroup papi_data_structures */
        Packit Service a1973e
           typedef struct _papi_inherit_option {
        Packit Service a1973e
              int eventset;
        Packit Service a1973e
              int inherit;
        Packit Service a1973e
           } PAPI_inherit_option_t;
        Packit Service a1973e
        Packit Service a1973e
        /** @ingroup papi_data_structures */
        Packit Service a1973e
           typedef struct _papi_domain_option {
        Packit Service a1973e
              int def_cidx; /**< this structure requires a component index to set default domains */
        Packit Service a1973e
              int eventset;
        Packit Service a1973e
              int domain;
        Packit Service a1973e
           } PAPI_domain_option_t;
        Packit Service a1973e
        Packit Service a1973e
        /**  @ingroup papi_data_structures*/
        Packit Service a1973e
           typedef struct _papi_granularity_option {
        Packit Service a1973e
              int def_cidx; /**< this structure requires a component index to set default granularity */
        Packit Service a1973e
              int eventset;
        Packit Service a1973e
              int granularity;
        Packit Service a1973e
           } PAPI_granularity_option_t;
        Packit Service a1973e
        Packit Service a1973e
        /** @ingroup papi_data_structures */
        Packit Service a1973e
           typedef struct _papi_preload_option {
        Packit Service a1973e
              char lib_preload_env[PAPI_MAX_STR_LEN];   
        Packit Service a1973e
              char lib_preload_sep;
        Packit Service a1973e
              char lib_dir_env[PAPI_MAX_STR_LEN];
        Packit Service a1973e
              char lib_dir_sep;
        Packit Service a1973e
           } PAPI_preload_info_t;
        Packit Service a1973e
        Packit Service a1973e
        /** @ingroup papi_data_structures */
        Packit Service a1973e
           typedef struct _papi_component_option {
        Packit Service a1973e
             char name[PAPI_MAX_STR_LEN];            /**< Name of the component we're using */
        Packit Service a1973e
             char short_name[PAPI_MIN_STR_LEN];      /**< Short name of component,
        Packit Service a1973e
        						to be prepended to event names */
        Packit Service a1973e
             char description[PAPI_MAX_STR_LEN];     /**< Description of the component */
        Packit Service a1973e
             char version[PAPI_MIN_STR_LEN];         /**< Version of this component */
        Packit Service a1973e
             char support_version[PAPI_MIN_STR_LEN]; /**< Version of the support library */
        Packit Service a1973e
             char kernel_version[PAPI_MIN_STR_LEN];  /**< Version of the kernel PMC support driver */
        Packit Service a1973e
             char disabled_reason[PAPI_MAX_STR_LEN]; /**< Reason for failure of initialization */
        Packit Service a1973e
             int disabled;   /**< 0 if enabled, otherwise error code from initialization */
        Packit Service a1973e
             int CmpIdx;				/**< Index into the vector array for this component; set at init time */
        Packit Service a1973e
             int num_cntrs;               /**< Number of hardware counters the component supports */
        Packit Service a1973e
             int num_mpx_cntrs;           /**< Number of hardware counters the component or PAPI can multiplex supports */
        Packit Service a1973e
             int num_preset_events;       /**< Number of preset events the component supports */
        Packit Service a1973e
             int num_native_events;       /**< Number of native events the component supports */
        Packit Service a1973e
             int default_domain;          /**< The default domain when this component is used */
        Packit Service a1973e
             int available_domains;       /**< Available domains */ 
        Packit Service a1973e
             int default_granularity;     /**< The default granularity when this component is used */
        Packit Service a1973e
             int available_granularities; /**< Available granularities */
        Packit Service a1973e
             int hardware_intr_sig;       /**< Signal used by hardware to deliver PMC events */
        Packit Service a1973e
        //   int opcode_match_width;      /**< Width of opcode matcher if exists, 0 if not */
        Packit Service a1973e
             int component_type;          /**< Type of component */
        Packit Service a1973e
             char *pmu_names[PAPI_PMU_MAX];         /**< list of pmu names supported by this component */
        Packit Service a1973e
             int reserved[8];             /* */
        Packit Service a1973e
             unsigned int hardware_intr:1;         /**< hw overflow intr, does not need to be emulated in software*/
        Packit Service a1973e
             unsigned int precise_intr:1;          /**< Performance interrupts happen precisely */
        Packit Service a1973e
             unsigned int posix1b_timers:1;        /**< Using POSIX 1b interval timers (timer_create) instead of setitimer */
        Packit Service a1973e
             unsigned int kernel_profile:1;        /**< Has kernel profiling support (buffered interrupts or sprofil-like) */
        Packit Service a1973e
             unsigned int kernel_multiplex:1;      /**< In kernel multiplexing */
        Packit Service a1973e
        //   unsigned int data_address_range:1;    /**< Supports data address range limiting */
        Packit Service a1973e
        //   unsigned int instr_address_range:1;   /**< Supports instruction address range limiting */
        Packit Service a1973e
             unsigned int fast_counter_read:1;     /**< Supports a user level PMC read instruction */
        Packit Service a1973e
             unsigned int fast_real_timer:1;       /**< Supports a fast real timer */
        Packit Service a1973e
             unsigned int fast_virtual_timer:1;    /**< Supports a fast virtual timer */
        Packit Service a1973e
             unsigned int attach:1;                /**< Supports attach */
        Packit Service a1973e
             unsigned int attach_must_ptrace:1;	   /**< Attach must first ptrace and stop the thread/process*/
        Packit Service a1973e
        //   unsigned int edge_detect:1;           /**< Supports edge detection on events */
        Packit Service a1973e
        //   unsigned int invert:1;                /**< Supports invert detection on events */
        Packit Service a1973e
        //   unsigned int profile_ear:1;      	   /**< Supports data/instr/tlb miss address sampling */
        Packit Service a1973e
        //     unsigned int cntr_groups:1;           /**< Underlying hardware uses counter groups (e.g. POWER5)*/
        Packit Service a1973e
             unsigned int cntr_umasks:1;           /**< counters have unit masks */
        Packit Service a1973e
        //   unsigned int cntr_IEAR_events:1;      /**< counters support instr event addr register */
        Packit Service a1973e
        //   unsigned int cntr_DEAR_events:1;      /**< counters support data event addr register */
        Packit Service a1973e
        //   unsigned int cntr_OPCM_events:1;      /**< counter events support opcode matching */
        Packit Service a1973e
             /* This should be a granularity option */
        Packit Service a1973e
             unsigned int cpu:1;                   /**< Supports specifying cpu number to use with event set */
        Packit Service a1973e
             unsigned int inherit:1;               /**< Supports child processes inheriting parents counters */
        Packit Service a1973e
             unsigned int reserved_bits:12;
        Packit Service a1973e
           } PAPI_component_info_t;
        Packit Service a1973e
        Packit Service a1973e
        /**  @ingroup papi_data_structures*/
        Packit Service a1973e
           typedef struct _papi_mpx_info {
        Packit Service a1973e
             int timer_sig;				/**< Signal number used by the multiplex timer, 0 if not: PAPI_SIGNAL */
        Packit Service a1973e
             int timer_num;				/**< Number of the itimer or POSIX 1 timer used by the multiplex timer: PAPI_ITIMER */
        Packit Service a1973e
             int timer_us;				/**< uS between switching of sets: PAPI_MPX_DEF_US */
        Packit Service a1973e
           } PAPI_mpx_info_t;
        Packit Service a1973e
        Packit Service a1973e
           typedef int (*PAPI_debug_handler_t) (int code);
        Packit Service a1973e
        Packit Service a1973e
           /** @ingroup papi_data_structures */
        Packit Service a1973e
           typedef struct _papi_debug_option {
        Packit Service a1973e
              int level;
        Packit Service a1973e
              PAPI_debug_handler_t handler;
        Packit Service a1973e
           } PAPI_debug_option_t;
        Packit Service a1973e
        Packit Service a1973e
        /** @ingroup papi_data_structures
        Packit Service a1973e
        	@brief get the executable's address space info */
        Packit Service a1973e
           typedef struct _papi_address_map {
        Packit Service a1973e
              char name[PAPI_HUGE_STR_LEN];
        Packit Service a1973e
              caddr_t text_start;       /**< Start address of program text segment */
        Packit Service a1973e
              caddr_t text_end;         /**< End address of program text segment */
        Packit Service a1973e
              caddr_t data_start;       /**< Start address of program data segment */
        Packit Service a1973e
              caddr_t data_end;         /**< End address of program data segment */
        Packit Service a1973e
              caddr_t bss_start;        /**< Start address of program bss segment */
        Packit Service a1973e
              caddr_t bss_end;          /**< End address of program bss segment */
        Packit Service a1973e
           } PAPI_address_map_t;
        Packit Service a1973e
        Packit Service a1973e
        /** @ingroup papi_data_structures
        Packit Service a1973e
        	@brief get the executable's info */
        Packit Service a1973e
           typedef struct _papi_program_info {
        Packit Service a1973e
              char fullname[PAPI_HUGE_STR_LEN];  /**< path + name */
        Packit Service a1973e
              PAPI_address_map_t address_info;	 /**< executable's address space info */
        Packit Service a1973e
           } PAPI_exe_info_t;
        Packit Service a1973e
        Packit Service a1973e
           /** @ingroup papi_data_structures */
        Packit Service a1973e
           typedef struct _papi_shared_lib_info {
        Packit Service a1973e
              PAPI_address_map_t *map;
        Packit Service a1973e
              int count;
        Packit Service a1973e
           } PAPI_shlib_info_t;
        Packit Service a1973e
        Packit Service a1973e
        /** Specify the file containing user defined events. */
        Packit Service a1973e
        typedef char* PAPI_user_defined_events_file_t;
        Packit Service a1973e
        Packit Service a1973e
           /* The following defines and next for structures define the memory heirarchy */
        Packit Service a1973e
           /* All sizes are in BYTES */
        Packit Service a1973e
           /* Associativity:
        Packit Service a1973e
        		0: Undefined;
        Packit Service a1973e
        		1: Direct Mapped
        Packit Service a1973e
        		SHRT_MAX: Full
        Packit Service a1973e
        		Other values == associativity
        Packit Service a1973e
           */
        Packit Service a1973e
        #define PAPI_MH_TYPE_EMPTY    0x0
        Packit Service a1973e
        #define PAPI_MH_TYPE_INST     0x1
        Packit Service a1973e
        #define PAPI_MH_TYPE_DATA     0x2
        Packit Service a1973e
        #define PAPI_MH_TYPE_VECTOR   0x4
        Packit Service a1973e
        #define PAPI_MH_TYPE_TRACE    0x8
        Packit Service a1973e
        #define PAPI_MH_TYPE_UNIFIED  (PAPI_MH_TYPE_INST|PAPI_MH_TYPE_DATA)
        Packit Service a1973e
        #define PAPI_MH_CACHE_TYPE(a) (a & 0xf)
        Packit Service a1973e
        #define PAPI_MH_TYPE_WT       0x00	   /* write-through cache */
        Packit Service a1973e
        #define PAPI_MH_TYPE_WB       0x10	   /* write-back cache */
        Packit Service a1973e
        #define PAPI_MH_CACHE_WRITE_POLICY(a) (a & 0xf0)
        Packit Service a1973e
        #define PAPI_MH_TYPE_UNKNOWN  0x000
        Packit Service a1973e
        #define PAPI_MH_TYPE_LRU      0x100
        Packit Service a1973e
        #define PAPI_MH_TYPE_PSEUDO_LRU 0x200
        Packit Service a1973e
        #define PAPI_MH_CACHE_REPLACEMENT_POLICY(a) (a & 0xf00)
        Packit Service a1973e
        #define PAPI_MH_TYPE_TLB       0x1000  /* tlb, not memory cache */
        Packit Service a1973e
        #define PAPI_MH_TYPE_PREF      0x2000  /* prefetch buffer */
        Packit Service a1973e
        #define PAPI_MH_MAX_LEVELS    6		   /* # descriptors for each TLB or cache level */
        Packit Service a1973e
        #define PAPI_MAX_MEM_HIERARCHY_LEVELS 	  4
        Packit Service a1973e
        Packit Service a1973e
        /** @ingroup papi_data_structures */
        Packit Service a1973e
           typedef struct _papi_mh_tlb_info {
        Packit Service a1973e
              int type; /**< Empty, instr, data, vector, unified */
        Packit Service a1973e
              int num_entries;
        Packit Service a1973e
              int page_size;
        Packit Service a1973e
              int associativity;
        Packit Service a1973e
           } PAPI_mh_tlb_info_t;
        Packit Service a1973e
        Packit Service a1973e
        /** @ingroup papi_data_structures */
        Packit Service a1973e
           typedef struct _papi_mh_cache_info {
        Packit Service a1973e
              int type; /**< Empty, instr, data, vector, trace, unified */
        Packit Service a1973e
              int size;
        Packit Service a1973e
              int line_size;
        Packit Service a1973e
              int num_lines;
        Packit Service a1973e
              int associativity;
        Packit Service a1973e
           } PAPI_mh_cache_info_t;
        Packit Service a1973e
        Packit Service a1973e
        /** @ingroup papi_data_structures */
        Packit Service a1973e
           typedef struct _papi_mh_level_info {
        Packit Service a1973e
              PAPI_mh_tlb_info_t   tlb[PAPI_MH_MAX_LEVELS];
        Packit Service a1973e
              PAPI_mh_cache_info_t cache[PAPI_MH_MAX_LEVELS];
        Packit Service a1973e
           } PAPI_mh_level_t;
        Packit Service a1973e
        Packit Service a1973e
        /**  @ingroup papi_data_structures
        Packit Service a1973e
          *	 @brief mh for mem hierarchy maybe? */
        Packit Service a1973e
           typedef struct _papi_mh_info { 
        Packit Service a1973e
              int levels;
        Packit Service a1973e
              PAPI_mh_level_t level[PAPI_MAX_MEM_HIERARCHY_LEVELS];
        Packit Service a1973e
           } PAPI_mh_info_t;
        Packit Service a1973e
        Packit Service a1973e
        /**  @ingroup papi_data_structures
        Packit Service a1973e
          *  @brief Hardware info structure */
        Packit Service a1973e
           typedef struct _papi_hw_info {
        Packit Service a1973e
              int ncpu;                     /**< Number of CPUs per NUMA Node */
        Packit Service a1973e
              int threads;                  /**< Number of hdw threads per core */
        Packit Service a1973e
              int cores;                    /**< Number of cores per socket */
        Packit Service a1973e
              int sockets;                  /**< Number of sockets */
        Packit Service a1973e
              int nnodes;                   /**< Total Number of NUMA Nodes */
        Packit Service a1973e
              int totalcpus;                /**< Total number of CPUs in the entire system */
        Packit Service a1973e
              int vendor;                   /**< Vendor number of CPU */
        Packit Service a1973e
              char vendor_string[PAPI_MAX_STR_LEN];     /**< Vendor string of CPU */
        Packit Service a1973e
              int model;                    /**< Model number of CPU */
        Packit Service a1973e
              char model_string[PAPI_MAX_STR_LEN];      /**< Model string of CPU */
        Packit Service a1973e
              float revision;               /**< Revision of CPU */
        Packit Service a1973e
              int cpuid_family;             /**< cpuid family */
        Packit Service a1973e
              int cpuid_model;              /**< cpuid model */
        Packit Service a1973e
              int cpuid_stepping;           /**< cpuid stepping */
        Packit Service a1973e
        Packit Service a1973e
              int cpu_max_mhz;              /**< Maximum supported CPU speed */
        Packit Service a1973e
              int cpu_min_mhz;              /**< Minimum supported CPU speed */
        Packit Service a1973e
        Packit Service a1973e
              PAPI_mh_info_t mem_hierarchy; /**< PAPI memory heirarchy description */
        Packit Service a1973e
              int virtualized;              /**< Running in virtual machine */
        Packit Service a1973e
              char virtual_vendor_string[PAPI_MAX_STR_LEN]; 
        Packit Service a1973e
                                            /**< Vendor for virtual machine */
        Packit Service a1973e
              char virtual_vendor_version[PAPI_MAX_STR_LEN];
        Packit Service a1973e
                                            /**< Version of virtual machine */
        Packit Service a1973e
        Packit Service a1973e
              /* Legacy Values, do not use */
        Packit Service a1973e
              float mhz;                    /**< Deprecated */
        Packit Service a1973e
              int clock_mhz;                /**< Deprecated */
        Packit Service a1973e
        Packit Service a1973e
              /* For future expansion */
        Packit Service a1973e
              int reserved[8];
        Packit Service a1973e
        Packit Service a1973e
           } PAPI_hw_info_t;
        Packit Service a1973e
        Packit Service a1973e
        /** @ingroup papi_data_structures */
        Packit Service a1973e
           typedef struct _papi_attach_option {
        Packit Service a1973e
              int eventset;
        Packit Service a1973e
              unsigned long tid;
        Packit Service a1973e
           } PAPI_attach_option_t;
        Packit Service a1973e
        Packit Service a1973e
        /**  @ingroup papi_data_structures*/
        Packit Service a1973e
              typedef struct _papi_cpu_option {
        Packit Service a1973e
                 int eventset;
        Packit Service a1973e
                 unsigned int cpu_num;
        Packit Service a1973e
              } PAPI_cpu_option_t;
        Packit Service a1973e
        Packit Service a1973e
        /** @ingroup papi_data_structures */
        Packit Service a1973e
           typedef struct _papi_multiplex_option {
        Packit Service a1973e
              int eventset;
        Packit Service a1973e
              int ns;
        Packit Service a1973e
              int flags;
        Packit Service a1973e
           } PAPI_multiplex_option_t;
        Packit Service a1973e
        Packit Service a1973e
           /** @ingroup papi_data_structures 
        Packit Service a1973e
        	 *  @brief address range specification for range restricted counting if both are zero, range is disabled  */
        Packit Service a1973e
           typedef struct _papi_addr_range_option { 
        Packit Service a1973e
              int eventset;           /**< eventset to restrict */
        Packit Service a1973e
              caddr_t start;          /**< user requested start address of an address range */
        Packit Service a1973e
              caddr_t end;            /**< user requested end address of an address range */
        Packit Service a1973e
              int start_off;          /**< hardware specified offset from start address */
        Packit Service a1973e
              int end_off;            /**< hardware specified offset from end address */
        Packit Service a1973e
           } PAPI_addr_range_option_t;
        Packit Service a1973e
        Packit Service a1973e
        /** @ingroup papi_data_structures 
        Packit Service a1973e
          *	@union PAPI_option_t
        Packit Service a1973e
          *	@brief A pointer to the following is passed to PAPI_set/get_opt() */
        Packit Service a1973e
        Packit Service a1973e
        	typedef union
        Packit Service a1973e
        	{
        Packit Service a1973e
        		PAPI_preload_info_t preload;
        Packit Service a1973e
        		PAPI_debug_option_t debug;
        Packit Service a1973e
        		PAPI_inherit_option_t inherit;
        Packit Service a1973e
        		PAPI_granularity_option_t granularity;
        Packit Service a1973e
        		PAPI_granularity_option_t defgranularity;
        Packit Service a1973e
        		PAPI_domain_option_t domain;
        Packit Service a1973e
        		PAPI_domain_option_t defdomain;
        Packit Service a1973e
        		PAPI_attach_option_t attach;
        Packit Service a1973e
        		PAPI_cpu_option_t cpu;
        Packit Service a1973e
        		PAPI_multiplex_option_t multiplex;
        Packit Service a1973e
        		PAPI_itimer_option_t itimer;
        Packit Service a1973e
        		PAPI_hw_info_t *hw_info;
        Packit Service a1973e
        		PAPI_shlib_info_t *shlib_info;
        Packit Service a1973e
        		PAPI_exe_info_t *exe_info;
        Packit Service a1973e
        		PAPI_component_info_t *cmp_info;
        Packit Service a1973e
        		PAPI_addr_range_option_t addr;
        Packit Service a1973e
        		PAPI_user_defined_events_file_t events_file;
        Packit Service a1973e
        	} PAPI_option_t;
        Packit Service a1973e
        Packit Service a1973e
        /** @ingroup papi_data_structures
        Packit Service a1973e
          *	@brief A pointer to the following is passed to PAPI_get_dmem_info() */
        Packit Service a1973e
        	typedef struct _dmem_t {
        Packit Service a1973e
        	  long long peak;
        Packit Service a1973e
        	  long long size;
        Packit Service a1973e
        	  long long resident;
        Packit Service a1973e
        	  long long high_water_mark;
        Packit Service a1973e
        	  long long shared;
        Packit Service a1973e
        	  long long text;
        Packit Service a1973e
        	  long long library;
        Packit Service a1973e
        	  long long heap;
        Packit Service a1973e
        	  long long locked;
        Packit Service a1973e
        	  long long stack;
        Packit Service a1973e
        	  long long pagesize;
        Packit Service a1973e
        	  long long pte;
        Packit Service a1973e
        	} PAPI_dmem_info_t;
        Packit Service a1973e
        Packit Service a1973e
        /* Fortran offsets into PAPI_dmem_info_t structure. */
        Packit Service a1973e
        Packit Service a1973e
        #define PAPIF_DMEM_VMPEAK     1
        Packit Service a1973e
        #define PAPIF_DMEM_VMSIZE     2
        Packit Service a1973e
        #define PAPIF_DMEM_RESIDENT   3
        Packit Service a1973e
        #define PAPIF_DMEM_HIGH_WATER 4
        Packit Service a1973e
        #define PAPIF_DMEM_SHARED     5
        Packit Service a1973e
        #define PAPIF_DMEM_TEXT       6
        Packit Service a1973e
        #define PAPIF_DMEM_LIBRARY    7
        Packit Service a1973e
        #define PAPIF_DMEM_HEAP       8
        Packit Service a1973e
        #define PAPIF_DMEM_LOCKED     9
        Packit Service a1973e
        #define PAPIF_DMEM_STACK      10
        Packit Service a1973e
        #define PAPIF_DMEM_PAGESIZE   11
        Packit Service a1973e
        #define PAPIF_DMEM_PTE        12
        Packit Service a1973e
        #define PAPIF_DMEM_MAXVAL     12
        Packit Service a1973e
        Packit Service a1973e
        #define PAPI_MAX_INFO_TERMS  12		   /* should match PAPI_EVENTS_IN_DERIVED_EVENT defined in papi_internal.h */
        Packit Service a1973e
        Packit Service a1973e
        Packit Service a1973e
        /** @ingroup papi_data_structures 
        Packit Service a1973e
          *	@brief This structure is the event information that is exposed to the user through the API.
        Packit Service a1973e
        Packit Service a1973e
           The same structure is used to describe both preset and native events.
        Packit Service a1973e
           WARNING: This structure is very large. With current definitions, it is about 2660 bytes.
        Packit Service a1973e
           Unlike previous versions of PAPI, which allocated an array of these structures within
        Packit Service a1973e
           the library, this structure is carved from user space. It does not exist inside the library,
        Packit Service a1973e
           and only one copy need ever exist.
        Packit Service a1973e
           The basic philosophy is this:
        Packit Service a1973e
           - each preset consists of a code, some descriptors, and an array of native events;
        Packit Service a1973e
           - each native event consists of a code, and an array of register values;
        Packit Service a1973e
           - fields are shared between preset and native events, and unused where not applicable;
        Packit Service a1973e
           - To completely describe a preset event, the code must present all available
        Packit Service a1973e
              information for that preset, and then walk the list of native events, retrieving
        Packit Service a1973e
              and presenting information for each native event in turn.
        Packit Service a1973e
           The various fields and their usage is discussed below.
        Packit Service a1973e
        */
        Packit Service a1973e
        Packit Service a1973e
        Packit Service a1973e
        /** Enum values for event_info location field */
        Packit Service a1973e
        enum {
        Packit Service a1973e
           PAPI_LOCATION_CORE = 0,			/**< Measures local to core      */
        Packit Service a1973e
           PAPI_LOCATION_CPU,				/**< Measures local to CPU (HT?) */
        Packit Service a1973e
           PAPI_LOCATION_PACKAGE,			/**< Measures local to package   */
        Packit Service a1973e
           PAPI_LOCATION_UNCORE,			/**< Measures uncore             */
        Packit Service a1973e
        };
        Packit Service a1973e
        Packit Service a1973e
        /** Enum values for event_info data_type field */
        Packit Service a1973e
        enum {
        Packit Service a1973e
           PAPI_DATATYPE_INT64 = 0,			/**< Default: Data is a signed 64-bit int   */
        Packit Service a1973e
           PAPI_DATATYPE_UINT64,			/**< Data is a unsigned 64-bit int */
        Packit Service a1973e
           PAPI_DATATYPE_FP64,				/**< Data is 64-bit floating point */
        Packit Service a1973e
           PAPI_DATATYPE_BIT64,				/**< Data is 64-bit binary */
        Packit Service a1973e
        };
        Packit Service a1973e
        Packit Service a1973e
        /** Enum values for event_info value_type field */
        Packit Service a1973e
        enum {
        Packit Service a1973e
           PAPI_VALUETYPE_RUNNING_SUM = 0,	/**< Data is running sum from start */
        Packit Service a1973e
           PAPI_VALUETYPE_ABSOLUTE,	        /**< Data is from last read */
        Packit Service a1973e
        };
        Packit Service a1973e
        Packit Service a1973e
        /** Enum values for event_info timescope field */
        Packit Service a1973e
        enum {
        Packit Service a1973e
           PAPI_TIMESCOPE_SINCE_START = 0,	/**< Data is cumulative from start */
        Packit Service a1973e
           PAPI_TIMESCOPE_SINCE_LAST,		/**< Data is from last read */
        Packit Service a1973e
           PAPI_TIMESCOPE_UNTIL_NEXT,		/**< Data is until next read */
        Packit Service a1973e
           PAPI_TIMESCOPE_POINT,			/**< Data is an instantaneous value */
        Packit Service a1973e
        };
        Packit Service a1973e
        Packit Service a1973e
        /** Enum values for event_info update_type field */
        Packit Service a1973e
        enum {
        Packit Service a1973e
           PAPI_UPDATETYPE_ARBITRARY = 0,	/**< Data is cumulative from start */
        Packit Service a1973e
           PAPI_UPDATETYPE_PUSH,	        /**< Data is pushed */
        Packit Service a1973e
           PAPI_UPDATETYPE_PULL,	        /**< Data is pulled */
        Packit Service a1973e
           PAPI_UPDATETYPE_FIXEDFREQ,	    /**< Data is read periodically */
        Packit Service a1973e
        };
        Packit Service a1973e
        Packit Service a1973e
        Packit Service a1973e
           typedef struct event_info {
        Packit Service a1973e
              unsigned int event_code;             /**< preset (0x8xxxxxxx) or 
        Packit Service a1973e
                                                        native (0x4xxxxxxx) event code */
        Packit Service a1973e
              char symbol[PAPI_HUGE_STR_LEN];      /**< name of the event */
        Packit Service a1973e
              char short_descr[PAPI_MIN_STR_LEN];  /**< a short description suitable for 
        Packit Service a1973e
                                                        use as a label */
        Packit Service a1973e
              char long_descr[PAPI_HUGE_STR_LEN];  /**< a longer description:
        Packit Service a1973e
                                                        typically a sentence for presets,
        Packit Service a1973e
                                                        possibly a paragraph from vendor
        Packit Service a1973e
                                                        docs for native events */
        Packit Service a1973e
        Packit Service a1973e
              int component_index;           /**< component this event belongs to */
        Packit Service a1973e
              char units[PAPI_MIN_STR_LEN];  /**< units event is measured in */
        Packit Service a1973e
              int location;                  /**< location event applies to */
        Packit Service a1973e
              int data_type;                 /**< data type returned by PAPI */
        Packit Service a1973e
              int value_type;                /**< sum or absolute */
        Packit Service a1973e
              int timescope;                 /**< from start, etc. */
        Packit Service a1973e
              int update_type;               /**< how event is updated */
        Packit Service a1973e
              int update_freq;               /**< how frequently event is updated */
        Packit Service a1973e
        Packit Service a1973e
             /* PRESET SPECIFIC FIELDS FOLLOW */
        Packit Service a1973e
        Packit Service a1973e
        Packit Service a1973e
        Packit Service a1973e
              unsigned int count;                /**< number of terms (usually 1) 
        Packit Service a1973e
                                                      in the code and name fields 
        Packit Service a1973e
                                                      - presets: these are native events
        Packit Service a1973e
                                                      - native: these are unused */
        Packit Service a1973e
        Packit Service a1973e
              unsigned int event_type;           /**< event type or category 
        Packit Service a1973e
                                                      for preset events only */
        Packit Service a1973e
        Packit Service a1973e
              char derived[PAPI_MIN_STR_LEN];    /**< name of the derived type
        Packit Service a1973e
                                                      - presets: usually NOT_DERIVED
        Packit Service a1973e
                                                      - native: empty string */
        Packit Service a1973e
              char postfix[PAPI_2MAX_STR_LEN];   /**< string containing postfix 
        Packit Service a1973e
                                                      operations; only defined for 
        Packit Service a1973e
                                                      preset events of derived type 
        Packit Service a1973e
                                                      DERIVED_POSTFIX */
        Packit Service a1973e
        Packit Service a1973e
              unsigned int code[PAPI_MAX_INFO_TERMS]; /**< array of values that further 
        Packit Service a1973e
                                                      describe the event:
        Packit Service a1973e
                                                      - presets: native event_code values
        Packit Service a1973e
                                                      - native:, register values(?) */
        Packit Service a1973e
        Packit Service a1973e
              char name[PAPI_MAX_INFO_TERMS]         /**< names of code terms: */
        Packit Service a1973e
                       [PAPI_2MAX_STR_LEN];          /**< - presets: native event names,
        Packit Service a1973e
                                                          - native: descriptive strings 
        Packit Service a1973e
        						  for each register value(?) */
        Packit Service a1973e
        Packit Service a1973e
             char note[PAPI_HUGE_STR_LEN];          /**< an optional developer note 
        Packit Service a1973e
                                                        supplied with a preset event
        Packit Service a1973e
                                                        to delineate platform specific 
        Packit Service a1973e
        						anomalies or restrictions */
        Packit Service a1973e
        Packit Service a1973e
           } PAPI_event_info_t;
        Packit Service a1973e
        Packit Service a1973e
        Packit Service a1973e
        Packit Service a1973e
        Packit Service a1973e
        /** \internal
        Packit Service a1973e
          * @defgroup low_api The Low Level API 
        Packit Service a1973e
          @{ */
        Packit Service a1973e
           int   PAPI_accum(int EventSet, long long * values); /**< accumulate and reset hardware events from an event set */
        Packit Service a1973e
           int   PAPI_add_event(int EventSet, int Event); /**< add single PAPI preset or native hardware event to an event set */
        Packit Service a1973e
           int   PAPI_add_named_event(int EventSet, const char *EventName); /**< add an event by name to a PAPI event set */
        Packit Service a1973e
           int   PAPI_add_events(int EventSet, int *Events, int number); /**< add array of PAPI preset or native hardware events to an event set */
        Packit Service a1973e
           int   PAPI_assign_eventset_component(int EventSet, int cidx); /**< assign a component index to an existing but empty eventset */
        Packit Service a1973e
           int   PAPI_attach(int EventSet, unsigned long tid); /**< attach specified event set to a specific process or thread id */
        Packit Service a1973e
           int   PAPI_cleanup_eventset(int EventSet); /**< remove all PAPI events from an event set */
        Packit Service a1973e
           int   PAPI_create_eventset(int *EventSet); /**< create a new empty PAPI event set */
        Packit Service a1973e
           int   PAPI_detach(int EventSet); /**< detach specified event set from a previously specified process or thread id */
        Packit Service a1973e
           int   PAPI_destroy_eventset(int *EventSet); /**< deallocates memory associated with an empty PAPI event set */
        Packit Service a1973e
           int   PAPI_enum_event(int *EventCode, int modifier); /**< return the event code for the next available preset or natvie event */
        Packit Service a1973e
           int   PAPI_enum_cmp_event(int *EventCode, int modifier, int cidx); /**< return the event code for the next available component event */
        Packit Service a1973e
           int   PAPI_event_code_to_name(int EventCode, char *out); /**< translate an integer PAPI event code into an ASCII PAPI preset or native name */
        Packit Service a1973e
           int   PAPI_event_name_to_code(const char *in, int *out); /**< translate an ASCII PAPI preset or native name into an integer PAPI event code */
        Packit Service a1973e
           int  PAPI_get_dmem_info(PAPI_dmem_info_t *dest); /**< get dynamic memory usage information */
        Packit Service a1973e
           int   PAPI_get_event_info(int EventCode, PAPI_event_info_t * info); /**< get the name and descriptions for a given preset or native event code */
        Packit Service a1973e
           const PAPI_exe_info_t *PAPI_get_executable_info(void); /**< get the executable's address space information */
        Packit Service a1973e
           const PAPI_hw_info_t *PAPI_get_hardware_info(void); /**< get information about the system hardware */
        Packit Service a1973e
           const PAPI_component_info_t *PAPI_get_component_info(int cidx); /**< get information about the component features */
        Packit Service a1973e
           int   PAPI_get_multiplex(int EventSet); /**< get the multiplexing status of specified event set */
        Packit Service a1973e
           int   PAPI_get_opt(int option, PAPI_option_t * ptr); /**< query the option settings of the PAPI library or a specific event set */
        Packit Service a1973e
           int   PAPI_get_cmp_opt(int option, PAPI_option_t * ptr,int cidx); /**< query the component specific option settings of a specific event set */
        Packit Service a1973e
           long long PAPI_get_real_cyc(void); /**< return the total number of cycles since some arbitrary starting point */
        Packit Service a1973e
           long long PAPI_get_real_nsec(void); /**< return the total number of nanoseconds since some arbitrary starting point */
        Packit Service a1973e
           long long PAPI_get_real_usec(void); /**< return the total number of microseconds since some arbitrary starting point */
        Packit Service a1973e
           const PAPI_shlib_info_t *PAPI_get_shared_lib_info(void); /**< get information about the shared libraries used by the process */
        Packit Service a1973e
           int   PAPI_get_thr_specific(int tag, void **ptr); /**< return a pointer to a thread specific stored data structure */
        Packit Service a1973e
           int   PAPI_get_overflow_event_index(int Eventset, long long overflow_vector, int *array, int *number); /**< # decomposes an overflow_vector into an event index array */
        Packit Service a1973e
           long long PAPI_get_virt_cyc(void); /**< return the process cycles since some arbitrary starting point */
        Packit Service a1973e
           long long PAPI_get_virt_nsec(void); /**< return the process nanoseconds since some arbitrary starting point */
        Packit Service a1973e
           long long PAPI_get_virt_usec(void); /**< return the process microseconds since some arbitrary starting point */
        Packit Service a1973e
           int   PAPI_is_initialized(void); /**< return the initialized state of the PAPI library */
        Packit Service a1973e
           int   PAPI_library_init(int version); /**< initialize the PAPI library */
        Packit Service a1973e
           int   PAPI_list_events(int EventSet, int *Events, int *number); /**< list the events that are members of an event set */
        Packit Service a1973e
           int   PAPI_list_threads(unsigned long *tids, int *number); /**< list the thread ids currently known to PAPI */
        Packit Service a1973e
           int   PAPI_lock(int); /**< lock one of two PAPI internal user mutex variables */
        Packit Service a1973e
           int   PAPI_multiplex_init(void); /**< initialize multiplex support in the PAPI library */
        Packit Service a1973e
           int   PAPI_num_cmp_hwctrs(int cidx); /**< return the number of hardware counters for a specified component */
        Packit Service a1973e
           int   PAPI_num_events(int EventSet); /**< return the number of events in an event set */
        Packit Service a1973e
           int   PAPI_overflow(int EventSet, int EventCode, int threshold,
        Packit Service a1973e
                             int flags, PAPI_overflow_handler_t handler); /**< set up an event set to begin registering overflows */
        Packit Service a1973e
           void  PAPI_perror(const char *msg ); /**< Print a PAPI error message */
        Packit Service a1973e
           int   PAPI_profil(void *buf, unsigned bufsiz, caddr_t offset, 
        Packit Service a1973e
        					 unsigned scale, int EventSet, int EventCode, 
        Packit Service a1973e
        					 int threshold, int flags); /**< generate PC histogram data where hardware counter overflow occurs */
        Packit Service a1973e
           int   PAPI_query_event(int EventCode); /**< query if a PAPI event exists */
        Packit Service a1973e
           int   PAPI_query_named_event(const char *EventName); /**< query if a named PAPI event exists */
        Packit Service a1973e
           int   PAPI_read(int EventSet, long long * values); /**< read hardware events from an event set with no reset */
        Packit Service a1973e
           int   PAPI_read_ts(int EventSet, long long * values, long long *cyc); /**< read from an eventset with a real-time cycle timestamp */
        Packit Service a1973e
           int   PAPI_register_thread(void); /**< inform PAPI of the existence of a new thread */
        Packit Service a1973e
           int   PAPI_remove_event(int EventSet, int EventCode); /**< remove a hardware event from a PAPI event set */
        Packit Service a1973e
           int   PAPI_remove_named_event(int EventSet, const char *EventName); /**< remove a named event from a PAPI event set */
        Packit Service a1973e
           int   PAPI_remove_events(int EventSet, int *Events, int number); /**< remove an array of hardware events from a PAPI event set */
        Packit Service a1973e
           int   PAPI_reset(int EventSet); /**< reset the hardware event counts in an event set */
        Packit Service a1973e
           int   PAPI_set_debug(int level); /**< set the current debug level for PAPI */
        Packit Service a1973e
           int   PAPI_set_cmp_domain(int domain, int cidx); /**< set the component specific default execution domain for new event sets */
        Packit Service a1973e
           int   PAPI_set_domain(int domain); /**< set the default execution domain for new event sets  */
        Packit Service a1973e
           int   PAPI_set_cmp_granularity(int granularity, int cidx); /**< set the component specific default granularity for new event sets */
        Packit Service a1973e
           int   PAPI_set_granularity(int granularity); /**
        Packit Service a1973e
           int   PAPI_set_multiplex(int EventSet); /**< convert a standard event set to a multiplexed event set */
        Packit Service a1973e
           int   PAPI_set_opt(int option, PAPI_option_t * ptr); /**< change the option settings of the PAPI library or a specific event set */
        Packit Service a1973e
           int   PAPI_set_thr_specific(int tag, void *ptr); /**< save a pointer as a thread specific stored data structure */
        Packit Service a1973e
           void  PAPI_shutdown(void); /**< finish using PAPI and free all related resources */
        Packit Service a1973e
           int   PAPI_sprofil(PAPI_sprofil_t * prof, int profcnt, int EventSet, int EventCode, int threshold, int flags); /**< generate hardware counter profiles from multiple code regions */
        Packit Service a1973e
           int   PAPI_start(int EventSet); /**< start counting hardware events in an event set */
        Packit Service a1973e
           int   PAPI_state(int EventSet, int *status); /**< return the counting state of an event set */
        Packit Service a1973e
           int   PAPI_stop(int EventSet, long long * values); /**< stop counting hardware events in an event set and return current events */
        Packit Service a1973e
           char *PAPI_strerror(int); /**< return a pointer to the error name corresponding to a specified error code */
        Packit Service a1973e
           unsigned long PAPI_thread_id(void); /**< get the thread identifier of the current thread */
        Packit Service a1973e
           int   PAPI_thread_init(unsigned long (*id_fn) (void)); /**< initialize thread support in the PAPI library */
        Packit Service a1973e
           int   PAPI_unlock(int); /**< unlock one of two PAPI internal user mutex variables */
        Packit Service a1973e
           int   PAPI_unregister_thread(void); /**< inform PAPI that a previously registered thread is disappearing */
        Packit Service a1973e
           int   PAPI_write(int EventSet, long long * values); /**< write counter values into counters */
        Packit Service a1973e
           int   PAPI_get_event_component(int EventCode);  /**< return which component an EventCode belongs to */
        Packit Service a1973e
           int   PAPI_get_eventset_component(int EventSet);  /**< return which component an EventSet is assigned to */
        Packit Service a1973e
           int   PAPI_get_component_index(const char *name); /**< Return component index for component with matching name */
        Packit Service a1973e
           int   PAPI_disable_component(int cidx); /**< Disables a component before init */
        Packit Service a1973e
           int	 PAPI_disable_component_by_name(const char *name ); /**< Disable, before library init, a component by name. */
        Packit Service a1973e
        Packit Service a1973e
        Packit Service a1973e
           /** @} */
        Packit Service a1973e
        Packit Service a1973e
        /** \internal
        Packit Service a1973e
          @defgroup high_api  The High Level API 
        Packit Service a1973e
        Packit Service a1973e
           The simple interface implemented by the following eight routines
        Packit Service a1973e
           allows the user to access and count specific hardware events from
        Packit Service a1973e
           both C and Fortran. It should be noted that this API can be used in
        Packit Service a1973e
           conjunction with the low level API. 
        Packit Service a1973e
        	@{ */
        Packit Service a1973e
        Packit Service a1973e
           int PAPI_accum_counters(long long * values, int array_len); /**< add current counts to array and reset counters */
        Packit Service a1973e
           int PAPI_num_counters(void); /**< get the number of hardware counters available on the system */
        Packit Service a1973e
           int PAPI_num_components(void); /**< get the number of components available on the system */
        Packit Service a1973e
           int PAPI_read_counters(long long * values, int array_len); /**< copy current counts to array and reset counters */
        Packit Service a1973e
           int PAPI_start_counters(int *events, int array_len); /**< start counting hardware events */
        Packit Service a1973e
           int PAPI_stop_counters(long long * values, int array_len); /**< stop counters and return current counts */
        Packit Service a1973e
           int PAPI_flips(float *rtime, float *ptime, long long * flpins, float *mflips); /**< simplified call to get Mflips/s (floating point instruction rate), real and processor time */
        Packit Service a1973e
           int PAPI_flops(float *rtime, float *ptime, long long * flpops, float *mflops); /**< simplified call to get Mflops/s (floating point operation rate), real and processor time */
        Packit Service a1973e
           int PAPI_ipc(float *rtime, float *ptime, long long * ins, float *ipc); /**< gets instructions per cycle, real and processor time */
        Packit Service a1973e
           int PAPI_epc(int event, float *rtime, float *ptime, long long *ref, long long *core, long long *evt, float *epc); /**< gets (named) events per cycle, real and processor time, reference and core cycles */
        Packit Service a1973e
        /** @} */
        Packit Service a1973e
        Packit Service a1973e
        Packit Service a1973e
        Packit Service a1973e
        /* Backwards compatibility hacks.  Remove eventually? */
        Packit Service a1973e
        int   PAPI_num_hwctrs(void); /**< return the number of hardware counters for the cpu. for backward compatibility. Don't use! */
        Packit Service a1973e
        #define PAPI_COMPONENT_INDEX(a) PAPI_get_event_component(a)
        Packit Service a1973e
        #define PAPI_descr_error(a) PAPI_strerror(a)
        Packit Service a1973e
        Packit Service a1973e
        #ifdef __cplusplus
        Packit Service a1973e
        }
        Packit Service a1973e
        #endif
        Packit Service a1973e
        Packit Service a1973e
        #pragma GCC visibility pop
        Packit Service a1973e
        Packit Service a1973e
        #endif