[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/workspace/ksysguard/ksysguardd
From:       John Tapsell <john.tapsell () kdemail ! net>
Date:       2009-11-24 9:14:02
Message-ID: 1259054042.888603.31435.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1053466 by johnflux:

Reduce update interval to 1/10th of a second instead of 1 second


 M  +8 -6      Command.c  
 M  +2 -5      ksysguardd.h  
 M  +1 -1      modules.h  


--- trunk/KDE/kdebase/workspace/ksysguard/ksysguardd/Command.c #1053465:1053466
@@ -25,6 +25,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <syslog.h>
+#include <sys/time.h>
 
 #include "ccont.h"
 #include "ksysguardd.h"
@@ -254,12 +255,13 @@
 
   for ( cmd = first_ctnr( CommandList ); cmd; cmd = next_ctnr( CommandList ) ) {
     if ( strncmp( cmd->command, command, lengthOfCommand ) == 0 && \
                cmd->command[lengthOfCommand] == 0) {
-      if ( cmd->isMonitor ) {
-        if ( ( time( NULL ) - cmd->sm->time ) >= UPDATEINTERVAL ) {
-          cmd->sm->time = time( NULL );
-
-          if ( cmd->sm->updateCommand != NULL )
-            cmd->sm->updateCommand();
+      if ( cmd->isMonitor && cmd->sm->updateCommand != NULL) {
+        struct timeval currentTime;
+        gettimeofday(&currentTime,NULL);
+        unsigned long long timeCentiSeconds = (unsigned long long)currentTime.tv_sec \
* 10 + currentTime.tv_usec / 100000; +        if ( timeCentiSeconds - \
cmd->sm->timeCentiSeconds >= UPDATEINTERVAL ) { +          cmd->sm->timeCentiSeconds \
= timeCentiSeconds; +          cmd->sm->updateCommand();
         }
       }
 
--- trunk/KDE/kdebase/workspace/ksysguard/ksysguardd/ksysguardd.h #1053465:1053466
@@ -27,12 +27,9 @@
 /* This is the official ksysguardd port assigned by IANA. */
 #define PORT_NUMBER	3112
 
-/* Timer interval for running updateCommand on modiles that support it */
+/* Timer interval in centi-seconds  (1/10th of a second) for running updateCommand \
on modules that support it */  #define UPDATEINTERVAL	1
 
-/* Timer interval for running checkCommand on modules that support it */
-#define TIMERINTERVAL	1
-
 extern int RunAsDaemon;
 extern int QuitApp;
 
@@ -46,7 +43,7 @@
   int (*updateCommand)( void );
   void (*checkCommand)( void );
   int available;
-  time_t time;
+  unsigned long long timeCentiSeconds;
 };
 
 char* escapeString( char* string );
--- trunk/KDE/kdebase/workspace/ksysguard/ksysguardd/modules.h #1053465:1053466
@@ -109,7 +109,7 @@
 #define NULLVVFUNC ((VVFunc) 0)
 typedef int (*IVFunc)( void );
 #define NULLIVFUNC ((IVFunc) 0)
-#define NULLTIME ((time_t) 0)
+#define NULLTIME ((unsigned long long) 0)
 
 struct SensorModul SensorModulList[] = {
 #ifdef OSTYPE_Linux


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic