From kde-commits Thu Jul 31 22:26:40 2008 From: John Tapsell Date: Thu, 31 Jul 2008 22:26:40 +0000 To: kde-commits Subject: KDE/kdebase/workspace/ksysguard/ksysguardd/Linux Message-Id: <1217543200.862148.15948.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=121754320729973 SVN commit 840353 by johnflux: Use KB and KB/s to have consistancy in units M +14 -4 netdev.c M +14 -14 stat.c --- trunk/KDE/kdebase/workspace/ksysguard/ksysguardd/Linux/netdev.c #840352:840353 @@ -68,7 +68,7 @@ /* The sixth variable is 1 if the quantity variation must be provided, 0 if the absolute value must be provided */ #define FORALL( a ) \ - a( recBytes, "receiver/data", "Received Data", "kBytes/s", 1024, 1) \ + a( recBytes, "receiver/data", "Received Data", "KB/s", 1024, 1) \ a( recPacks, "receiver/packets", "Received Packets", "1/s", 1, 1 ) \ a( recErrs, "receiver/errors", "Receiver Errors", "1/s", 1, 1 ) \ a( recDrop, "receiver/drops", "Receiver Drops", "1/s", 1, 1 ) \ @@ -76,7 +76,7 @@ a( recFrame, "receiver/frame", "Receiver Frame Errors", "1/s", 1, 1 ) \ a( recCompressed, "receiver/compressed", "Received Compressed Packets", "1/s", 1, 1 ) \ a( recMulticast, "receiver/multicast", "Received Multicast Packets", "1/s", 1, 1 ) \ - a( sentBytes, "transmitter/data", "Sent Data", "kBytes/s", 1024, 1 ) \ + a( sentBytes, "transmitter/data", "Sent Data", "KB/s", 1024, 1 ) \ a( sentPacks, "transmitter/packets", "Sent Packets", "1/s", 1, 1 ) \ a( sentErrs, "transmitter/errors", "Transmitter Errors", "1/s", 1, 1 ) \ a( sentDrop, "transmitter/drops", "Transmitter Drops", "1/s", 1, 1 ) \ @@ -474,8 +474,18 @@ \ void printNetDev##a##Info( const char* cmd ) \ { \ - (void)cmd; \ - fprintf( CurrentClient, "%s\t0\t0\t%s\n", c, d ); \ + int i; \ + char* beg; \ + char* end; \ + char dev[ 64 ]; \ + \ + beg = strchr( cmd, '/' ); \ + beg = strchr( beg + 1, '/' ); \ + end = strchr( beg + 1, '/' ); \ + strncpy( dev, beg + 1, end - beg - 1 ); \ + dev[ end - beg - 1 ] = '\0'; \ +\ + fprintf( CurrentClient, "%s %s\t0\t0\t%s\n", dev, c, d ); \ } FORALL( PRINTFUNC ) --- trunk/KDE/kdebase/workspace/ksysguard/ksysguardd/Linux/stat.c #840352:840353 @@ -782,9 +782,9 @@ void printCPUxUserInfo( const char* cmd ) { int id; - + sscanf( cmd + 7, "%d", &id ); - fprintf( CurrentClient, "CPU%d User Load\t0\t100\t%%\n", id ); + fprintf( CurrentClient, "CPU %d User Load\t0\t100\t%%\n", id ); } void printCPUxNice( const char* cmd ) { @@ -801,7 +801,7 @@ int id; sscanf( cmd + 7, "%d", &id ); - fprintf( CurrentClient, "CPU%d Nice Load\t0\t100\t%%\n", id ); + fprintf( CurrentClient, "CPU %d Nice Load\t0\t100\t%%\n", id ); } void printCPUxSys( const char* cmd ) { @@ -818,7 +818,7 @@ int id; sscanf( cmd + 7, "%d", &id ); - fprintf( CurrentClient, "CPU%d System Load\t0\t100\t%%\n", id ); + fprintf( CurrentClient, "CPU %d System Load\t0\t100\t%%\n", id ); } void printCPUxTotalLoad( const char* cmd ) { @@ -835,7 +835,7 @@ int id; sscanf( cmd + 7, "%d", &id ); - fprintf( CurrentClient, "CPU%d Total Load\t0\t100\t%%\n", id ); + fprintf( CurrentClient, "CPU %d Total Load\t0\t100\t%%\n", id ); } void printCPUxIdle( const char* cmd ) { @@ -852,7 +852,7 @@ int id; sscanf( cmd + 7, "%d", &id ); - fprintf( CurrentClient, "CPU%d Idle Load\t0\t100\t%%\n", id ); + fprintf( CurrentClient, "CPU %d Idle Load\t0\t100\t%%\n", id ); } void printCPUxWait( const char* cmd ) @@ -871,7 +871,7 @@ int id; sscanf( cmd + 7, "%d", &id ); - fprintf( CurrentClient, "CPU%d Wait Load\t0\t100\t%%\n", id ); + fprintf( CurrentClient, "CPU %d Wait Load\t0\t100\t%%\n", id ); } void print24DiskTotal( const char* cmd ) { @@ -889,7 +889,7 @@ int id; sscanf( cmd + 9, "%d", &id ); - fprintf( CurrentClient, "Disk%d Total Load\t0\t0\tkBytes/s\n", id ); + fprintf( CurrentClient, "Disk %d Total Load\t0\t0\tKB/s\n", id ); } void print24DiskRIO( const char* cmd ) { @@ -907,7 +907,7 @@ int id; sscanf( cmd + 9, "%d", &id ); - fprintf( CurrentClient, "Disk%d Read\t0\t0\tkBytes/s\n", id ); + fprintf( CurrentClient, "Disk %d Read\t0\t0\tKB/s\n", id ); } void print24DiskWIO( const char* cmd ) { @@ -925,7 +925,7 @@ int id; sscanf( cmd + 9, "%d", &id ); - fprintf( CurrentClient, "Disk%d Write\t0\t0\tkBytes/s\n", id ); + fprintf( CurrentClient, "Disk %d Write\t0\t0\tKB/s\n", id ); } void print24DiskRBlk( const char* cmd ) { @@ -943,7 +943,7 @@ int id; sscanf( cmd + 9, "%d", &id ); - fprintf( CurrentClient, "Disk%d Read Data\t0\t0\tkBytes/s\n", id ); + fprintf( CurrentClient, "Disk %d Read Data\t0\t0\tKB/s\n", id ); } void print24DiskWBlk( const char* cmd ) { @@ -961,7 +961,7 @@ int id; sscanf( cmd + 9, "%d", &id ); - fprintf( CurrentClient, "Disk%d Write Data\t0\t0\tkBytes/s\n", id ); + fprintf( CurrentClient, "Disk %d Write Data\t0\t0\tKB/s\n", id ); } void printPageIn( const char* cmd ) { @@ -1095,10 +1095,10 @@ fprintf( CurrentClient, "Write data device %s (%d:%d)\t0\t0\t1/s\n", devname, major, minor ); else if ( strcmp( name, "rblk" ) == 0 ) - fprintf( CurrentClient, "Read accesses device %s (%d:%d)\t0\t0\tkBytes/s\n", + fprintf( CurrentClient, "Read accesses device %s (%d:%d)\t0\t0\tKB/s\n", devname, major, minor ); else if ( strcmp( name, "wblk" ) == 0 ) - fprintf( CurrentClient, "Write accesses device %s (%d:%d)\t0\t0\tkBytes/s\n", + fprintf( CurrentClient, "Write accesses device %s (%d:%d)\t0\t0\tKB/s\n", devname, major, minor ); else { fprintf( CurrentClient, "Dummy\t0\t0\t\n" );