--- ksysguard.orig/gui/KSysGuardApplet.xml 2002-09-16 16:12:36.000000000 +0200 +++ ksysguard.orig/gui/KSysGuardApplet.xml 2005-04-07 21:30:58.000000000 +0200 @@ -6,6 +6,7 @@ + --- ksysguard.orig/gui/SystemLoad.sgrd 2002-08-15 18:10:58.000000000 +0200 +++ ksysguard.orig/gui/SystemLoad.sgrd 2005-04-07 21:30:58.000000000 +0200 @@ -6,6 +6,7 @@ + --- ksysguard.orig/gui/ksgrd/SensorManager.cc 2004-11-10 21:39:13.000000000 +0100 +++ ksysguard.orig/gui/ksgrd/SensorManager.cc 2005-04-07 21:30:58.000000000 +0200 @@ -48,10 +48,11 @@ // Fill the sensor description dictionary. mDict.insert( "cpu", new QString( i18n( "CPU Load" ) ) ); - mDict.insert( "idle", new QString( i18n( "Idle Load" ) ) ); - mDict.insert( "sys", new QString( i18n( "System Load" ) ) ); + mDict.insert( "idle", new QString( i18n( "Idling" ) ) ); mDict.insert( "nice", new QString( i18n( "Nice Load" ) ) ); + mDict.insert( "sys", new QString( i18n( "System Load" ) ) ); mDict.insert( "user", new QString( i18n( "User Load" ) ) ); + mDict.insert( "wait", new QString( i18n( "Waiting" ) ) ); mDict.insert( "mem", new QString( i18n( "Memory" ) ) ); mDict.insert( "physical", new QString( i18n( "Physical Memory" ) ) ); mDict.insert( "swap", new QString( i18n( "Swap Memory" ) ) ); --- ksysguard.orig/ksysguardd/Linux/stat.c 2004-08-09 20:49:39.000000000 +0200 +++ ksysguard.orig/ksysguardd/Linux/stat.c 2005-04-07 21:30:58.000000000 +0200 @@ -42,6 +42,7 @@ int niceLoad; int sysLoad; int idleLoad; + int waitLoad; /* To calculate the loads we need to remember the tick values for each * load type. */ @@ -49,6 +50,7 @@ unsigned long niceTicks; unsigned long sysTicks; unsigned long idleTicks; + unsigned long waitTicks; } CPULoadInfo; typedef struct @@ -144,29 +146,32 @@ static void updateCPULoad( const char* line, CPULoadInfo* load ) { - unsigned long currUserTicks, currSysTicks, currNiceTicks, currIdleTicks; - unsigned long totalTicks; + unsigned long currUserTicks, currSysTicks, currNiceTicks; + unsigned long currIdleTicks, currWaitTicks, totalTicks; - sscanf( line, "%*s %lu %lu %lu %lu", &currUserTicks, &currNiceTicks, - &currSysTicks, &currIdleTicks ); + sscanf( line, "%*s %lu %lu %lu %lu %lu", &currUserTicks, &currNiceTicks, + &currSysTicks, &currIdleTicks, &currWaitTicks ); totalTicks = ( currUserTicks - load->userTicks ) + ( currSysTicks - load->sysTicks ) + ( currNiceTicks - load->niceTicks ) + - ( currIdleTicks - load->idleTicks ); + ( currIdleTicks - load->idleTicks ) + + ( currWaitTicks - load->waitTicks ); if ( totalTicks > 10 ) { load->userLoad = ( 100 * ( currUserTicks - load->userTicks ) ) / totalTicks; load->sysLoad = ( 100 * ( currSysTicks - load->sysTicks ) ) / totalTicks; load->niceLoad = ( 100 * ( currNiceTicks - load->niceTicks ) ) / totalTicks; - load->idleLoad = ( 100 - ( load->userLoad + load->sysLoad + load->niceLoad ) ); + load->idleLoad = ( 100 * ( currIdleTicks - load->idleTicks ) ) / totalTicks; + load->waitLoad = ( 100 * ( currWaitTicks - load->waitTicks ) ) / totalTicks; } else - load->userLoad = load->sysLoad = load->niceLoad = load->idleLoad = 0; + load->userLoad = load->sysLoad = load->niceLoad = load->idleLoad = load->waitLoad = 0; load->userTicks = currUserTicks; load->sysTicks = currSysTicks; load->niceTicks = currNiceTicks; load->idleTicks = currIdleTicks; + load->waitTicks = currWaitTicks; } static int processDisk( char* tag, char* buf, const char* label, int idx ) @@ -550,9 +555,9 @@ void initStat( struct SensorModul* sm ) { /* The CPU load is calculated from the values in /proc/stat. The cpu - * entry contains 4 counters. These counters count the number of ticks + * entry contains 7 counters. These counters count the number of ticks * the system has spend on user processes, system processes, nice - * processes and idle time. + * processes, idle and IO-wait time, hard and soft interrupts. * * SMP systems will have cpu1 to cpuN lines right after the cpu info. The * format is identical to cpu and reports the information for each cpu. @@ -560,7 +565,7 @@ * * The /proc/stat file looks like this: * - * cpu 1586 4 808 36274 + * cpu * disk 7797 0 0 0 * disk_rio 6889 0 0 0 * disk_wio 908 0 0 0 @@ -606,6 +611,7 @@ registerMonitor( "cpu/nice", "integer", printCPUNice, printCPUNiceInfo, StatSM ); registerMonitor( "cpu/sys", "integer", printCPUSys, printCPUSysInfo, StatSM ); registerMonitor( "cpu/idle", "integer", printCPUIdle, printCPUIdleInfo, StatSM ); + registerMonitor( "cpu/wait", "integer", printCPUWait, printCPUWaitInfo, StatSM ); } else if ( strncmp( "cpu", tag, 3 ) == 0 ) { char cmdName[ 24 ]; /* Load for each SMP CPU */ @@ -621,6 +627,8 @@ registerMonitor( cmdName, "integer", printCPUxSys, printCPUxSysInfo, StatSM ); sprintf( cmdName, "cpu%d/idle", id ); registerMonitor( cmdName, "integer", printCPUxIdle, printCPUxIdleInfo, StatSM ); + sprintf( cmdName, "cpu%d/wait", id ); + registerMonitor( cmdName, "integer", printCPUxWait, printCPUxWaitInfo, StatSM ); } else if ( strcmp( "disk", tag ) == 0 ) { unsigned long val; char* b = buf + 5; @@ -853,6 +861,22 @@ fprintf( CurrentClient, "CPU Idle Load\t0\t100\t%%\n" ); } +void printCPUWait( const char* cmd ) +{ + (void)cmd; + + if ( Dirty ) + processStat(); + + fprintf( CurrentClient, "%d\n", CPULoad.waitLoad ); +} + +void printCPUWaitInfo( const char* cmd ) +{ + (void)cmd; + fprintf( CurrentClient, "CPU Wait Load\t0\t100\t%%\n" ); +} + void printCPUxUser( const char* cmd ) { int id; @@ -929,6 +953,25 @@ fprintf( CurrentClient, "CPU%d Idle Load\t0\t100\t%%\n", id ); } +void printCPUxWait( const char* cmd ) +{ + int id; + + if ( Dirty ) + processStat(); + + sscanf( cmd + 3, "%d", &id ); + fprintf( CurrentClient, "%d\n", SMPLoad[ id ].waitLoad ); +} + +void printCPUxWaitInfo( const char* cmd ) +{ + int id; + + sscanf( cmd + 3, "%d", &id ); + fprintf( CurrentClient, "CPU%d Wait Load\t0\t100\t%%\n", id ); +} + void printDiskTotal( const char* cmd ) { int id; --- ksysguard.orig/ksysguardd/Linux/stat.h 2004-02-24 12:30:17.000000000 +0100 +++ ksysguard.orig/ksysguardd/Linux/stat.h 2005-04-07 21:30:58.000000000 +0200 @@ -34,6 +34,8 @@ void printCPUSysInfo( const char* ); void printCPUIdle( const char* ); void printCPUIdleInfo( const char* ); +void printCPUWait( const char* ); +void printCPUWaitInfo( const char* ); void printCPUxUser( const char* ); void printCPUxUserInfo( const char* ); void printCPUxNice( const char* ); @@ -42,6 +44,8 @@ void printCPUxSysInfo( const char* ); void printCPUxIdle( const char* ); void printCPUxIdleInfo( const char* ); +void printCPUxWait( const char* ); +void printCPUxWaitInfo( const char* ); void printDiskTotal( const char* ); void printDiskTotalInfo( const char* ); void printDiskRIO( const char* );