MIPS处理器上安装perf

在装有debianMIPS处理器中,安装perf工具时遇到的error描述如下:

下载相应内核版本,进入tools/perf目录,首先大致看下Makefile的内容,是否支持MIPS平台,然后安装perf

 #make
Makefile:553: DWARF register mappings have not been defined for architecture mips, DWARF support disabled
Makefile:565: newt not found, disables TUI support. Please install newt-devel or libnewt-dev
make: Warning: File `PERF-VERSION-FILE' has modification time 2.1e+08 s in the future
    CC builtin-record.o
cc1: warnings being treated as errors
builtin-record.c: In function 'mmap_read_head':
builtin-record.c:93: error: implicit declaration of function 'rmb'
builtin-record.c:93: error: nested extern declaration of 'rmb'
make: *** [builtin-record.o] Error 1

这个错误告诉我们rmb未定义,然后进入perf.h中仔细看,确实无MIPS这一项,需自己手动添加。参考代码支持多种MIPS型号,如下:

#ifdef __mips__
#include "../../arch/mips/include/asm/unistd.h"
#define rmb()           asm volatile(                                   \
                                ".set   mips2\n\t"                      \
                                "sync\n\t"                              \
                                ".set   mips0"                          \
                                : /* no output */                       \
                                : /* no input */                        \
                                : "memory")
#define cpu_relax()     asm volatile("" ::: "memory")
#endif

或者尝试
#ifdef __mips__
+#include "../../arch/mips/include/asm/unistd.h"
+#define rmb()          asm volatile(                                   \
+                               ".set   noreorder\n\t"                  \
+                               "nop;nop;nop;nop;nop;nop;nop\n\t"       \
+                               ".set   reorder"                        \
+                               : /* no output */                       \
+                               : /* no input */                        \
+                               : "memory")
+#define cpu_relax()    asm volatile("" ::: "memory")
+#endif




参考资料:

http://hackage.haskell.org/trac/ghc/wiki/Debugging/LowLevelProfiling/Perf

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值