Ankita
Ankita

Reputation: 11

Information about perf block events

I need information about following block(disk I/O) events available in perf. Can you tell me where will I get detail information about each event?

  block:block_bio_backmerge                          
  block:block_bio_bounce                            
  block:block_bio_complete                          
  block:block_bio_frontmerge                         
  block:block_bio_queue                              
  block:block_bio_remap                            
  block:block_dirty_buffer                           
  block:block_getrq                                
  block:block_plug                                  
  block:block_rq_complete                           
  block:block_rq_insert                             
  block:block_rq_issue                              
  block:block_rq_remap                               
  block:block_rq_requeue                             
  block:block_sleeprq                                
  block:block_split                                 
  block:block_touch_buffer                           
  block:block_unplug

Please help me with this.

Upvotes: 1

Views: 1920

Answers (1)

Arnabjyoti Kalita
Arnabjyoti Kalita

Reputation: 2431

As @osgx has already mentioned these are software tracepoint events, among the many pre-defined set of tracepoint events in the kernel sources which can be seen when you run -

sudo perf list | grep Tracepoint

The block based tracepoint events can give a fine detail of what the storage devices are doing when you run certain commands.

sudo perf record -e block:block_rq_complete -a sleep 10
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 1.412 MB perf.data (340 samples) ]

The block_rq_complete tracepoint traces I/O requests that have completed, either fully or partially.

sudo perf script
         swapper     0 [006] 205791.409875: block:block_rq_complete: 8,16 RM () 390439208 + 8 [0]
         swapper     0 [006] 205791.410439: block:block_rq_complete: 8,16 RM () 390439256 + 8 [0]
          chrome  9526 [006] 205793.149462: block:block_rq_complete: 8,16 W () 424979920 + 8 [0]
          chrome  9526 [006] 205793.149781: block:block_rq_complete: 8,16 W () 490387000 + 352 [0]
         swapper     0 [006] 205794.547686: block:block_rq_complete: 8,16 WS () 432636024 + 1344 [0]
         swapper     0 [006] 205794.558292: block:block_rq_complete: 8,16 WS () 432637368 + 1344 [0]
         swapper     0 [006] 205794.566718: block:block_rq_complete: 8,16 WS () 432638712 + 544 [0]
         swapper     0 [006] 205794.599791: block:block_rq_complete: 8,16 FF () 18446744073709551615 + 0 [0]
         swapper     0 [006] 205794.599868: block:block_rq_complete: 8,16 WS () 432639256 + 8 [0]
         swapper     0 [006] 205794.600792: block:block_rq_complete: 8,16 FF () 18446744073709551615 + 0 [0]
         swapper     0 [006] 205794.600798: block:block_rq_complete: 8,16 WS () 432639256 + 0 [0]
         swapper     0 [006] 205798.268989: block:block_rq_complete: 8,16 W () 462924840 + 8 [0]
         swapper     0 [006] 205798.269079: block:block_rq_complete: 8,16 W () 462934720 + 8 [0]
         swapper     0 [006] 205798.269118: block:block_rq_complete: 8,16 W () 462934752 + 8 [0]
         swapper     0 [006] 205798.269158: block:block_rq_complete: 8,16 W () 462935416 + 8 [0]
         swapper     0 [006] 205798.269195: block:block_rq_complete: 8,16 W () 462935592 + 8 [0]
         swapper     0 [006] 205798.269241: block:block_rq_complete: 8,16 W () 476143872 + 8 [0]
         swapper     0 [006] 205798.269265: block:block_rq_complete: 8,16 W () 476144624 + 8 [0]
         swapper     0 [006] 205798.269283: block:block_rq_complete: 8,16 W () 476145360 + 8 [0]

The first 5 columns of the output are well understood - (process name/command, pid, CPU, timestamp, event name for which sampling was done), so we'll start with the 6th column onwards -

8,16 refers to the major and minor number of the device.

ls -l /dev/sdb
brw-rw---- 1 root disk 8, 16 Apr  8 07:52 /dev/sdb

Characters R,W,B,S,F describe the I/O operation being performed, where 'R' refers to Read, 'W' refers to Write, 'D' refers to discard block, 'M' refers to metadata, 'S' refers to synchronous and 'F' refers to flush.

The numbers following the empty brackets () refer to the offset from the start of the device where the I/O operation was done and the number of completed sectors of I/O.

[0] indicates the number of errors.

Some level of information about most of the other events can be obtained here - block events summary

Note that, the APIs for these events keep changing and could be different for the linux kernel you are using. I have attached the summary for kernel version 5.6.

Upvotes: 5

Related Questions