The twos of Linux perf usage experience __linux

Source: Internet
Author: User
twos of Linu perf use experience

Perf is a very powerful tool that has been heard before but has never been used. Record now to find out afterwards. compiling

In addition to installing from the Package Manager, you can also compile directly from the source code.

Very simple, clone good kernel source code.

CD Linux/tools/perf make

How easy it is. Run Away

Brother is a short temper, the other first do not want to tube, first look at this thing can run into what. It is estimated that everyone reader is also similar, then we first run a few to see first. look at the whole process .

If you have a program, want to see if the program can be optimized point. Let's take a look at what functions the program is running on. And then you're doing a further optimization.

Perf Stat./your_program performance counter stats for './your_program ': 254.098794 task-clock #                  
                 0.997 CPUs utilized context-switches # 0.083 K/sec    6 cpu-migrations # 0.024 k/sec page-faults # 0.338 k/sec 774,758,136 Cycles # 3.049 GHz 554,7 72,168 Stalled-cycles-frontend # 71.61% frontend cycles idle 26,055,211 stalled-cycles-backend # 3.36        
                                             % Backend Cycles Idle 550,801,917 instructions # 0.71 Insns per cycle # 1.01 stalled cycles per insn 110,128,040 branches # 433.406 m/ SEC 7,007 Branch-misses # 0.01% of all branches 0.254960900
 Seconds time Elapsed

The details of each detail for the moment do not understand, first put. Know what is to do a general, later use the time to look again. look at the overall system .

Sometimes the whole system has a bottleneck, want to debug. It will take a look at the overall system where the operation is more.

Perf Top
================================================================================
list the Processes with their CPU utilization

  6.92%  libc-2.13.so                      [.] 0x0007aa67
  2.99%                              [.] Symbols__insert
  2.93%  perf                              [.] Symbol_filter
  2.79%  libxul.so                         [.] 0X0088EFC3
  2.68%  [kernel]                          [K] aes_decrypt
  2.14%  libflashplayer.so                 [.] 0x003442f4  1.86% Perf                              [.] Rb_next
  1.54%  chromium-browser                  [.] 0x01363b5f
Perf's event composition

Keep it, I don't know anyway.

All events that perf can capture can be run

Perf List

To get. Reference

Linux Perf Examples feel like this is a fairly comprehensive story.

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.