static int get_system_info(void) { // struct perfctr_info info; struct wininfo win_hwinfo; int tmp; // float mhz; HMODULE hModule; DWORD len; long i = 0; /* Path and args */ hModule = GetModuleHandle(NULL); // current process len = GetModuleFileName(hModule,_papi_hwi_system_info.exe_info.fullname,PAPI_MAX_STR_LEN); if (len) splitpath(_papi_hwi_system_info.exe_info.fullname, _papi_hwi_system_info.exe_info.name); else return(PAPI_ESYS); DBG((stderr, "Executable is %s\n",_papi_hwi_system_info.exe_info.name)); DBG((stderr, "Full Executable is %s\n",_papi_hwi_system_info.exe_info.fullname)); /* Hardware info */ if (!init_hwinfo(&win_hwinfo)) return(PAPI_ESYS); _papi_hwi_system_info.hw_info.ncpu = win_hwinfo.ncpus; _papi_hwi_system_info.hw_info.nnodes = win_hwinfo.nnodes; _papi_hwi_system_info.hw_info.totalcpus = win_hwinfo.total_cpus; _papi_hwi_system_info.hw_info.vendor = win_hwinfo.vendor; _papi_hwi_system_info.hw_info.revision = (float)win_hwinfo.revision; strcpy(_papi_hwi_system_info.hw_info.vendor_string,win_hwinfo.vendor_string); _papi_hwi_system_info.hw_info.model = win_hwinfo.model; strcpy(_papi_hwi_system_info.hw_info.model_string,win_hwinfo.model_string); _papi_hwi_system_info.num_cntrs = win_hwinfo.nrctr; _papi_hwi_system_info.num_gp_cntrs = _papi_hwi_system_info.num_cntrs; _papi_hwi_system_info.hw_info.mhz = (float)win_hwinfo.mhz; tmp = _papi_hwd_get_memory_info(&_papi_hwi_system_info.mem_info, (int)win_hwinfo.vendor); if (tmp) return(tmp); /* Setup presets */ tmp = setup_all_presets(&win_hwinfo); if (tmp) return(tmp); return(PAPI_OK); }
int _papi_hwd_get_system_info( void ) { struct wininfo win_hwinfo; HMODULE hModule; DWORD len; long i = 0; /* Path and args */ _papi_hwi_system_info.pid = getpid( ); hModule = GetModuleHandle( NULL ); // current process len = GetModuleFileName( hModule, _papi_hwi_system_info.exe_info.fullname, PAPI_MAX_STR_LEN ); if ( len ) splitpath( _papi_hwi_system_info.exe_info.fullname, _papi_hwi_system_info.exe_info.address_info.name ); else return ( PAPI_ESYS ); SUBDBG( "Executable is %s\n", _papi_hwi_system_info.exe_info.address_info.name ); SUBDBG( "Full Executable is %s\n", _papi_hwi_system_info.exe_info.fullname ); /* Hardware info */ if ( !init_hwinfo( &win_hwinfo ) ) return ( PAPI_ESYS ); _papi_hwi_system_info.hw_info.ncpu = win_hwinfo.ncpus; _papi_hwi_system_info.hw_info.nnodes = win_hwinfo.nnodes; _papi_hwi_system_info.hw_info.totalcpus = win_hwinfo.total_cpus; _papi_hwi_system_info.hw_info.vendor = win_hwinfo.vendor; _papi_hwi_system_info.hw_info.revision = ( float ) win_hwinfo.revision; strcpy( _papi_hwi_system_info.hw_info.vendor_string, win_hwinfo.vendor_string ); /* initialize the model to something */ _papi_hwi_system_info.hw_info.model = PERFCTR_X86_GENERIC; if ( IS_P3( &win_hwinfo ) || IS_P3_XEON( &win_hwinfo ) || IS_CELERON( &win_hwinfo ) ) _papi_hwi_system_info.hw_info.model = PERFCTR_X86_INTEL_PIII; if ( IS_MOBILE( &win_hwinfo ) ) _papi_hwi_system_info.hw_info.model = PERFCTR_X86_INTEL_PENTM; if ( IS_P4( &win_hwinfo ) ) { if ( win_hwinfo.model >= 2 ) /* this is a guess for Pentium 4 Model 2 */ _papi_hwi_system_info.hw_info.model = PERFCTR_X86_INTEL_P4M2; else _papi_hwi_system_info.hw_info.model = PERFCTR_X86_INTEL_P4; } if ( IS_AMDDURON( &win_hwinfo ) || IS_AMDATHLON( &win_hwinfo ) ) _papi_hwi_system_info.hw_info.model = PERFCTR_X86_AMD_K7; strcpy( _papi_hwi_system_info.hw_info.model_string, win_hwinfo.model_string ); _papi_hwi_system_info.num_cntrs = win_hwinfo.nrctr; _papi_hwi_system_info.num_gp_cntrs = _papi_hwi_system_info.num_cntrs; _papi_hwi_system_info.hw_info.mhz = ( float ) win_hwinfo.mhz; _papi_hwi_system_info.hw_info.clock_mhz = mhz; return ( PAPI_OK ); }