本文参考http://blog.51cto.com/xuclv/1184517

SystemTap简介:
  SystemTap provides free software (GPL) infrastructure to simplify the gathering of information about the running Linux system. This assists diagnosis of a performance or functional problem. SystemTap eliminates the need for the developer to go through the tedious and disruptive instrument, recompile, install, and reboot sequence that may be otherwise required to collect data.
  SystemTap provides a simple command line interface and scripting language for writing instrumentation for a live running system. We are publishing samples, as well as enlarging the internal "tapset" script library to aid reuse and abstraction.
详情参考:

http://sourceware.org/systemtap/wiki

http://www.ibm.com/developerworks/cn/linux/l-systemtap/

http://blog.yufeng.info/archives/855

火焰图简介:
  通过性能分析来确定什么原因导致CPU繁忙是日常工作中长做的事情,这往往会涉及到栈性能分析。通过定期采样的方式来确定哪些代码是导致CPU繁忙的原因是一个比较粗糙的方法。一个更好的方式是创建一个定时中断来收集程序运行时的计数,函数地址,甚至整个堆栈回溯,最后打印为我们可阅读的报告.我们常用的性能分析工具有oprofile,gprof,dtracesystemtap 等
Flame Graph:火焰图,是一个把采样所得到的堆栈跟踪可视化展示的工具。它是基于上面提到的性能分析工具的结果,Flame graph本身并不具备性能检测的能力。
 参考:

https://github.com/brendangregg/FlameGraph

http://dtrace.org/blogs/brendan/2011/12/16/flame-graphs/

http://dtrace.org/blogs/brendan/2012/03/17/linux-kernel-performance-flame-graphs/

systemtap安装及生成nginx的火焰图:
 OS:Ubuntu 14.04 LTS                 #支持uprobes机制
systemtap:2.1 #尽少的bug
root@ubuntu:~# uname -a
Linux ubuntu 3.13.--generic #-Ubuntu SMP Thu Apr :: UTC x86_64 x86_64 x86_64 GNU/Linux

1> 安装systemtap,这里源码编译

安装编译环境和systemtap并创建软链接
apt-get install build-essential libdw-dev -y
wget http://sourceware.org/systemtap/ftp/releases/systemtap-2.1.tar.gz
tar zxvf systemtap-2.1.tar.gz
./configure -prefix=/opt/systemtap -disable-docs -disable-publican -disable-refdocs
make
make install
ln -s /opt/systemtap/bin/stap /usr/sbin/stap

2> 安装debug packages

(Kernel debug info packages on Ubuntu, which will aid in providing information for bugs)

1.查看本机版本

root@ubuntu:~# uname -r
3.13.--generic

2:在http://ddebs.ubuntu.com/pool/main/l/linux/网址找到对应内核的的debug packages,下载并安装之

dpkg -i linux-image-3.13.--generic-dbgsym_3.13.0-.47_amd64.ddeb

400M左右,提前下载哦

3:测试systemtap,出现hello world,安装完成

stap -e 'probe kernel.function("sys_open") {log("hello world") exit()}'

4:systemtap安装参考:

apt-get install systemtap -y

http://sourceware.org/systemtap/wiki/SystemtapOnUbuntu
https://wiki.ubuntu.com/Kernel/Systemtap
5:安装LNMP(非必须,安装nginx即可)
apt-get install nginx mysql-server mysql-client php5 php5-fpm php5-mysql
vi /etc/nginx/sites-enabled/default #启用下面几行

location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# # NOTE: You should have "cgi.fix_pathinfo = 0;"in php.ini
#
# # With php5-cgi alone:
# fastcgi_pass 127.0.0.1:;
# # With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}

最新文章

  1. ios新手开发——toast提示和旋转图片加载框
  2. oracle-关于dual
  3. Spring - constructor-arg和property
  4. DIV+CSS系统学习:转载
  5. 动网论坛password暴力破解程序代码
  6. jquery判断文本域长度
  7. C++的MFC,与C#的.NET
  8. Sql Server 2008R2版本中有关外键Foreign的使用
  9. 在Cocos2d-x正在使用SQLlite数据库
  10. UIAlertController高级之嵌入其他控件 分类: ios技术 2015-02-02 11:58 96人阅读 评论(0) 收藏
  11. 译:Asp.Net Identity与Owin,到底谁是谁?
  12. MSSql-1内部数据库版本号
  13. linux下SS 网络命令详解
  14. zabbix回顾
  15. [Visual Studio] NuGet发布自定义包(Library Package)
  16. POJ 1251 Jungle Roads(Kruskal算法求解MST)
  17. HUAS 2017暑假第六周比赛-题解
  18. [leetcode DP]91. Decode Ways
  19. CSS 列表样式详解
  20. RedHat/CentOS利用iso镜像做本地yum源

热门文章

  1. JavaScript获取输入框内容
  2. java set初始化问题
  3. Android中的代理模式
  4. bzoj1054: [HAOI2008]移动玩具 状压+爆搜即可
  5. [linux]文件系统损坏,linux启动时 checking filesystems fail
  6. 【hive】数据仓库层次设计
  7. $'\r': command not found in Cygwin
  8. MVC Ajax Helpers
  9. 动态更新ViewPager中的Fragment(替换Fragment)
  10. Vim技能修炼教程(17) - 编译自己的Vim