2012-07-27 119 views
0

我從網站上下載了4.4版本,將其構建在我自己的目錄中,並嘗試編寫一個小主文件,它不斷向我提供num_counters爲零的信息。然後我看着ctests撿起hwinfo.c,並從它(和TESTLIB)拆出來的一些代碼,並把它扔到一個小主,看起來像這樣:PAPI(性能應用程序編程)無法正常工作?

#include <stdio.h> 
#include <papi.h> 

int main(int argc, char** argv) 
{ 

    int retval, i, j; 
    const PAPI_hw_info_t *hwinfo = NULL; 
    const PAPI_mh_info_t *mh; 


    retval = PAPI_library_init(PAPI_VER_CURRENT); 
    if (retval != PAPI_VER_CURRENT) 
     cerr << "Failed at line " << __LINE__ << endl; 

    retval = 
     papi_print_header 
     ("Test case hwinfo.c: Check output of PAPI_get_hardware_info.\n", 
      &hwinfo); 
    if (retval != PAPI_OK) 
     cerr << "Failed at line " << __LINE__ << endl; 
} 

我建立這個使用下列內容:

g++ main.cpp -I/home/pchan/rabbit/papi/include /home/pchan/rabbit/papi/lib/libpapi.a 

,並運行它:

./a.out 

見證了這一輸出:

測試C ase hwinfo.c:檢查PAPI_get_hardware_info的輸出。

-------------------------------------------------------------------------------- 
PAPI Version    : 4.4.0.0 
Vendor string and code : (0) 
Model string and code : (0) 
CPU Revision    : 0.000000 
CPU Megahertz   : 0.000000 
CPU Clock Megahertz  : 0 
CPUs per Node   : 0 
Total CPUs    : 0 
Number Hardware Counters : 0 
Max Multiplex Counters : 0 
-------------------------------------------------------------------------------- 

我對正在發生的事情有點失落,爲什麼這是不工作...這是什麼症狀的和我能嘗試修復它?我的處理器是英特爾至強X5760和我UNAME -a說:

Linux chanbox 2.6.18-308.4.1.el5 #1 SMP Wed Mar 28 01:54:56 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux 

回答

-1

嘗試「papi_avail -a」知道什麼是支持您的PC上。

相關問題