tud-zih-energy / lo2s

Linux OTF2 Sampling - A Lightweight Node-Level Performance Monitoring Tool
https://tu-dresden.de/zih/forschung/projekte/lo2s?set_language=en
GNU General Public License v3.0
45 stars 13 forks source link

Handle block I/O events that are not reads or writes #252

Open cvonelm opened 1 year ago

cvonelm commented 1 year ago

Besides events that indicate the start and end of read and write operations, the block I/O subsystem gives out information about additional events, such as hard drive buffer cache flushes and so on.

Currently, those get ignored by lo2s because they , depending on the disk type, seldomly, if ever, occur. However, it would still be nice to be able to measure them.

cvonelm commented 1 year ago

This is all the information the kernel gives us about events

 static void fill_rwbs(char *rwbs, const struct blk_io_trace *t)
 {
     int i = 0;
     int tc = t->action >> BLK_TC_SHIFT;

     if ((t->action & ~__BLK_TN_CGROUP) == BLK_TN_MESSAGE) {
         rwbs[i++] = 'N';
         goto out;
     }

     if (tc & BLK_TC_FLUSH)
         rwbs[i++] = 'F';

     if (tc & BLK_TC_DISCARD) 
         rwbs[i++] = 'D';
     else if (tc & BLK_TC_WRITE)
         rwbs[i++] = 'W';
     else if (t->bytes) 
         rwbs[i++] = 'R'; 
     else
         rwbs[i++] = 'N';

     if (tc & BLK_TC_FUA)
         rwbs[i++] = 'F';
     if (tc & BLK_TC_AHEAD)
         rwbs[i++] = 'A';
     if (tc & BLK_TC_SYNC)
         rwbs[i++] = 'S';
     if (tc & BLK_TC_META)
         rwbs[i++] = 'M';
 out:
     rwbs[i] = '\0';
 }

R and W are read and write respectively.

N is none, so it can be safely discarded

F is flushes, which can be mapped to the flush type otf2 provides. FUA (force unit access) is a more fine-grained flush, so it can be mapped to flush too.

D is for discard. Solid state drives need to know which blocks are not in use currently to be able to do wear levelling. However, this operation does not map to any otf2 concept

A is for readahead. This would be really nice to be able to measure, but there is no nice otf2 concept this maps to and secondly I have not encountered this event type yet

S is for synchronous operation and M for metadata. I haven't encountered those types either.