Go to the source code of this file.
|
| static int | _linux_init_locks (void) |
| |
| int | _linux_detect_hypervisor (char *virtual_vendor_name) |
| |
| static char * | search_cpu_info (FILE *f, char *search_str) |
| |
| static void | decode_vendor_string (char *s, int *vendor) |
| |
| static FILE * | xfopen (const char *path, const char *mode) |
| |
| static FILE * | path_vfopen (const char *mode, const char *path, va_list ap) |
| |
| static int | path_sibling (const char *path,...) |
| |
| static int | path_exist (const char *path,...) |
| |
| static int | decode_cpuinfo_x86 (FILE *f, PAPI_hw_info_t *hwinfo) |
| |
| static int | decode_cpuinfo_power (FILE *f, PAPI_hw_info_t *hwinfo) |
| |
| static int | decode_cpuinfo_arm (FILE *f, PAPI_hw_info_t *hwinfo) |
| |
| int | _linux_get_cpu_info (PAPI_hw_info_t *hwinfo, int *cpuinfo_mhz) |
| |
| int | _linux_get_mhz (int *sys_min_mhz, int *sys_max_mhz) |
| |
| int | _linux_get_system_info (papi_mdi_t *mdi) |
| |
| int | _papi_hwi_init_os (void) |
| |
| int | _linux_detect_nmi_watchdog () |
| |
◆ _PATH_SYS_CPU0
◆ _PATH_SYS_SYSTEM
◆ _linux_detect_hypervisor()
| int _linux_detect_hypervisor |
( |
char * |
virtual_vendor_name | ) |
|
Definition at line 55 of file linux-common.c.
59 #if defined(__i386__)||defined(__x86_64__) 62 (void) virtual_vendor_name;
int _x86_detect_hypervisor(char *vendor_name)
◆ _linux_detect_nmi_watchdog()
| int _linux_detect_nmi_watchdog |
( |
| ) |
|
Definition at line 719 of file linux-common.c.
721 int watchdog_detected=0,watchdog_value=0;
724 fff=fopen(
"/proc/sys/kernel/nmi_watchdog",
"r");
726 if (fscanf(
fff,
"%d",&watchdog_value)==1) {
727 if (watchdog_value>0) watchdog_detected=1;
732 return watchdog_detected;
◆ _linux_get_cpu_info()
| int _linux_get_cpu_info |
( |
PAPI_hw_info_t * |
hwinfo, |
|
|
int * |
cpuinfo_mhz |
|
) |
| |
Definition at line 344 of file linux-common.c.
350 char cpuinfo_filename[]=
"/proc/cpuinfo";
352 if ( (
f = fopen( cpuinfo_filename,
"r" ) ) == NULL ) {
367 sscanf(
s,
"%f", &mhz );
400 if ( ( strcasecmp(
s,
"pSeries" ) == 0 ) ||
401 ( strcasecmp(
s,
"PowerNV" ) == 0 ) ||
402 ( strcasecmp(
s,
"PowerMac" ) == 0 ) ) {
483 nodecpu = malloc( (
unsigned int) hwinfo->
nnodes *
sizeof(
int) );
491 PAPIERROR(
"malloc failed for variable not currently used" );
498 if (*cpuinfo_mhz < 1.0) {
500 if ((!
s) || (sscanf(
s,
"%f", &mhz ) != 1)) {
501 INTDBG(
"MHz detection failed. " 502 "Please edit file %s at line %d.\n",
508 *cpuinfo_mhz = 2*(((int)mhz)+1);
512 s = strstr(
s,
" V")+2;
519 if (mhz!=0) *cpuinfo_mhz = mhz / hwinfo->
totalcpus;
static void decode_vendor_string(char *s, int *vendor)
static int decode_cpuinfo_power(FILE *f, PAPI_hw_info_t *hwinfo)
static char * search_cpu_info(FILE *f, char *search_str)
static int path_sibling(const char *path,...)
#define INTDBG(format, args...)
static int path_exist(const char *path,...)
void PAPIERROR(char *format,...)
static int decode_cpuinfo_x86(FILE *f, PAPI_hw_info_t *hwinfo)
char vendor_string[PAPI_MAX_STR_LEN]
#define PAPI_VENDOR_INTEL
static int decode_cpuinfo_arm(FILE *f, PAPI_hw_info_t *hwinfo)
◆ _linux_get_mhz()
| int _linux_get_mhz |
( |
int * |
sys_min_mhz, |
|
|
int * |
sys_max_mhz |
|
) |
| |
Definition at line 530 of file linux-common.c.
537 fff=fopen(
"/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq",
"r");
539 result=fscanf(
fff,
"%d",sys_min_mhz);
543 fff=fopen(
"/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq",
"r");
545 result=fscanf(
fff,
"%d",sys_max_mhz);
◆ _linux_get_system_info()
Definition at line 554 of file linux-common.c.
559 int cpuinfo_mhz,sys_min_khz,sys_max_khz;
572 sprintf( maxargs,
"/proc/%d/exe", (
int )
pid );
576 PAPIERROR(
"readlink(%s) returned < 0", maxargs );
598 SUBDBG(
"Text: Start %p, End %p, length %d\n",
603 SUBDBG(
"Data: Start %p, End %p, length %d\n",
608 SUBDBG(
"Bss: Start %p, End %p, length %d\n",
656 SUBDBG(
"Found %d %s(%d) %s(%d) CPUs at %d Mhz.\n",
PAPI_preload_info_t preload_info
int _linux_get_mhz(int *sys_min_mhz, int *sys_max_mhz)
int _linux_update_shlib_info(papi_mdi_t *mdi)
int _linux_get_memory_info(PAPI_hw_info_t *hwinfo, int cpu_type)
PAPI_address_map_t address_info
#define PAPI_HUGE_STR_LEN
char model_string[PAPI_MAX_STR_LEN]
#define SUBDBG(format, args...)
void PAPIERROR(char *format,...)
int _linux_get_cpu_info(PAPI_hw_info_t *hwinfo, int *cpuinfo_mhz)
char vendor_string[PAPI_MAX_STR_LEN]
char lib_dir_env[PAPI_MAX_STR_LEN]
int _linux_detect_hypervisor(char *virtual_vendor_name)
char virtual_vendor_string[PAPI_MAX_STR_LEN]
char fullname[PAPI_HUGE_STR_LEN]
char lib_preload_env[PAPI_MAX_STR_LEN]
char name[PAPI_HUGE_STR_LEN]
◆ _linux_init_locks()
| static int _linux_init_locks |
( |
void |
| ) |
|
|
static |
Definition at line 38 of file linux-common.c.
43 #if defined(USE_PTHREAD_MUTEXES)
volatile unsigned int _papi_hwd_lock_data[PAPI_MAX_LOCK]
◆ _papi_hwi_init_os()
| int _papi_hwi_init_os |
( |
void |
| ) |
|
Definition at line 671 of file linux-common.c.
673 int major=0,minor=0,sub=0;
675 struct utsname uname_buffer;
681 uname(&uname_buffer);
683 SUBDBG(
"Native kernel version %s\n",uname_buffer.release);
695 if (ptr!=NULL) major=
atoi(ptr);
697 ptr=strtok(NULL,
".");
698 if (ptr!=NULL) minor=
atoi(ptr);
700 ptr=strtok(NULL,
".");
701 if (ptr!=NULL) sub=
atoi(ptr);
#define PAPI_INT_MPX_DEF_US
char name[PAPI_MAX_STR_LEN]
#define SUBDBG(format, args...)
char version[PAPI_MAX_STR_LEN]
PAPI_os_info_t _papi_os_info
#define PAPI_INT_MPX_SIGNAL
papi_mdi_t _papi_hwi_system_info
static int _linux_init_locks(void)
#define LINUX_VERSION(a, b, c)
int _linux_get_system_info(papi_mdi_t *mdi)
◆ decode_cpuinfo_arm()
Definition at line 251 of file linux-common.c.
255 unsigned int strSize;
261 sscanf(
s,
"%d", &
tmp );
295 if (strstr(
s,
"AArch64")) {
327 sscanf(
s,
"%x", &
tmp );
334 sscanf(
s,
"%x", &
tmp );
static char * search_cpu_info(FILE *f, char *search_str)
char model_string[PAPI_MAX_STR_LEN]
◆ decode_cpuinfo_power()
Definition at line 223 of file linux-common.c.
227 unsigned int strSize;
233 sscanf(
s,
"%d", &
tmp );
static char * search_cpu_info(FILE *f, char *search_str)
char model_string[PAPI_MAX_STR_LEN]
◆ decode_cpuinfo_x86()
Definition at line 181 of file linux-common.c.
184 unsigned int strSize;
190 if (sscanf(
s,
"%d", &
tmp ) ==1 ) {
206 sscanf(
s,
"%d", &
tmp );
214 sscanf(
s ,
"%d", &
tmp );
static char * search_cpu_info(FILE *f, char *search_str)
char model_string[PAPI_MAX_STR_LEN]
◆ decode_vendor_string()
| static void decode_vendor_string |
( |
char * |
s, |
|
|
int * |
vendor |
|
) |
| |
|
static |
Definition at line 104 of file linux-common.c.
106 if ( strcasecmp(
s,
"GenuineIntel" ) == 0 )
108 else if ( ( strcasecmp(
s,
"AMD" ) == 0 ) ||
109 ( strcasecmp(
s,
"AuthenticAMD" ) == 0 ) )
111 else if ( strcasecmp(
s,
"IBM" ) == 0 )
113 else if ( strcasecmp(
s,
"Cray" ) == 0 )
115 else if ( strcasecmp(
s,
"ARM" ) == 0 )
117 else if ( strcasecmp(
s,
"MIPS" ) == 0 )
119 else if ( strcasecmp(
s,
"SiCortex" ) == 0 )
#define PAPI_VENDOR_INTEL
#define PAPI_VENDOR_UNKNOWN
◆ path_exist()
| static int path_exist |
( |
const char * |
path, |
|
|
|
... |
|
) |
| |
|
static |
◆ path_sibling()
| static int path_sibling |
( |
const char * |
path, |
|
|
|
... |
|
) |
| |
|
static |
Definition at line 143 of file linux-common.c.
155 while ( (
c = fgetc(
fp ) ) != EOF ) {
156 if ( isxdigit(
c ) ) {
159 for ( n = strtol(
s, NULL, 16 ); n > 0; n /= 2 ) {
static FILE * path_vfopen(const char *mode, const char *path, va_list ap)
◆ path_vfopen()
| static FILE* path_vfopen |
( |
const char * |
mode, |
|
|
const char * |
path, |
|
|
va_list |
ap |
|
) |
| |
|
static |
Definition at line 135 of file linux-common.c.
static char pathbuf[PATH_MAX]
static FILE * xfopen(const char *path, const char *mode)
◆ search_cpu_info()
| static char* search_cpu_info |
( |
FILE * |
f, |
|
|
char * |
search_str |
|
) |
| |
|
static |
Definition at line 75 of file linux-common.c.
83 s=strstr(line,search_str);
static struct timeval start
#define PAPI_HUGE_STR_LEN
◆ xfopen()
| static FILE* xfopen |
( |
const char * |
path, |
|
|
const char * |
mode |
|
) |
| |
|
static |
Definition at line 126 of file linux-common.c.
128 FILE *
fd = fopen( path, mode );
130 err( EXIT_FAILURE,
"error: %s", path );
◆ _papi_hwd_lock_data
◆ _papi_os_info
◆ _papi_os_vector
◆ pathbuf