|
  System Information
| |
ViewsFrom PAPIDocs
PAPI SYSTEM INFORMATIONEXECUTABLE INFORMATIONInformation about the executable’s address space can be obtained by using the following low-level function: C: PAPI_get_executable_info() Fortran:
PAPIF_get_exe_info(fullname, name, text_start, text_end, data_start, data_end,
bss_start, bss_end, lib_preload_env, check)
ARGUMENTSThe following arguments are implicit in the structure returned by the C function, or explicitly returned by Fortran: fullname -- fully qualified path + filename of the executable name -- filename of the executable with no path information text_start, text_end -- Start and End addresses of program text segment data_start, data_end -- Start and End addresses of program data segment bss_start, bss_end -- Start and End addresses of program bss segment lib_preload_env -- environment variable for preloading libraries Note that the arguments text_start and text_end are the only fields that are filled on every architecture. In C, this function returns a pointer to a structure containing information about the current program, such as the start and end addresses of the text, data, and bss segments. In Fortran, the fields of the structure are returned explicitly. In the following code example, PAPI_get_executable_info is used to acquire information about the start and end addresses of the program’s text segment:
#include <papi.h>
#include <stdio.h>
main()
{
const PAPI_exe_info_t *prginfo = NULL;
if (PAPI_library_init(PAPI_VER_CURRENT) != PAPI_VER_CURRENT)
exit(1);
if ((prginfo = PAPI_get_executable_info()) == NULL)
exit(1);
printf("Start of user program is at %p\n",prginfo->text_start);
printf("End of user program is at %p\n",prginfo->text_end);
}
POSSIBLE OUTPUT:Start of user program is at 0x4000000000000f20 End of user program is at 0x4000000000034e00 In C, on success, the function returns a non-NULL pointer and on error, NULL is returned. In Fortran, on success, the function returns PAPI_OK and on error, a non-zero error code is returned. HARDWARE INFORMATIONInformation about the system hardware can be obtained by using the following low-level function: C: PAPI_get_hardware_info() Fortran:
PAPIF_get_hardware_info (ncpu, nnodes, totalcpus, vendor, vendor_string,
model, model_string, revision, mhz)
ARGUMENTS The following arguments are implicit in the structure returned by the C function, or explicitly returned by Fortran.
ncpu -- number of CPUs in an SMP Node
nnodes -- number of Nodes in the entire system
totalcpus -- total number of CPUs in the entire system
vendor -- vendor id number of CPU
vendor_string -- vendor id string of CPU
model -- model number of CPU
model_string -- model string of CPU
revision -- Revision number of CPU
mhz -- Cycle time of this CPU;
*may* be an estimate generated at
initial time with a quick timing routine
In C, this function returns a pointer to a structure containing information about the hardware on which the program runs, such as: the number of CPUs, CPU model information, and the cycle time of the CPU. In Fortran, the fields of the structure are returned explicitly. Note that if this function were called before PAPI_library_init, it would be undefined. In the following code example, PAPI_get_hardware_info is used to acquire hardware information about the total number of CPUs and the cycle time of the CPU:
#include <papi.h>
#include <stdio.h>
main()
{
const PAPI_hw_info_t *hwinfo = NULL;
if (PAPI_library_init(PAPI_VER_CURRENT) != PAPI_VER_CURRENT)
exit(1);
if ((hwinfo = PAPI_get_hardware_info()) == NULL)
exit(1);
printf("%d CPU’s at %f Mhz.\n",hwinfo->totalcpus,hwinfo->mhz);
}
POSSIBLE OUTPUT:1 CPUs at 733.000000 Mhz. In C, on success, this function returns a non-NULL pointer and on error, NULL is returned. In Fortran, on success, this function returns PAPI_OK and on error, a non-zero error code is returned. SUBSTRATE INFORMATIONImplementation details about the current hardware dependent substrate can be obtained by using the following low-level function: '''C:''' PAPI_get_substrate_info() '''Fortran:''' This call is not implemented in the Fortran interface. '''ARGUMENTS''' In C, this function returns a pointer to a structure containing implementation details about the substrate currently in use, such as: the number of counters and multiplexed counters supported, the number of preset and native events available, and whether (and how) certain advanced features are supported. For more details, refer to the definition of the PAPI_substrate_info_t structure found in papi.h, or see the discussion under getting and setting options. Note: if this function is called before PAPI_library_init, its output is undefined. In the following code example, PAPI_get_substrate_info is used to determine how many preset and native events can be counted for a given substrate:
#include <papi.h>
#include <stdio.h>
main()
{
const PAPI_substrate_info_t *subinfo = NULL;
if (PAPI_library_init(PAPI_VER_CURRENT) != PAPI_VER_CURRENT)
exit(1);
if ((subinfo = PAPI_get_substrate_info()) == NULL)
exit(1);
printf("num_preset_events: %d\n",subinfo->num_preset_events); printf("num_native_events: %d\n",subinfo->num_native_events); }
POSSIBLE OUTPUT:num_preset_events: 47 num_native_events: 193
On success, this function returns a non-NULL pointer and on error, NULL is returned. |