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