The fire diagram of Linux performance analysis tools

Source: Internet
Author: User
Tags systemtap

I. Environment

1.1 [Email protected]:~$ uname-a

Linux Jello 4.4.0-98-generic #121-ubuntu SMP Tue Oct 14:24:03 UTC x86_64 x86_64 x86_64 gnu/linux

1.2 [email protected]:~$ lsb_release-a

Distributor Id:ubuntu
Description:ubuntu 16.04.3 LTS
release:16.04
Codename:xenial

Two. Preparatory work.

2.1 Installing the Systemtap (Flame diagram depends on this tool)

sudo apt-get install Systemtap

2.2 Find the kernel corresponding debug package

[Email protected]:~$ uname-r
4.4.0-98-generic

Then the next step is to http://ddebs.ubuntu.com/pool/main/l/linux/download the corresponding debug package, find 4.4.0-98-generic consistent

2.3 Download the corresponding debug package

Wget Http://ddebs.ubuntu.com/pool/main/l/linux/linux-image-4.4.0-98-generic-dbgsym_4.4.0-98.121_amd64.ddeb ( This is the corresponding download path I found myself)

2.4 Installing the Debug Package

sudo dpkg-i linux-image-4.4.0-98-generic-dbgsym_4.4.0-98.121_amd64.ddeb

2.5 Installing Nginx

sudo apt-get install Nginx

Entering localhost in the browser will present the following information indicating the installation OK

Welcome to nginx!

If you see this page, the Nginx Web server is successfully installed and working. Further configuration is required.

For online documentation and the refer to nginx.org.
Commercial support was available at nginx.com.

Thank for using Nginx.

2.5 Write the Systemtap script Nginx.systemtap, which reads as follows:

Global S;
Global quit=0;
Probe Timer.profile {
if (pid () = = Target ()) {
if (quit) {
foreach (i in s) {
Print_ustack (i);
printf ("\t%d\n", @count (S[i]));
}
Exit ();
}
else {
S[ubacktrace ()] <<< 1;
}
}
}
Probe TIMER.S (20) {
Quit = 1
}

2.6 Using Systemtap

sudo stap--ldd-d/usr/sbin/nginx--all-modules-d maxmapentries=256-d maxaction=20000-d maxtrace=100-d MAXSTRINGLEN=4 096-d maxbacktrace=100-x 2082 nginx.systemtap--VP 0001 > Nginx.out

Resolution of each parameter:

--LDD, add all the shared library symbol table information parsed through LDD to provide information for probe to the user space binary, or to list with the-D option, note: This will make the probe module quite large

-d/usr/sbin/nginx, adding symbolic table information to the Kernel object module for a given module (here is Nginx), which may enable symbolic traceback of these modules or programs even if they are not explicitly probe into them

--all-modules, equivalent to specifying that all currently loaded modules specify '-dkernel ' and '-d '

Not finished, to be continued ...

The fire diagram of Linux performance analysis tools

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.