安装Perl AIX-Perfstat-0.03

    昨天在AIX上安装AIX::Perfstat包时, 遇到了一点小问题, 下载并运行如下命令后, 报了一点错.

perl Makefile.PL
make

    报的错误是找不到cpu.o, memory.o等目标文件, 所以不能link成可执行文件, 这时可以修改Makefile.PL或生成好的Makefile.

Makefile.PL:
  OBJECT            => '$(O_FILES) cpu.o disk.o netinterface.o memory.o'
Makefile:
  OBJECT = $(O_FILES) cpu$(OBJ_EXT) disk$(OBJ_EXT) netinterface$(OBJ_EXT) memory$(OBJ_EXT)

    这样改了后, 编译是通过了, 但跑如下测试代码时, 却报错了.

#!/home/oracle/dbaperl/bin/perl -w
#
use AIX::Perfstat;

my $cpu=AIX::Perfstat::cpu_total();

print($cpu->{'processorHZ'},"\n");

    错误信息如下.

Can't find 'boot_AIX__Perfstat' symbol in ..../Perfstat.so
at .../Perfstat.pm line 38
Compilation failed in require at ./test.pl line 3.
BEGIN failed--compilation aborted at ./test.pl line 3.

    最后原因是编译时, 默认用了/usr/local/lib目录下的库文件, 用/usr/lib目录下的就行了, 再改一次Makefile就可以了.

LDDLFLAGS =  ... -L/usr/lib

    改完了之后, 就可以跑测试代码了, 可以得到CPU的频率了.

[oracle@test:/home/oracle] ./test.pl
1656376000

    接下来就是要研究如何使用这个包, 来编写监控系统性能的脚本了.

发表留言:

« Previous | Main | Next »

英语900句 | English 900

  • What's the capital of your country?
  • 贵国首都是哪儿?
  • I come from Japan.
  • 我来自日本.
  • I was born in China and brought up in the U.S.A.
  • 我出生在中国, 在美国长大.
  • My country has an area of 500,000 square kilometers.
  • 我国面积五十万平里.
  • The capital of my country id Beijing.
  • 我国首都是北京.