Redhat Enterprise 4.3中静态编译perf
注:编译中使用的perf源码和内核版本并不是标准版中的源码,是我们内部的一个版本。这篇文章主要是提供一些思路,在你的环境中编译遇到的问题可能和我这里的不同,源文件或者Makefile文件的内容也会不一致。如果有问题,欢迎交流。
在编译之前需要安装elfutils-libelf-devel rpm包,这个包要和系统中安装的elfutils-libelf包的版本一致,可以在这里下载。如果没有安装,编译的时候会报下面的错误:
Makefile:402: No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev
Makefile:419: *** No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel. Stop.
perf目录下的Makefile中有这样一段注释,详细介绍了编译时可以指定的一些宏及其作用,如下所示:
#
# Define PYTHON to point to the python binary if the default
# `python' is not correct; for example: PYTHON=python2
#
# Define PYTHON_CONFIG to point to the python-config binary if
# the default `$(PYTHON)-config' is not correct.
#
# Define ASCIIDOC8 if you want to format documentation with AsciiDoc 8
#
# Define DOCBOOK_XSL_172 if you want to format man pages with DocBook XSL v1.72.
#
# Define LDFLAGS=-static to build a static binary.
#
# Define EXTRA_CFLAGS=-m64 or EXTRA_CFLAGS=-m32 as appropriate for cross-builds.
#
# Define NO_DWARF if you do not want debug-info analysis feature at all.
#
# Define WERROR=0 to disable treating any warnings as errors.
Makefile:402: No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev
Makefile:443: newt not found, disables TUI support. Please install newt-devel or libnewt-dev
Makefile:493: The path 'python' is not executable.
Makefile:493: *** Please set 'python' appropriately. Stop.
[root@dbl-sat-dev10.dbl01.baidu.com perf]#
Makefile:443: newt not found, disables TUI support. Please install newt-devel or libnewt-dev
Makefile:493: The path 'python' is not executable.
Makefile:493: *** Please set 'python' appropriately. Stop.
BASIC_CFLAGS += -DNO_NEWT_SUPPORT
else
FLAGS_NEWT=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -lnewt
ifneq ($(call try-cc,$(SOURCE_NEWT),$(FLAGS_NEWT)),y)
msg := $(warning newt not found, disables TUI support. Please install newt-devel or libnewt-dev);
BASIC_CFLAGS += -DNO_NEWT_SUPPORT
else
# Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h
BASIC_CFLAGS += -I/usr/include/slang
......
endif
endif
Makefile:493: The path 'python' is not executable.
Makefile:493: *** Please set 'python' appropriately. Stop.
[root@dbl-sat-dev10.dbl01.baidu.com perf]#
488 define disable-python_code
489 BASIC_CFLAGS += -DNO_LIBPYTHON
490 $(if $(1),$(warning No $(1) was found))
491 $(warning Python support won't be built)
492 endef
498 $(call disable-python,python interpreter)
499 python-clean :=
500 else
488 python-clean :=
489 #disable-python = $(eval $(disable-python_code))
490 #define disable-python_code
491 # BASIC_CFLAGS += -DNO_LIBPYTHON
492 # $(if $(1),$(warning No $(1) was found))
493 # $(warning Python support won't be built)
494 #endef
......
559 # endif
560 # endif
561 # endif
562 #endif
builtin-test.c:986: warning: implicit declaration of function `CPU_ALLOC'
builtin-test.c:986: warning: nested extern declaration of `CPU_ALLOC'
builtin-test.c:986: warning: assignment makes pointer from integer without a cast
builtin-test.c:987: warning: implicit declaration of function `CPU_ALLOC_SIZE'
builtin-test.c:987: warning: nested extern declaration of `CPU_ALLOC_SIZE'
builtin-test.c:988: warning: implicit declaration of function `CPU_ZERO_S'
builtin-test.c:988: warning: nested extern declaration of `CPU_ZERO_S'
builtin-test.c:991: warning: implicit declaration of function `CPU_FREE'
builtin-test.c:991: warning: nested extern declaration of `CPU_FREE'
builtin-test.c:1001: warning: implicit declaration of function `CPU_ISSET_S'
builtin-test.c:1001: warning: nested extern declaration of `CPU_ISSET_S'
builtin-test.c:1007: warning: implicit declaration of function `CPU_CLR_S'
builtin-test.c:1007: warning: nested extern declaration of `CPU_CLR_S'
builtin-test.c:1012: warning: nested extern declaration of `CPU_FREE'
builtin-test.c:991: warning: redundant redeclaration of 'CPU_FREE'
builtin-test.c:991: warning: previous implicit declaration of 'CPU_FREE' was here
builtin-test.c: In function `test__PERF_RECORD':
builtin-test.c:1301: warning: nested extern declaration of `CPU_FREE'
builtin-test.c:991: warning: redundant redeclaration of 'CPU_FREE'
builtin-test.c:991: warning: previous implicit declaration of 'CPU_FREE' was here
make: *** [builtin-test.o] Error 1
collect2: ld returned 1 exit status
make: *** [perf] Error 1
{
const char *cmd = argv[0];
static struct cmd_struct commands[] = {
{ "buildid-cache", cmd_buildid_cache, 0 },
{ "buildid-list", cmd_buildid_list, 0 },
{ "diff", cmd_diff, 0 },
{ "evlist", cmd_evlist, 0 },
{ "help", cmd_help, 0 },
{ "list", cmd_list, 0 },
{ "record", cmd_record, 0 },
{ "report", cmd_report, 0 },
{ "bench", cmd_bench, 0 },
{ "stat", cmd_stat, 0 },
{ "timechart", cmd_timechart, 0 },
{ "top", cmd_top, 0 },
{ "annotate", cmd_annotate, 0 },
{ "version", cmd_version, 0 },
{ "script", cmd_script, 0 },
{ "sched", cmd_sched, 0 },
{ "kmem", cmd_kmem, 0 },
{ "lock", cmd_lock, 0 },
{ "kvm", cmd_kvm, 0 },
{ "test", cmd_test, 0 },
{ "inject", cmd_inject, 0 },
};
......
}
CC perf.o
LINK perf
List of pre-defined events (to be used in -e):
cpu-cycles OR cycles [Hardware event]
stalled-cycles-frontend OR idle-cycles-frontend [Hardware event]
stalled-cycles-backend OR idle-cycles-backend [Hardware event]
instructions [Hardware event]
cache-references [Hardware event]
cache-misses [Hardware event]
branch-instructions OR branches [Hardware event]
branch-misses [Hardware event]
bus-cycles [Hardware event]
cpu-clock [Software event]
task-clock [Software event]
page-faults OR faults [Software event]
minor-faults [Software event]
major-faults [Software event]
context-switches OR cs [Software event]
cpu-migrations OR migrations [Software event]
alignment-faults [Software event]
emulation-faults [Software event]
L1-dcache-loads [Hardware cache event]
L1-dcache-load-misses [Hardware cache event]
L1-dcache-stores [Hardware cache event]
L1-dcache-store-misses [Hardware cache event]
L1-dcache-prefetches [Hardware cache event]
L1-dcache-prefetch-misses [Hardware cache event]
Performance counter stats for 'ls':
0.812494 task-clock # 0.858 CPUs utilized
0 context-switches # 0.000 M/sec
0 CPU-migrations # 0.000 M/sec
223 page-faults # 0.274 M/sec
1,938,102 cycles # 2.385 GHz
1,199,394 stalled-cycles-frontend # 61.88% frontend cycles idle
631,632 stalled-cycles-backend # 32.59% backend cycles idle
1,367,408 instructions # 0.71 insns per cycle
# 0.88 stalled cycles per insn
268,711 branches # 330.724 M/sec
12,927 branch-misses # 4.81% of all branches
0.000946553 seconds time elapsed
Redhat Enterprise 4.3中静态编译perf相关推荐
- redhat Enterprise 5下安装中文输入法,
redhat Enterprise 5下安装中文输入法, 这实际上次解决VMware 6.5下不能正确显示中文的第二部分吧,还是以前的老问题,VMware6.5下安装redhat Enterprise ...
- Java静态编译技术:突破Java“冷启动”桎梏,实现启动性能“质”的飞跃
自1996年诞生以来,Java语言长期在最受欢迎的编程语言排行榜中占据领先地位.除了语言本身的优秀特性之外,Java语言持续演进.不断发展也是它能够保持长盛不衰的重要原因. |Java市场份额不断下降 ...
- 记录下 QT Linux 静态编译遇到的坑
记录下 QT Linux 静态编译遇到的坑 记录下 QT Linux 静态编译遇到的坑 - 貘吃馍的日志 - 网易博客 http://qbaok.blog.163.com/blog/static/10 ...
- vc2010设置为静态编译
问题:VS2010 c++编写的程序在别人的机子运行不了,缺少mfc100u.dll xxx100d.dll等的解决方法 解决方法有两种: 1.将这些dll打包,和应用程序一起发布; 2.采用MFC静 ...
- redhat enterprise 5 在 VMware 6.5 中中文显示乱码的解决办法
redhat enterprise 5 在 VMware 6.5 中中文显示乱码的解决办法 事情的经过是这样的 记得以前曾经在VMware 5.5.3 上装过redhat 估计是9吧 当初我选的是图形 ...
- SLAM静态编译中动态链接库问题
0. 简介 作为ubuntu的使用者,最难过的事情就是环境的依赖和配置,其中最繁琐的就是各种动态链接库的配置.尤其是在跑ROS-SLAM等比较大的环境时候,我们会发现按照教程经常会出现安装了这个库但是 ...
- Redhat Enterprise Linux 6.5下安装Oracle11g R2
安装Oracle有以下步骤: 1>.安装Linux作业系统. 2>.配置Linux系统下Oracle的安装环境. 3>.安装Oracle软件与数据库. 4&g ...
- 为什么在2012/2013年我将在新的Enterprise Java项目中继续使用Spring *和* Java EE
自从我担任技术决策职务以来已经过去了一年多,很高兴看到我仍然与之保持着完美的和谐. 几个月前,我在KaiWähner的一个不错的博客中写了一个有关JEE与Spring的答案. 如果观点没有不同,那么讨 ...
- 关于DDK中的编译知识 .
本文将分为三个部分进行介绍:1.makefile文件.2.DDK中的编译文件.3.DDK中的编译文件语法. 1. makefile文件 概述 -- 什么是makefile?或许很多Winodws的程序 ...
最新文章
- 获取一个目录下文件扩展名为txt或htm或html的文件的几种方法
- Java连接FTP服务器并且实现对其文件的上传和下载
- PHP的var_dump(‘1‘==‘1e0‘)的结果为true
- input标签用法解读
- IOS 定义手势监听器详解,利用 UIGestureRecognizer 进行捏合、旋转、平移、点击、长按手势事件响应
- 高内聚低耦合通俗理解_带你从入门到精通——「高内聚低耦合」
- 如何让cloudflare缓存html,wordpress博客使用CloudFlare的页面规则缓存设置教程
- 开发者容易陷入的 50 大误区!
- iPhone开发内存管理
- QT tableWidget的使用及其实例
- JS 正则表达式基础
- u深度u盘制作与装系统教程
- 乳清白蛋白纳米粒修饰生物素
- 关于嵌入式EMW3162 Wifi模块的网络配置与测试
- Win32_NetworkAdapter 网卡 参数说明
- IllegalArgumentException :argument type mismatch
- 项目kick-off meeting流程总结(涉外)
- [UNR#2]黎明前的巧克力
- 在 Ubuntu 18.04 下安装 Klee 2.2
- 有序数组合并及等长数组对位穿插