funccount bcc-tools of the tool

As can be seen from the literal meaning funccount, its role is to count the number of times the function is called.

BS, look at the help information

Usage: funccount [-H] [-p the PID] [-i the INTERVAL] [-d DURATION] [-T] [-R & lt] [- D] 
                    pattern 

the Count Functions, tracepoints, and USDT Probes 

Positional arguments: 
  pattern expression The Search for Events 

optional arguments The:
   -h, - Help Exit Show the this and the Message Help
   -p PID, - pid PID # only the trace only the this PID to track a process calls the situation
   -i iNTERVAL, - interval The iNTERVAL # How long intervals Print time tracking results 
                        the Summary interval The, seconds The
   -d dURATION, - dURATION dURATION # tracking how long the unit is MS 
                        Total dURATION of the trace, seconds The
   -T, -timestamp include timestamp on output # presentation time stamp
   -R & lt, --regexp use Regular Expressions. IS the Default " * " wildcards to # trace function for a certain category, the symbol * may be employed matching rules 
                        only.
   -D, --debug Print the BPF the before Starting Program ( for the debugging # show debugging information tracking 
                        purposes)

./funccount 'vfs_*'

Class function is used to display the number of calls vfs_ *

Tracing... Ctrl-C to end.
^C
FUNC                          COUNT
vfs_create                        1
vfs_rename                        1
vfs_fsync_range                   2
vfs_lock_file                    30
vfs_fstatat                     152
vfs_fstat                       154
vfs_write                       166
vfs_getattr_nosec               262

./funccount 'tcp_*'

The number of function calls used to display tcp class

Tracing... Ctrl-C to end.
^C
FUNC                          COUNT
tcp_try_undo_recovery             1
tcp_twsk_destructor               1
tcp_enter_recovery                1
tcp_xmit_retransmit_queue         1
tcp_update_scoreboard             1
tcp_verify_retransmit_hint        1

./funccount -p 1442 /home/ubuntu/contentions:*

All functions of the number of 1442 calls for tracking process contentions

Tracing 15 functions for "/home/ubuntu/contentions:*"... Hit Ctrl-C to end.
^C
FUNC                                           COUNT
main                                               1
_start                                             1
primes_thread                                      2
insert_result                                  87186
is_prime                                     1252772

./funccount -r 'c:(write|read)$'

Call tracking user state of dynamic libraries write and read

If the user mode function to match certain rules, then need to add the letter 'c', c indicates that the individual is libc.

Tracing 2 functions for "c:(write|read)$"... Hit Ctrl-C to end.
^C
FUNC                                    COUNT
read                                        2
write                                       4

./funccount t:block:*

Used to track the number of calls kernel mode, block-based functions, t denotes tracepoint

Tracing 19 functions for "t:block:*"... Hit Ctrl-C to end.
^C
FUNC                                    COUNT
block:block_rq_complete                     7
block:block_rq_issue                        7
block:block_getrq                           7
block:block_rq_insert                       7

./funccount u:pthread:*mutex* -p 1442

Thread thread used to track the number of calls in 1442 to use mutex class correlation function

Tracing 7 functions for "u:pthread:*mutex*"... Hit Ctrl-C to end.
^C
FUNC                                    COUNT
mutex_init                                  1
mutex_entry                            547122
mutex_acquired                         547175
mutex_release                          547185

Where u represents a user mode.

./funccount -i 1 'vfs_*'

Every second time tracking function class vfs_ *

FUNC                          COUNT
vfs_fstatat                       1
vfs_fstat                        16
vfs_getattr_nosec                17
vfs_getattr                      17
vfs_write                        52
vfs_read                         79
vfs_open                         98

FUNC                          COUNT
vfs_fstatat                      10

./funccount -i 1 -d 5 vfs_read 

1s print every time tracking results for 5s, print a total of five times 5s represented

Tracing 1 functions for "vfs_read"... Hit Ctrl-C to end.

FUNC                                    COUNT
vfs_read                                   30

FUNC                                    COUNT
vfs_read                                   26

FUNC                                    COUNT
vfs_read                                   54

FUNC                                    COUNT
vfs_read                                   25

FUNC                                    COUNT
vfs_read                                   31

But if you remove the '-i 1', then it is to track the total time lasted only 5s

 

user-mode statically defined traces (USDT)

Guess you like

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