PAPI  5.6.0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
linux-common.c
Go to the documentation of this file.
1 /*
2 * File: linux-common.c
3 */
4 
5 #include <unistd.h>
6 #include <string.h>
7 #include <stdlib.h>
8 #include <ctype.h>
9 #include <err.h>
10 #include <stdarg.h>
11 #include <stdio.h>
12 #include <errno.h>
13 #include <syscall.h>
14 #include <sys/utsname.h>
15 #include <sys/time.h>
16 
17 #include "papi.h"
18 #include "papi_internal.h"
19 #include "papi_vector.h"
20 
21 #include "linux-memory.h"
22 #include "linux-common.h"
23 #include "linux-timer.h"
24 
25 #include "x86_cpuid_info.h"
26 
28 
29 /* The locks used by Linux */
30 
31 #if defined(USE_PTHREAD_MUTEXES)
32 pthread_mutex_t _papi_hwd_lock_data[PAPI_MAX_LOCK];
33 #else
34 volatile unsigned int _papi_hwd_lock_data[PAPI_MAX_LOCK];
35 #endif
36 
37 
38 static int _linux_init_locks(void) {
39 
40  int i;
41 
42  for ( i = 0; i < PAPI_MAX_LOCK; i++ ) {
43 #if defined(USE_PTHREAD_MUTEXES)
44  pthread_mutex_init(&_papi_hwd_lock_data[i],NULL);
45 #else
47 #endif
48  }
49 
50  return PAPI_OK;
51 }
52 
53 
54 int
55 _linux_detect_hypervisor(char *virtual_vendor_name) {
56 
57  int retval=0;
58 
59 #if defined(__i386__)||defined(__x86_64__)
60  retval=_x86_detect_hypervisor(virtual_vendor_name);
61 #else
62  (void) virtual_vendor_name;
63 #endif
64 
65  return retval;
66 }
67 
68 
69 #define _PATH_SYS_SYSTEM "/sys/devices/system"
70 #define _PATH_SYS_CPU0 _PATH_SYS_SYSTEM "/cpu/cpu0"
71 
72 static char pathbuf[PATH_MAX] = "/";
73 
74 static char *
75 search_cpu_info( FILE * f, char *search_str)
76 {
77  static char line[PAPI_HUGE_STR_LEN] = "";
78  char *s, *start = NULL;
79 
80  rewind(f);
81 
82  while (fgets(line,PAPI_HUGE_STR_LEN,f)!=NULL) {
83  s=strstr(line,search_str);
84  if (s!=NULL) {
85  /* skip all characters in line up to the colon */
86  /* and then spaces */
87  s=strchr(s,':');
88  if (s==NULL) break;
89  s++;
90  while (isspace(*s)) {
91  s++;
92  }
93  start = s;
94  /* Find and clear newline */
95  s=strrchr(start,'\n');
96  if (s!=NULL) *s = 0;
97  break;
98  }
99  }
100  return start;
101 }
102 
103 static void
104 decode_vendor_string( char *s, int *vendor )
105 {
106  if ( strcasecmp( s, "GenuineIntel" ) == 0 )
107  *vendor = PAPI_VENDOR_INTEL;
108  else if ( ( strcasecmp( s, "AMD" ) == 0 ) ||
109  ( strcasecmp( s, "AuthenticAMD" ) == 0 ) )
110  *vendor = PAPI_VENDOR_AMD;
111  else if ( strcasecmp( s, "IBM" ) == 0 )
112  *vendor = PAPI_VENDOR_IBM;
113  else if ( strcasecmp( s, "Cray" ) == 0 )
114  *vendor = PAPI_VENDOR_CRAY;
115  else if ( strcasecmp( s, "ARM" ) == 0 )
116  *vendor = PAPI_VENDOR_ARM;
117  else if ( strcasecmp( s, "MIPS" ) == 0 )
118  *vendor = PAPI_VENDOR_MIPS;
119  else if ( strcasecmp( s, "SiCortex" ) == 0 )
120  *vendor = PAPI_VENDOR_MIPS;
121  else
122  *vendor = PAPI_VENDOR_UNKNOWN;
123 }
124 
125 static FILE *
126 xfopen( const char *path, const char *mode )
127 {
128  FILE *fd = fopen( path, mode );
129  if ( !fd )
130  err( EXIT_FAILURE, "error: %s", path );
131  return fd;
132 }
133 
134 static FILE *
135 path_vfopen( const char *mode, const char *path, va_list ap )
136 {
137  vsnprintf( pathbuf, sizeof ( pathbuf ), path, ap );
138  return xfopen( pathbuf, mode );
139 }
140 
141 
142 static int
143 path_sibling( const char *path, ... )
144 {
145  int c;
146  long n;
147  int result = 0;
148  char s[2];
149  FILE *fp;
150  va_list ap;
151  va_start( ap, path );
152  fp = path_vfopen( "r", path, ap );
153  va_end( ap );
154 
155  while ( ( c = fgetc( fp ) ) != EOF ) {
156  if ( isxdigit( c ) ) {
157  s[0] = ( char ) c;
158  s[1] = '\0';
159  for ( n = strtol( s, NULL, 16 ); n > 0; n /= 2 ) {
160  if ( n % 2 )
161  result++;
162  }
163  }
164  }
165 
166  fclose( fp );
167  return result;
168 }
169 
170 static int
171 path_exist( const char *path, ... )
172 {
173  va_list ap;
174  va_start( ap, path );
175  vsnprintf( pathbuf, sizeof ( pathbuf ), path, ap );
176  va_end( ap );
177  return access( pathbuf, F_OK ) == 0;
178 }
179 
180 static int
182 {
183  int tmp;
184  unsigned int strSize;
185  char *s;
186 
187  /* Stepping */
188  s = search_cpu_info( f, "stepping");
189  if ( s ) {
190  if (sscanf( s, "%d", &tmp ) ==1 ) {
191  hwinfo->revision = ( float ) tmp;
192  hwinfo->cpuid_stepping = tmp;
193  }
194  }
195 
196  /* Model Name */
197  s = search_cpu_info( f, "model name");
198  strSize = sizeof(hwinfo->model_string);
199  if ( s ) {
200  strncpy( hwinfo->model_string, s, strSize);
201  }
202 
203  /* Family */
204  s = search_cpu_info( f, "cpu family");
205  if ( s ) {
206  sscanf( s, "%d", &tmp );
207  hwinfo->cpuid_family = tmp;
208  }
209 
210 
211  /* CPU Model */
212  s = search_cpu_info( f, "model");
213  if ( s ) {
214  sscanf( s , "%d", &tmp );
215  hwinfo->model = tmp;
216  hwinfo->cpuid_model = tmp;
217  }
218 
219  return PAPI_OK;
220 }
221 
222 static int
224 {
225 
226  int tmp;
227  unsigned int strSize;
228  char *s;
229 
230  /* Revision */
231  s = search_cpu_info( f, "revision");
232  if ( s ) {
233  sscanf( s, "%d", &tmp );
234  hwinfo->revision = ( float ) tmp;
235  hwinfo->cpuid_stepping = tmp;
236  }
237 
238  /* Model Name */
239  s = search_cpu_info( f, "model");
240  strSize = sizeof(hwinfo->model_string);
241  if ( s ) {
242  strncpy( hwinfo->model_string, s, strSize);
243  }
244 
245  return PAPI_OK;
246 }
247 
248 
249 
250 static int
252 {
253 
254  int tmp;
255  unsigned int strSize;
256  char *s, *t;
257 
258  /* revision */
259  s = search_cpu_info( f, "CPU revision");
260  if ( s ) {
261  sscanf( s, "%d", &tmp );
262  hwinfo->revision = ( float ) tmp;
263  /* For compatability with old PAPI */
264  hwinfo->model = tmp;
265  }
266 
267  /* Model Name */
268  s = search_cpu_info( f, "model name");
269  strSize = sizeof(hwinfo->model_string);
270  if ( s ) {
271  strncpy( hwinfo->model_string, s, strSize );
272  }
273 
274  /* Architecture (ARMv6, ARMv7, ARMv8, etc.) */
275  /* Note the Raspberry Pi lies in the CPU architecture line */
276  /* (it's ARMv6 not ARMv7) */
277  /* So we should actually get the value from the */
278  /* Processor/ model name line */
279 
280  s = search_cpu_info( f, "CPU architecture");
281  if ( s ) {
282 
283  if (strstr(s,"AArch64")) {
284  hwinfo->cpuid_family = 8;
285  }
286  else {
287  s = search_cpu_info( f, "Processor" );
288  if (s) {
289  t=strchr(s,'(');
290  tmp=*(t+2)-'0';
291  hwinfo->cpuid_family = tmp;
292  }
293  else {
294  s = search_cpu_info( f, "model name" );
295  if (s) {
296  t=strchr(s,'(');
297  tmp=*(t+2)-'0';
298  hwinfo->cpuid_family = tmp;
299  }
300  }
301  }
302  }
303 
304  /* CPU Model */
305  s = search_cpu_info( f, "CPU part" );
306  if ( s ) {
307  sscanf( s, "%x", &tmp );
308  hwinfo->cpuid_model = tmp;
309  }
310 
311  /* CPU Variant */
312  s = search_cpu_info( f, "CPU variant" );
313  if ( s ) {
314  sscanf( s, "%x", &tmp );
315  hwinfo->cpuid_stepping = tmp;
316  }
317 
318  return PAPI_OK;
319 
320 }
321 
322 
323 int
324 _linux_get_cpu_info( PAPI_hw_info_t *hwinfo, int *cpuinfo_mhz )
325 {
326  int retval = PAPI_OK;
327  char *s;
328  float mhz = 0.0;
329  FILE *f;
330  char cpuinfo_filename[]="/proc/cpuinfo";
331 
332  if ( ( f = fopen( cpuinfo_filename, "r" ) ) == NULL ) {
333  PAPIERROR( "fopen(/proc/cpuinfo) errno %d", errno );
334  return PAPI_ESYS;
335  }
336 
337  /* All of this information may be overwritten by the component */
338 
339  /***********************/
340  /* Attempt to find MHz */
341  /***********************/
342  s = search_cpu_info( f, "cpu MHz" );
343  if ( !s ) {
344  s = search_cpu_info( f, "clock" );
345  }
346  if ( s ) {
347  sscanf( s, "%f", &mhz );
348  *cpuinfo_mhz = mhz;
349  }
350  else {
351  // PAPIWARN("Failed to find a clock speed in /proc/cpuinfo");
352  }
353 
354  /*******************************/
355  /* Vendor Name and Vendor Code */
356  /*******************************/
357 
358  /* First try to read "vendor_id" field */
359  /* Which is the most common field */
360  s = search_cpu_info( f, "vendor_id");
361  if ( s ) {
362  strcpy( hwinfo->vendor_string, s );
363  }
364  else {
365  /* If not found, try "vendor" which seems to be Itanium specific */
366  s = search_cpu_info( f, "vendor" );
367  if ( s ) {
368  strcpy( hwinfo->vendor_string, s );
369  }
370  else {
371  /* "system type" seems to be MIPS and Alpha */
372  s = search_cpu_info( f, "system type");
373  if ( s ) {
374  strcpy( hwinfo->vendor_string, s );
375  }
376  else {
377  /* "platform" indicates Power */
378  s = search_cpu_info( f, "platform");
379  if ( s ) {
380  if ( ( strcasecmp( s, "pSeries" ) == 0 ) ||
381  ( strcasecmp( s, "PowerNV" ) == 0 ) ||
382  ( strcasecmp( s, "PowerMac" ) == 0 ) ) {
383  strcpy( hwinfo->vendor_string, "IBM" );
384  }
385  }
386  else {
387  /* "CPU implementer" indicates ARM */
388  s = search_cpu_info( f, "CPU implementer");
389  if ( s ) {
390  strcpy( hwinfo->vendor_string, "ARM" );
391  }
392  }
393  }
394  }
395  }
396 
397  /* Decode the string to a PAPI specific implementer value */
398  if ( strlen( hwinfo->vendor_string ) ) {
399  decode_vendor_string( hwinfo->vendor_string, &hwinfo->vendor );
400  }
401 
402  /**********************************************/
403  /* Provide more stepping/model/family numbers */
404  /**********************************************/
405 
406  if ((hwinfo->vendor==PAPI_VENDOR_INTEL) ||
407  (hwinfo->vendor==PAPI_VENDOR_AMD)) {
408 
409  decode_cpuinfo_x86(f,hwinfo);
410  }
411 
412  if (hwinfo->vendor==PAPI_VENDOR_IBM) {
413 
414  decode_cpuinfo_power(f,hwinfo);
415  }
416 
417  if (hwinfo->vendor==PAPI_VENDOR_ARM) {
418 
419  decode_cpuinfo_arm(f,hwinfo);
420  }
421 
422 
423 
424 
425  /* The following members are set using the same methodology */
426  /* used in lscpu. */
427 
428  /* Total number of CPUs */
429  /* The following line assumes totalcpus was initialized to zero! */
430  while ( path_exist( _PATH_SYS_SYSTEM "/cpu/cpu%d", hwinfo->totalcpus ) )
431  hwinfo->totalcpus++;
432 
433  /* Number of threads per core */
434  if ( path_exist( _PATH_SYS_CPU0 "/topology/thread_siblings" ) )
435  hwinfo->threads =
436  path_sibling( _PATH_SYS_CPU0 "/topology/thread_siblings" );
437 
438  /* Number of cores per socket */
439  if ( path_exist( _PATH_SYS_CPU0 "/topology/core_siblings" ) &&
440  hwinfo->threads > 0 )
441  hwinfo->cores =
442  path_sibling( _PATH_SYS_CPU0 "/topology/core_siblings" ) /
443  hwinfo->threads;
444 
445  /* Number of NUMA nodes */
446  /* The following line assumes nnodes was initialized to zero! */
447  while ( path_exist( _PATH_SYS_SYSTEM "/node/node%d", hwinfo->nnodes ) ) {
448  hwinfo->nnodes++;
449  }
450 
451  /* Number of CPUs per node */
452  hwinfo->ncpu = hwinfo->nnodes > 1 ?
453  hwinfo->totalcpus / hwinfo->nnodes : hwinfo->totalcpus;
454 
455  /* Number of sockets */
456  if ( hwinfo->threads > 0 && hwinfo->cores > 0 ) {
457  hwinfo->sockets = hwinfo->totalcpus / hwinfo->cores / hwinfo->threads;
458  }
459 
460 #if 0
461  int *nodecpu;
462  /* cpumap data is not currently part of the _papi_hw_info struct */
463  nodecpu = malloc( (unsigned int) hwinfo->nnodes * sizeof(int) );
464  if ( nodecpu ) {
465  int i;
466  for ( i = 0; i < hwinfo->nnodes; ++i ) {
467  nodecpu[i] = path_sibling(
468  _PATH_SYS_SYSTEM "/node/node%d/cpumap", i );
469  }
470  } else {
471  PAPIERROR( "malloc failed for variable not currently used" );
472  }
473 #endif
474 
475 
476  /* Fixup missing Megahertz Value */
477  /* This is missing from cpuinfo on ARM and MIPS */
478  if (*cpuinfo_mhz < 1.0) {
479  s = search_cpu_info( f, "BogoMIPS" );
480  if ((!s) || (sscanf( s, "%f", &mhz ) != 1)) {
481  INTDBG("MHz detection failed. "
482  "Please edit file %s at line %d.\n",
483  __FILE__,__LINE__);
484  }
485 
486  if (hwinfo->vendor == PAPI_VENDOR_MIPS) {
487  /* MIPS has 2x clock multiplier */
488  *cpuinfo_mhz = 2*(((int)mhz)+1);
489 
490  /* Also update version info on MIPS */
491  s = search_cpu_info( f, "cpu model");
492  s = strstr(s," V")+2;
493  strtok(s," ");
494  sscanf(s, "%f ", &hwinfo->revision );
495  }
496  else {
497  /* In general bogomips is proportional to number of CPUs */
498  if (hwinfo->totalcpus) {
499  if (mhz!=0) *cpuinfo_mhz = mhz / hwinfo->totalcpus;
500  }
501  }
502  }
503 
504  fclose( f );
505 
506  return retval;
507 }
508 
509 int
510 _linux_get_mhz( int *sys_min_mhz, int *sys_max_mhz ) {
511 
512  FILE *fff;
513  int result;
514 
515  /* Try checking for min MHz */
516  /* Assume cpu0 exists */
517  fff=fopen("/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq","r");
518  if (fff==NULL) return PAPI_EINVAL;
519  result=fscanf(fff,"%d",sys_min_mhz);
520  fclose(fff);
521  if (result!=1) return PAPI_EINVAL;
522 
523  fff=fopen("/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq","r");
524  if (fff==NULL) return PAPI_EINVAL;
525  result=fscanf(fff,"%d",sys_max_mhz);
526  fclose(fff);
527  if (result!=1) return PAPI_EINVAL;
528 
529  return PAPI_OK;
530 
531 }
532 
533 int
535 
536  int retval;
537  char maxargs[PAPI_HUGE_STR_LEN];
538  pid_t pid;
539  int cpuinfo_mhz,sys_min_khz,sys_max_khz;
540 
541  /* Software info */
542 
543  /* Path and args */
544 
545  pid = getpid( );
546  if ( pid < 0 ) {
547  PAPIERROR( "getpid() returned < 0" );
548  return PAPI_ESYS;
549  }
550  mdi->pid = pid;
551 
552  sprintf( maxargs, "/proc/%d/exe", ( int ) pid );
553  retval = readlink( maxargs, mdi->exe_info.fullname,
554  PAPI_HUGE_STR_LEN-1 );
555  if ( retval < 0 ) {
556  PAPIERROR( "readlink(%s) returned < 0", maxargs );
557  return PAPI_ESYS;
558  }
559 
560  if (retval > PAPI_HUGE_STR_LEN-1) {
561  retval=PAPI_HUGE_STR_LEN-1;
562  }
563  mdi->exe_info.fullname[retval] = '\0';
564 
565  /* Careful, basename can modify its argument */
566  strcpy( maxargs, mdi->exe_info.fullname );
567 
568  strncpy( mdi->exe_info.address_info.name, basename( maxargs ),
571 
572  SUBDBG( "Executable is %s\n", mdi->exe_info.address_info.name );
573  SUBDBG( "Full Executable is %s\n", mdi->exe_info.fullname );
574 
575  /* Executable regions, may require reading /proc/pid/maps file */
576 
577  retval = _linux_update_shlib_info( mdi );
578  SUBDBG( "Text: Start %p, End %p, length %d\n",
581  ( int ) ( mdi->exe_info.address_info.text_end -
583  SUBDBG( "Data: Start %p, End %p, length %d\n",
586  ( int ) ( mdi->exe_info.address_info.data_end -
588  SUBDBG( "Bss: Start %p, End %p, length %d\n",
591  ( int ) ( mdi->exe_info.address_info.bss_end -
593 
594  /* PAPI_preload_option information */
595 
596  strcpy( mdi->preload_info.lib_preload_env, "LD_PRELOAD" );
597  mdi->preload_info.lib_preload_sep = ' ';
598  strcpy( mdi->preload_info.lib_dir_env, "LD_LIBRARY_PATH" );
599  mdi->preload_info.lib_dir_sep = ':';
600 
601  /* Hardware info */
602 
603  retval = _linux_get_cpu_info( &mdi->hw_info, &cpuinfo_mhz );
604  if ( retval )
605  return retval;
606 
607  /* Handle MHz */
608 
609  retval = _linux_get_mhz( &sys_min_khz, &sys_max_khz );
610  if ( retval ) {
611 
612  mdi->hw_info.cpu_max_mhz=cpuinfo_mhz;
613  mdi->hw_info.cpu_min_mhz=cpuinfo_mhz;
614 
615  /*
616  mdi->hw_info.mhz=cpuinfo_mhz;
617  mdi->hw_info.clock_mhz=cpuinfo_mhz;
618  */
619  }
620  else {
621  mdi->hw_info.cpu_max_mhz=sys_max_khz/1000;
622  mdi->hw_info.cpu_min_mhz=sys_min_khz/1000;
623 
624  /*
625  mdi->hw_info.mhz=sys_max_khz/1000;
626  mdi->hw_info.clock_mhz=sys_max_khz/1000;
627  */
628  }
629 
630  /* Set Up Memory */
631 
632  retval = _linux_get_memory_info( &mdi->hw_info, mdi->hw_info.model );
633  if ( retval )
634  return retval;
635 
636  SUBDBG( "Found %d %s(%d) %s(%d) CPUs at %d Mhz.\n",
637  mdi->hw_info.totalcpus,
638  mdi->hw_info.vendor_string,
639  mdi->hw_info.vendor,
640  mdi->hw_info.model_string,
641  mdi->hw_info.model,
642  mdi->hw_info.cpu_max_mhz);
643 
644  /* Get virtualization info */
646 
647  return PAPI_OK;
648 }
649 
650 int
652 
653  int major=0,minor=0,sub=0;
654  char *ptr;
655  struct utsname uname_buffer;
656 
657  /* Initialize the locks */
659 
660  /* Get the kernel info */
661  uname(&uname_buffer);
662 
663  SUBDBG("Native kernel version %s\n",uname_buffer.release);
664 
665  strncpy(_papi_os_info.name,uname_buffer.sysname,PAPI_MAX_STR_LEN);
666 
667 #ifdef ASSUME_KERNEL
668  strncpy(_papi_os_info.version,ASSUME_KERNEL,PAPI_MAX_STR_LEN);
669  SUBDBG("Assuming kernel version %s\n",_papi_os_info.name);
670 #else
671  strncpy(_papi_os_info.version,uname_buffer.release,PAPI_MAX_STR_LEN);
672 #endif
673 
674  ptr=strtok(_papi_os_info.version,".");
675  if (ptr!=NULL) major=atoi(ptr);
676 
677  ptr=strtok(NULL,".");
678  if (ptr!=NULL) minor=atoi(ptr);
679 
680  ptr=strtok(NULL,".");
681  if (ptr!=NULL) sub=atoi(ptr);
682 
683  _papi_os_info.os_version=LINUX_VERSION(major,minor,sub);
684 
685  _papi_os_info.itimer_sig = PAPI_INT_MPX_SIGNAL;
686  _papi_os_info.itimer_num = PAPI_INT_ITIMER;
687  _papi_os_info.itimer_ns = PAPI_INT_MPX_DEF_US * 1000;
688  _papi_os_info.itimer_res_ns = 1;
689  _papi_os_info.clock_ticks = sysconf( _SC_CLK_TCK );
690 
691  /* Get Linux-specific system info */
693 
694  return PAPI_OK;
695 }
696 
697 
698 
700 
701  int watchdog_detected=0,watchdog_value=0;
702  FILE *fff;
703 
704  fff=fopen("/proc/sys/kernel/nmi_watchdog","r");
705  if (fff!=NULL) {
706  if (fscanf(fff,"%d",&watchdog_value)==1) {
707  if (watchdog_value>0) watchdog_detected=1;
708  }
709  fclose(fff);
710  }
711 
712  return watchdog_detected;
713 }
714 
717  .get_dmem_info = _linux_get_dmem_info,
718  .get_real_cycles = _linux_get_real_cycles,
719  .update_shlib_info = _linux_update_shlib_info,
720  .get_system_info = _linux_get_system_info,
721 
722 
723 #if defined(HAVE_CLOCK_GETTIME)
724  .get_real_usec = _linux_get_real_usec_gettime,
725 #elif defined(HAVE_GETTIMEOFDAY)
726  .get_real_usec = _linux_get_real_usec_gettimeofday,
727 #else
728  .get_real_usec = _linux_get_real_usec_cycles,
729 #endif
730 
731 
732 #if defined(USE_PROC_PTTIMER)
733  .get_virt_usec = _linux_get_virt_usec_pttimer,
734 #elif defined(HAVE_CLOCK_GETTIME_THREAD)
735  .get_virt_usec = _linux_get_virt_usec_gettime,
736 #elif defined(HAVE_PER_THREAD_TIMES)
737  .get_virt_usec = _linux_get_virt_usec_times,
738 #elif defined(HAVE_PER_THREAD_GETRUSAGE)
739  .get_virt_usec = _linux_get_virt_usec_rusage,
740 #endif
741 
742 
743 #if defined(HAVE_CLOCK_GETTIME)
744  .get_real_nsec = _linux_get_real_nsec_gettime,
745 #endif
746 
747 #if defined(HAVE_CLOCK_GETTIME_THREAD)
748  .get_virt_nsec = _linux_get_virt_nsec_gettime,
749 #endif
750 
751 
752 };
char name[PAPI_HUGE_STR_LEN]
Definition: papi.h:696
sprintf(splash[splash_line++],"\tIozone: Performance Test of File I/O\n")
int atoi()
static void decode_vendor_string(char *s, int *vendor)
Definition: linux-common.c:104
long long _linux_get_real_cycles(void)
Definition: linux-timer.c:302
int errno
int cores
Definition: papi.h:783
double f(double a)
Definition: cpi.c:23
static int decode_cpuinfo_power(FILE *f, PAPI_hw_info_t *hwinfo)
Definition: linux-common.c:223
static char * search_cpu_info(FILE *f, char *search_str)
Definition: linux-common.c:75
#define PAPI_INT_MPX_DEF_US
Definition: papi_internal.h:65
long long _linux_get_virt_usec_gettime(void)
Definition: linux-timer.c:433
Hardware info structure.
Definition: papi.h:780
caddr_t text_end
Definition: papi.h:698
start
Definition: iozone.c:22736
int cpu_min_mhz
Definition: papi.h:797
int fd
Definition: iozone.c:1291
static char pathbuf[PATH_MAX]
Definition: linux-common.c:72
return PAPI_OK
Definition: linux-nvml.c:497
va_start(arg_list, fmt)
static int path_sibling(const char *path,...)
Definition: linux-common.c:143
caddr_t bss_start
Definition: papi.h:701
PAPI_preload_info_t preload_info
PAPI_exe_info_t exe_info
fclose(thread_wqfd)
void
Definition: iozone.c:18627
return PAPI_EINVAL
Definition: linux-nvml.c:436
static FILE * fp
double c
Definition: multiplex.c:22
#define PAPI_HUGE_STR_LEN
Definition: papi.h:467
int _linux_get_mhz(int *sys_min_mhz, int *sys_max_mhz)
Definition: linux-common.c:510
Return codes and api definitions.
FILE * fff[MAX_EVENTS]
int cpuid_stepping
Definition: papi.h:794
#define PAPI_MAX_LOCK
Definition: papi_lock.h:18
#define _PATH_SYS_SYSTEM
Definition: linux-common.c:69
char name[PAPI_MAX_STR_LEN]
long long _linux_get_real_nsec_gettime(void)
Definition: linux-timer.c:523
#define INTDBG(format, args...)
Definition: papi_debug.h:65
char lib_preload_env[PAPI_MAX_STR_LEN]
Definition: papi.h:621
int _linux_update_shlib_info(papi_mdi_t *mdi)
t
Definition: iozone.c:23562
int threads
Definition: papi.h:782
#define _PATH_SYS_CPU0
Definition: linux-common.c:70
papi_os_vector_t _papi_os_vector
Definition: aix.c:1288
float revision
Definition: papi.h:791
int i
Definition: fileop.c:140
static int path_exist(const char *path,...)
Definition: linux-common.c:171
static FILE * path_vfopen(const char *mode, const char *path, va_list ap)
Definition: linux-common.c:135
PAPI_os_info_t _papi_os_info
Definition: aix.c:1210
int _linux_get_memory_info(PAPI_hw_info_t *hwinfo, int cpu_type)
#define PAPI_VENDOR_IBM
Definition: papi.h:350
static int pid
char virtual_vendor_string[PAPI_MAX_STR_LEN]
Definition: papi.h:801
char lib_preload_sep
Definition: papi.h:622
caddr_t text_start
Definition: papi.h:697
static FILE * xfopen(const char *path, const char *mode)
Definition: linux-common.c:126
PAPI_address_map_t address_info
Definition: papi.h:709
long long _linux_get_real_usec_cycles(void)
Definition: linux-timer.c:367
#define PAPI_ESYS
Definition: papi.h:255
int cpuid_model
Definition: papi.h:793
volatile unsigned int _papi_hwd_lock_data[PAPI_MAX_LOCK]
Definition: darwin-common.c:32
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
#define PAPI_INT_ITIMER
Definition: papi_internal.h:54
#define PAPI_VENDOR_MIPS
Definition: papi.h:355
s
Definition: iozone.c:20289
int nnodes
Definition: papi.h:785
void PAPIERROR(char *format,...)
int _linux_get_dmem_info(PAPI_dmem_info_t *d)
Definition: linux-memory.c:48
char version[PAPI_MAX_STR_LEN]
#define PAPI_VENDOR_ARM
Definition: papi.h:354
long long _linux_get_virt_usec_times(void)
Definition: linux-timer.c:409
int cpuid_family
Definition: papi.h:792
#define PAPI_INT_MPX_SIGNAL
Definition: papi_internal.h:52
int _linux_get_cpu_info(PAPI_hw_info_t *hwinfo, int *cpuinfo_mhz)
Definition: linux-common.c:324
static int decode_cpuinfo_x86(FILE *f, PAPI_hw_info_t *hwinfo)
Definition: linux-common.c:181
#define PAPI_VENDOR_CRAY
Definition: papi.h:351
char vendor_string[PAPI_MAX_STR_LEN]
Definition: papi.h:788
papi_mdi_t _papi_hwi_system_info
Definition: papi_internal.c:56
strcpy(filename, default_filename)
PAPI_hw_info_t hw_info
static int _linux_init_locks(void)
Definition: linux-common.c:38
#define PAPI_VENDOR_INTEL
Definition: papi.h:348
caddr_t data_start
Definition: papi.h:699
int _x86_detect_hypervisor(char *vendor_name)
va_end(arg_list)
#define LINUX_VERSION(a, b, c)
Definition: linux-common.h:4
int vendor
Definition: papi.h:787
int _papi_hwi_init_os(void)
Definition: aix.c:1213
sscanf(mnc->m_child_port,"%d",&mc.m_child_port)
#define MUTEX_OPEN
Definition: perfctr-ppc64.h:75
#define PATH_MAX
Definition: fileop.c:68
int model
Definition: papi.h:789
long long _linux_get_real_usec_gettime(void)
Definition: linux-timer.c:330
int cpu_max_mhz
Definition: papi.h:796
int
Definition: iozone.c:18528
long long _linux_get_virt_usec_pttimer(void)
Definition: linux-timer.c:452
caddr_t bss_end
Definition: papi.h:702
static int decode_cpuinfo_arm(FILE *f, PAPI_hw_info_t *hwinfo)
Definition: linux-common.c:251
caddr_t data_end
Definition: papi.h:700
int totalcpus
Definition: papi.h:786
int _linux_detect_nmi_watchdog()
Definition: linux-common.c:699
#define PAPI_MAX_STR_LEN
Definition: papi.h:465
long long _linux_get_virt_nsec_gettime(void)
Definition: linux-timer.c:546
char model_string[PAPI_MAX_STR_LEN]
Definition: papi.h:790
char fullname[PAPI_HUGE_STR_LEN]
Definition: papi.h:708
int _linux_detect_hypervisor(char *virtual_vendor_name)
Definition: linux-common.c:55
int virtualized
Definition: papi.h:800
ssize_t retval
Definition: libasync.c:338
long long tmp
Definition: iozone.c:12031
char lib_dir_sep
Definition: papi.h:624
long long _linux_get_virt_usec_rusage(void)
Definition: linux-timer.c:387
int _linux_get_system_info(papi_mdi_t *mdi)
Definition: linux-common.c:534
int(* get_memory_info)(PAPI_hw_info_t *, int)
Definition: papi_vector.h:69
char lib_dir_env[PAPI_MAX_STR_LEN]
Definition: papi.h:623
int sockets
Definition: papi.h:784
rewind(w_traj_fd)
long long _linux_get_real_usec_gettimeofday(void)
Definition: linux-timer.c:352
#define PAPI_VENDOR_AMD
Definition: papi.h:349
int ncpu
Definition: papi.h:781
#define PAPI_VENDOR_UNKNOWN
Definition: papi.h:347
char * ptr
Definition: iozone.c:23586