2012-07-27 120 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上。

相关问题