funcslower bcc-tools of the tool

When I use this function funcslower found to function funclatency more specific compared to the time when a function for those who want to know the execution time of the distribution,

Using funclatency is a good choice, but for the time when anxious to know the system a function to be executed, and then use funcslower easy enough.

 

funcslower literally, the function of those slow, in short, to correct the system, those who call execution time exceeds a set value.

This feature may be that you upon a variety of systems analysis tools are ineffective, as the final diagnostic tool for the analysis of system performance issues.

The old way, talking about the help.

usage: funcslower [-hf] [-p PID] [-U | -K] [-m MIN_MS] [-u MIN_US] [-a ARGUMENTS] [-T]
                     [-t] [-v]
                     function [function ...]

Trace slow kernel or user function calls.

positional arguments:
  function              function(s) to trace

optional arguments:
  -h, --help            show this help message and exit
  -p PID, --pid PID     trace this PID only
  -m MIN_MS, --min-ms MIN_MS       # 执行时间低于xx毫秒,作为阈值
                        minimum duration to trace (ms)  
  -u MIN_US, --min-us MIN_US
                        minimum duration to trace (us) # execution time is longer than xx us, as the threshold value
   -U, --user- Stack 
                        Show User Space # Stacks from user mode stack calls display information
   -K, --kernel- Stack 
                        Show Stacks from Kernel Space # call stack information display kernel mode
   -f Print Output in Folded stack # think the format can be considered for a flame FIG.
   -a aRGUMENTS, - arguments aRGUMENTS 
                        Print the this entry MANY arguments, parameters input print # AS hex, decimal installation way
   -T, - Time             show HH: MM: SS # display timestamp timestamp
   -t, --timestamp show timestamp in seconds the AT US Resolution # display a time stamp, in the form of seconds
  -v, --verbose Print at The BPF Program for the debugging Purposes # display the function call information

./funcslower c:open -u 1

1us delay the operation process open function to perform statistical system

./Funcslower c #: Open -u 1 
Tracing function Calls It would help Within last 1 US ... Ctrl + C # to quit. COMM represents instructions executed 
COMM PID LAT (US) RVAL FUNC 
less            27074     33.77                 3 c: Open 
 less            27074      9.96 C FFFFFFFFFFFFFFFF: Open 
 less            27 074      5.92 FFFFFFFFFFFFFFFF C: Open 
 less            27 074     15.88 FFFFFFFFFFFFFFFF C: Open 
 less            27 074      8.89                 . 3 C: Open 
 less            27074     15.89                 . 3 C: Open 
 SH              27075    20.97                4 c:open 
bash           27075    20.14                4 c:open 

Note that: fffffff appear above other content was open function returns the value RVAL operation fails, it returns -1;

./funcslower -m 10 vfs_read

Shows only processes vfs_read function call execution time of more than 10ms

Tracing function calls slower than 10 ms... Ctrl+C to quit.
COMM           PID    LAT(ms)             RVAL FUNC
bash           11527    78.97                1 vfs_read 
bash           11527   101.26                1 vfs_read 
bash           11527  1053.60                1 vfs_read 
bash           11527    44.21                1 vfs_read 

./funcslower __kmalloc -a 2 -u 1

Displaying the execution time of the operation process __kmalloc 1us, and prints out the first two parameters of the function passed to each process.

Tracing function calls slower than 1 us... Ctrl+C to quit.
COMM           PID    LAT(us)             RVAL FUNC ARGS
kworker/0:2    27077     7.46 ffff90054f9f8e40 __kmalloc 0x98 0x1400000
kworker/0:2    27077     6.84 ffff90054f9f8e40 __kmalloc 0x98 0x1400000
bash           11527     6.87 ffff90054f9f8e40 __kmalloc 0x90 0x1408240
bash           11527     1.15 ffff90054f9f8e40 __kmalloc 0x90 0x1408240
bash           11527     1.15 ffff90055a1b8c00 __kmalloc 0x2c 0x1400240
bash           11527     1.18 ffff90054b87d240 __kmalloc 0x1c 0x1400040

./funcslower -U -m 30 '/usr/sbin/nginx:database_write'

A function for tracking a certain type of special case inside the program execution time of more than 30ms process and print their user mode stack information.

Tracing function calls slower than 30 ms... Ctrl+C to quit.
COMM           PID    LAT(ms)             RVAL FUNC
nginx          1617     30.15                9 /usr/sbin/nginx:database_write
    DataBaseProvider::setData(std::string const&, record_s&)
    UserDataProvider::saveRecordData(RecordData const&)
    RequestProcessor::writeResponse(int)
    RequestProcessor::processRequest()
    RequestRouter::processRequest(RequestWrapper*, ResponseWrapper*)
    ngx_http_core_content_phase
    ngx_http_core_run_phases
    ngx_http_process_request
    ngx_process_events_and_timers
    ngx_spawn_process
    ngx_master_process_cycle
    main
    __libc_start_main
    [unknown]

Guess you like

Origin www.cnblogs.com/haoxing990/p/12153979.html