|
Packit |
577717 |
#include <stdio.h>
|
|
Packit |
577717 |
#include <sys/utsname.h>
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#include "papi.h"
|
|
Packit |
577717 |
|
|
Packit |
577717 |
/* Support routine to display header information to the screen
|
|
Packit |
577717 |
from the hardware info data structure. The same code was duplicated
|
|
Packit |
577717 |
in a number of tests and utilities. Seems to make sense to refactor.
|
|
Packit |
577717 |
This may not be the best place for it to live, but it works for now.
|
|
Packit |
577717 |
*/
|
|
Packit |
577717 |
int
|
|
Packit |
577717 |
papi_print_header( char *prompt, const PAPI_hw_info_t ** hwinfo )
|
|
Packit |
577717 |
{
|
|
Packit |
577717 |
int cnt, mpx;
|
|
Packit |
577717 |
struct utsname uname_info;
|
|
Packit |
577717 |
PAPI_option_t options;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
if ( ( *hwinfo = PAPI_get_hardware_info( ) ) == NULL ) {
|
|
Packit |
577717 |
return PAPI_ESYS;
|
|
Packit |
577717 |
}
|
|
Packit |
577717 |
|
|
Packit |
577717 |
PAPI_get_opt(PAPI_COMPONENTINFO,&options);
|
|
Packit |
577717 |
|
|
Packit |
577717 |
uname(&uname_info);
|
|
Packit |
577717 |
|
|
Packit |
577717 |
printf( "%s", prompt );
|
|
Packit |
577717 |
printf
|
|
Packit |
577717 |
( "--------------------------------------------------------------------------------\n" );
|
|
Packit |
577717 |
printf( "PAPI version : %d.%d.%d.%d\n",
|
|
Packit |
577717 |
PAPI_VERSION_MAJOR( PAPI_VERSION ),
|
|
Packit |
577717 |
PAPI_VERSION_MINOR( PAPI_VERSION ),
|
|
Packit |
577717 |
PAPI_VERSION_REVISION( PAPI_VERSION ),
|
|
Packit |
577717 |
PAPI_VERSION_INCREMENT( PAPI_VERSION ) );
|
|
Packit |
577717 |
printf( "Operating system : %s %s\n",
|
|
Packit |
577717 |
uname_info.sysname, uname_info.release);
|
|
Packit |
577717 |
printf( "Vendor string and code : %s (%d, 0x%x)\n",
|
|
Packit |
577717 |
( *hwinfo )->vendor_string,
|
|
Packit |
577717 |
( *hwinfo )->vendor,
|
|
Packit |
577717 |
( *hwinfo )->vendor );
|
|
Packit |
577717 |
printf( "Model string and code : %s (%d, 0x%x)\n",
|
|
Packit |
577717 |
( *hwinfo )->model_string,
|
|
Packit |
577717 |
( *hwinfo )->model,
|
|
Packit |
577717 |
( *hwinfo )->model );
|
|
Packit |
577717 |
printf( "CPU revision : %f\n", ( *hwinfo )->revision );
|
|
Packit |
577717 |
if ( ( *hwinfo )->cpuid_family > 0 ) {
|
|
Packit |
577717 |
printf( "CPUID : Family/Model/Stepping %d/%d/%d, "
|
|
Packit |
577717 |
"0x%02x/0x%02x/0x%02x\n",
|
|
Packit |
577717 |
( *hwinfo )->cpuid_family,
|
|
Packit |
577717 |
( *hwinfo )->cpuid_model,
|
|
Packit |
577717 |
( *hwinfo )->cpuid_stepping,
|
|
Packit |
577717 |
( *hwinfo )->cpuid_family,
|
|
Packit |
577717 |
( *hwinfo )->cpuid_model,
|
|
Packit |
577717 |
( *hwinfo )->cpuid_stepping );
|
|
Packit |
577717 |
}
|
|
Packit |
577717 |
printf( "CPU Max MHz : %d\n", ( *hwinfo )->cpu_max_mhz );
|
|
Packit |
577717 |
printf( "CPU Min MHz : %d\n", ( *hwinfo )->cpu_min_mhz );
|
|
Packit |
577717 |
printf( "Total cores : %d\n", ( *hwinfo )->totalcpus );
|
|
Packit |
577717 |
|
|
Packit |
577717 |
if ( ( *hwinfo )->threads > 0 )
|
|
Packit |
577717 |
printf( "SMT threads per core : %d\n", ( *hwinfo )->threads );
|
|
Packit |
577717 |
if ( ( *hwinfo )->cores > 0 )
|
|
Packit |
577717 |
printf( "Cores per socket : %d\n", ( *hwinfo )->cores );
|
|
Packit |
577717 |
if ( ( *hwinfo )->sockets > 0 )
|
|
Packit |
577717 |
printf( "Sockets : %d\n", ( *hwinfo )->sockets );
|
|
Packit |
577717 |
printf( "Cores per NUMA region : %d\n", ( *hwinfo )->ncpu );
|
|
Packit |
577717 |
printf( "NUMA regions : %d\n", ( *hwinfo )->nnodes );
|
|
Packit |
577717 |
printf( "Running in a VM : %s\n", ( *hwinfo )->virtualized?
|
|
Packit |
577717 |
"yes":"no");
|
|
Packit |
577717 |
if ( (*hwinfo)->virtualized) {
|
|
Packit |
577717 |
printf( "VM Vendor : %s\n", (*hwinfo)->virtual_vendor_string);
|
|
Packit |
577717 |
}
|
|
Packit |
577717 |
cnt = PAPI_get_opt( PAPI_MAX_HWCTRS, NULL );
|
|
Packit |
577717 |
mpx = PAPI_get_opt( PAPI_MAX_MPX_CTRS, NULL );
|
|
Packit |
577717 |
if ( cnt >= 0 ) {
|
|
Packit |
577717 |
printf( "Number Hardware Counters : %d\n",cnt );
|
|
Packit |
577717 |
} else {
|
|
Packit |
577717 |
printf( "Number Hardware Counters : PAPI error %d: %s\n", cnt, PAPI_strerror(cnt));
|
|
Packit |
577717 |
}
|
|
Packit |
577717 |
if ( mpx >= 0 ) {
|
|
Packit |
577717 |
printf( "Max Multiplex Counters : %d\n", mpx );
|
|
Packit |
577717 |
} else {
|
|
Packit |
577717 |
printf( "Max Multiplex Counters : PAPI error %d: %s\n", mpx, PAPI_strerror(mpx));
|
|
Packit |
577717 |
}
|
|
Packit |
577717 |
printf("Fast counter read (rdpmc): %s\n",
|
|
Packit |
577717 |
options.cmp_info->fast_counter_read?"yes":"no");
|
|
Packit |
577717 |
printf( "--------------------------------------------------------------------------------\n" );
|
|
Packit |
577717 |
printf( "\n" );
|
|
Packit |
577717 |
return PAPI_OK;
|
|
Packit |
577717 |
}
|
|
Packit |
577717 |
|