Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 55859 Details for
Bug 88581
adding wait-cycles sensor to KSysGuard [patch attached]
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
adds wait-cycles sensor to KSysGuard
ksysguard-cpuwait.patch (text/plain), 9.08 KB, created by
Benno Schulenberg
on 2005-04-10 05:43:18 UTC
(
hide
)
Description:
adds wait-cycles sensor to KSysGuard
Filename:
MIME Type:
Creator:
Benno Schulenberg
Created:
2005-04-10 05:43:18 UTC
Size:
9.08 KB
patch
obsolete
>!! Adds a CPU-wait-cycles sensor to KSysGuard, and displays it by default in purple. >!! >!! Written and GPL-ed by Benno Schulenberg, April 2005. >!! >diff -ur ksysguard.orig/gui/KSysGuardApplet.xml ksysguard/gui/KSysGuardApplet.xml >--- ksysguard.orig/gui/KSysGuardApplet.xml 2002-09-16 16:12:36.000000000 +0200 >+++ ksysguard/gui/KSysGuardApplet.xml 2005-04-07 21:30:58.000000000 +0200 >@@ -6,6 +6,7 @@ > <beam sensorName="cpu/user" hostName="localhost" color="1608191" sensorType="integer" /> > <beam sensorName="cpu/sys" hostName="localhost" color="16743688" sensorType="integer" /> > <beam sensorName="cpu/nice" hostName="localhost" color="16771600" sensorType="integer" /> >+ <beam sensorName="cpu/wait" hostName="localhost" color="16764927" sensorType="integer" /> > </display> > <display topBar="1" vColor="4605510" title="Mem" dock="1" bColor="3223601" graphStyle="0" class="FancyPlotter" unit="" hScale="5" showUnit="0" hLines="1" hCount="2" vLines="0" autoRange="1" min="0" max="0" hColor="14606046" globalUpdate="1" pause="0" fontSize="8" labels="0" vScroll="1" vDistance="30" > > <beam sensorName="mem/physical/application" hostName="localhost" color="1608191" sensorType="integer" /> >diff -ur ksysguard.orig/gui/SystemLoad.sgrd ksysguard/gui/SystemLoad.sgrd >--- ksysguard.orig/gui/SystemLoad.sgrd 2002-08-15 18:10:58.000000000 +0200 >+++ ksysguard/gui/SystemLoad.sgrd 2005-04-07 21:30:58.000000000 +0200 >@@ -6,6 +6,7 @@ > <beam sensorName="cpu/user" hostName="localhost" color="1608191" sensorType="integer" /> > <beam sensorName="cpu/sys" hostName="localhost" color="16743688" sensorType="integer" /> > <beam sensorName="cpu/nice" hostName="localhost" color="16771600" sensorType="integer" /> >+ <beam sensorName="cpu/wait" hostName="localhost" color="16764927" sensorType="integer" /> > </display> > <display topBar="0" vColor="326429" title="Load Average (1 min)" bColor="3223601" graphStyle="0" class="FancyPlotter" row="0" unit="" hScale="1" column="1" showUnit="0" hLines="1" hCount="5" vLines="1" autoRange="1" min="0" max="0" hColor="326429" globalUpdate="1" pause="0" fontSize="9" labels="1" vScroll="1" vDistance="30" > > <beam sensorName="cpu/loadavg1" hostName="localhost" color="1608191" sensorType="float" /> >diff -ur ksysguard.orig/gui/ksgrd/SensorManager.cc ksysguard/gui/ksgrd/SensorManager.cc >--- ksysguard.orig/gui/ksgrd/SensorManager.cc 2004-11-10 21:39:13.000000000 +0100 >+++ ksysguard/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" ) ) ); >diff -ur ksysguard.orig/ksysguardd/Linux/stat.c ksysguard/ksysguardd/Linux/stat.c >--- ksysguard.orig/ksysguardd/Linux/stat.c 2004-08-09 20:49:39.000000000 +0200 >+++ ksysguard/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 <user> <nice> <system> <idling> <waiting> <hardinterrupt> <softinterrupt> > * 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; >diff -ur ksysguard.orig/ksysguardd/Linux/stat.h ksysguard/ksysguardd/Linux/stat.h >--- ksysguard.orig/ksysguardd/Linux/stat.h 2004-02-24 12:30:17.000000000 +0100 >+++ ksysguard/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* );
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 88581
: 55859