本文参考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;
}

[失败]SystemTap和火焰图(Flame Graph)的更多相关文章

  1. 动态追踪技术(中) - Dtrace、SystemTap、火焰图

    http://openresty.org/cn/presentations.html http://weibo.com/agentzh?is_all=1 http://openresty.org/po ...

  2. linux 内核分析工具 Dtrace、SystemTap、火焰图、crash等

    << System语言详解 >> 关于 SystemTap 的书. 我们在分析各种系统异常和故障的时候,通常会用到 pstack(jstack) /pldd/ lsof/ tc ...

  3. linux系统分析工具续-SystemTap和火焰图(Flame Graph)

    本文为网上各位大神文章的综合简单实践篇,参考文章较多,有些总结性东西,自认暂无法详细写出,建议读文中列出的参考文档,相信会受益颇多.下面开始吧(本文出自 “cclo的博客” 博客,请务必保留此出处ht ...

  4. perf + 火焰图用法 小结

    要对新服务做性能测试,分析代码热点,初识perf,做下总结 perf + 火焰图用法 perf简介 Perf (Performance Event), Linux 系统原生提供的性能分析工具, 会返回 ...

  5. Linux下用火焰图进行性能分析【转】

    转自:https://blog.csdn.net/gatieme/article/details/78885908 版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原 ...

  6. 火焰图工具 SystemTap

    1. 安装 SystemTap 1. 首先安装内核开发包和调试包: # rpm -ivh kernel-debuginfo-common-($version).rpm # rpm -ivh kerne ...

  7. 使用perf生成Flame Graph(火焰图)

      具体的步骤参见这里: <flame graph:图形化perf call stack数据的小工具>   使用SystemTap脚本制作火焰图,内存较少时,分配存储采样的数组可能失败,需 ...

  8. perf + Flame Graph火焰图分析程序性能

    1.perf命令简要介绍 性能调优时,我们通常需要分析查找到程序百分比高的热点代码片段,这便需要使用 perf record 记录单个函数级别的统计信息,并使用 perf report 来显示统计结果 ...

  9. 火焰图(Flame Graphs)的安装和基本用法

    火焰图(Flame Graphs) 一.概述: 火焰图(flame graph)是性能分析的利器,通过它可以快速定位性能瓶颈点. perf 命令(performance 的缩写)是 Linux 系统原 ...

随机推荐

  1. c++ 计算指定半径圆的面积

    #include <iostream> #define PI 3.14 using namespace std; class Circle { float radius; public: ...

  2. FreeSouth的学习osg小贴士

    http://www.osgchina.org/index.php?option=com_content&view=article&id=150&catid=91&It ...

  3. Jenkins+Sonar集成对代码进行持续检测

    介绍 SonarQube(曾用名Sonar(声纳)[1])是一个开源的代码质量管理系统. 特征 支持超过25种编程语言[2]:Java.C/C++.C#.PHP.Flex.Groovy.JavaScr ...

  4. ActiveSupport::TimeZone; 功能:用户自行选择时区。

    TimeZone类作为一个包装器,服务一个TZinfo::Timezone 实例. 用途: 134个时区的检索. 使用简化的英文单词来取回和显示时区:如"Beijing" => ...

  5. Web开发中常用的定位布局position

    定位布局就是为开发提供了更好的布局方式,可以根据需求给相应的模块设定相应位置,从而使界面更佳丰富,代码更佳完美. position是CSS中非常重要的一个属性,通过position属性,我们可以让元素 ...

  6. TVD$XTAT在linux下安装使用详解

    扩展跟踪文件分析工具 (TVD$XTAT)是个命令行工具.和TKPROF一样,主要目的是把原始跟踪文件作为输入内容生成一个格式化的文件作为输出内容.输出文件可以是HTML或是文本文件.界面非常友好,推 ...

  7. [转载]Java抽象类和接口的学习

    http://android.blog.51cto.com/268543/385282/ 抽象类 abstract class     包含抽象方法的类,叫抽象类.而抽象的概念就是抽象出共同属性:成员 ...

  8. Vue.js组件设计原则

    页面上把每个独立可以交互的区域视为一个组件 每个组件对应一个工程目录,组件所需要的各种资源在这个目录下就近维护 页面不过是组件的容器,组件可以嵌套自由组合形成完整的页面

  9. 【LeetCode 8_字符串_实现】String to Integer (atoi)

    , INVALID}; int g_status; long long SubStrToInt(const char* str, bool minus) { ; : ; while (*str != ...

  10. 关于java的讲座有感

    今天晚上闲着看了下李兴华老师的java + 大数据 讲座.做一个屌爆的全能型技术人才,感觉有点收获,有兴趣的可以看看 链接地址:https://study.163.com/course/introdu ...