361{
364 float mhz = 0.0;
366 char cpuinfo_filename[]="/proc/cpuinfo";
367
368 if ( (
f = fopen( cpuinfo_filename,
"r" ) ) == NULL ) {
371 }
372
373
374
375
376
377
381 }
383 sscanf(
s,
"%f", &mhz );
384 *cpuinfo_mhz = mhz;
385 }
386 else {
387 *cpuinfo_mhz = -1;
388
389 }
390
391
392
393
394
395
396
401 }
402 else {
403
408 }
409 else {
410
415 }
416 else {
417
420 if ( ( strcasecmp(
s,
"pSeries" ) == 0 ) ||
421 ( strcasecmp(
s,
"PowerNV" ) == 0 ) ||
422 ( strcasecmp(
s,
"PowerMac" ) == 0 ) ) {
424 }
425 }
426 else {
427
428
429
430
434 sscanf(
s,
"%x", &
tmp );
438 break;
441 break;
444 break;
447 break;
450 break;
453 break;
456 break;
457 default:
459 }
460 }
461 }
462 }
463 }
464 }
465
466
469 }
470
471
472
473
474
477
479 }
480
482
484 }
485
487
489 }
490
491
492
493
494
495
496
497
498
501
502
506
507
513
514
515
518 }
519
520
523
524
527 }
528
529#if 0
530 int *nodecpu;
531
532 nodecpu = malloc( (
unsigned int) hwinfo->
nnodes *
sizeof(
int) );
533 if ( nodecpu ) {
538 }
539 } else {
540 PAPIERROR(
"malloc failed for variable not currently used" );
541 }
542#endif
543
544
545
546
547 if (*cpuinfo_mhz < 1.0) {
549 if ((!
s) || (sscanf(
s,
"%f", &mhz ) != 1)) {
550 INTDBG(
"MHz detection failed. "
551 "Please edit file %s at line %d.\n",
552 __FILE__,__LINE__);
553 }
554
556
557 *cpuinfo_mhz = 2*(((
int)mhz)+1);
558
559
561 s = strstr(
s,
" V")+2;
564 }
565 else {
566
568 if (mhz!=0) *cpuinfo_mhz = mhz / hwinfo->
totalcpus;
569 }
570 }
571 }
572
574
576}
#define PAPI_VENDOR_ARM_CAVIUM
#define PAPI_VENDOR_ARM_BROADCOM
#define PAPI_VENDOR_ARM_HISILICON
#define PAPI_VENDOR_ARM_QUALCOMM
#define PAPI_VENDOR_ARM_ARM
#define PAPI_VENDOR_ARM_FUJITSU
#define PAPI_VENDOR_INTEL
#define PAPI_VENDOR_ARM_APM
static char * search_cpu_info(FILE *f, char *search_str)
static void decode_vendor_string(char *s, int *vendor)
static int decode_cpuinfo_arm(FILE *f, PAPI_hw_info_t *hwinfo)
static int decode_cpuinfo_power(FILE *f, PAPI_hw_info_t *hwinfo)
static int decode_cpuinfo_x86(FILE *f, PAPI_hw_info_t *hwinfo)
static int path_exist(const char *path,...)
static int path_sibling(const char *path,...)
#define INTDBG(format, args...)
void PAPIERROR(char *format,...)
char vendor_string[PAPI_MAX_STR_LEN]