mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-12 12:14:36 +03:00
Adds support for linux delay accounting (#667)
Adds support for showing columns with linux delay accounting. This information can be read from the netlink interface, and thus we set up a socket to read from that when initializing the LinuxProcessList (LinuxProcessList_initNetlinkSocket). After that, for each process we call LinuxProcessList_readDelayAcctData, which sends a message thru the socket after setting up a callback to get the answer from the Kernel. That callback sets the process total delay time attribute. We then set the delay percent as the percentage of time process cpu time since last scan.
This commit is contained in:

committed by
Hisham Muhammad

parent
52831955c7
commit
b7b66b76a5
@ -73,7 +73,12 @@ typedef enum LinuxProcessFields {
|
||||
#endif
|
||||
OOM = 114,
|
||||
IO_PRIORITY = 115,
|
||||
LAST_PROCESSFIELD = 116,
|
||||
#ifdef HAVE_DELAYACCT
|
||||
PERCENT_CPU_DELAY = 116,
|
||||
PERCENT_IO_DELAY = 117,
|
||||
PERCENT_SWAP_DELAY = 118,
|
||||
#endif
|
||||
LAST_PROCESSFIELD = 119,
|
||||
} LinuxProcessField;
|
||||
|
||||
#include "IOPriority.h"
|
||||
@ -117,6 +122,15 @@ typedef struct LinuxProcess_ {
|
||||
#endif
|
||||
unsigned int oom;
|
||||
char* ttyDevice;
|
||||
#ifdef HAVE_DELAYACCT
|
||||
unsigned long long int delay_read_time;
|
||||
unsigned long long cpu_delay_total;
|
||||
unsigned long long blkio_delay_total;
|
||||
unsigned long long swapin_delay_total;
|
||||
float cpu_delay_percent;
|
||||
float blkio_delay_percent;
|
||||
float swapin_delay_percent;
|
||||
#endif
|
||||
} LinuxProcess;
|
||||
|
||||
#ifndef Process_isKernelThread
|
||||
@ -152,6 +166,10 @@ IOPriority LinuxProcess_updateIOPriority(LinuxProcess* this);
|
||||
|
||||
bool LinuxProcess_setIOPriority(LinuxProcess* this, IOPriority ioprio);
|
||||
|
||||
#ifdef HAVE_DELAYACCT
|
||||
void LinuxProcess_printDelay(float delay_percent, char* buffer, int n);
|
||||
#endif
|
||||
|
||||
void LinuxProcess_writeField(Process* this, RichString* str, ProcessField field);
|
||||
|
||||
long LinuxProcess_compare(const void* v1, const void* v2);
|
||||
|
Reference in New Issue
Block a user