MCPcopy Create free account
hub / github.com/audacity/audacity / displayLinuxIoStats

Function displayLinuxIoStats

lib-src/sqlite/shell.c:12679–12708  ·  view source on GitHub ↗

** Attempt to display I/O stats on Linux using /proc/PID/io */

Source from the content-addressed store, hash-verified

12677** Attempt to display I/O stats on Linux using /proc/PID/io
12678*/
12679static void displayLinuxIoStats(FILE *out){
12680 FILE *in;
12681 char z[200];
12682 sqlite3_snprintf(sizeof(z), z, "/proc/%d/io", getpid());
12683 in = fopen(z, "rb");
12684 if( in==0 ) return;
12685 while( fgets(z, sizeof(z), in)!=0 ){
12686 static const struct {
12687 const char *zPattern;
12688 const char *zDesc;
12689 } aTrans[] = {
12690 { "rchar: ", "Bytes received by read():" },
12691 { "wchar: ", "Bytes sent to write():" },
12692 { "syscr: ", "Read() system calls:" },
12693 { "syscw: ", "Write() system calls:" },
12694 { "read_bytes: ", "Bytes read from storage:" },
12695 { "write_bytes: ", "Bytes written to storage:" },
12696 { "cancelled_write_bytes: ", "Cancelled write bytes:" },
12697 };
12698 int i;
12699 for(i=0; i<ArraySize(aTrans); i++){
12700 int n = strlen30(aTrans[i].zPattern);
12701 if( strncmp(aTrans[i].zPattern, z, n)==0 ){
12702 utf8_printf(out, "%-36s %s", aTrans[i].zDesc, &z[n]);
12703 break;
12704 }
12705 }
12706 }
12707 fclose(in);
12708}
12709#endif
12710
12711/*

Callers 1

display_statsFunction · 0.85

Calls 2

strlen30Function · 0.85
utf8_printfFunction · 0.85

Tested by

no test coverage detected