Changeset: 9da1b00d322e for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9da1b00d322e
Modified Files:
        monetdb5/mal/mal_profiler.c
Branch: holindex
Log Message:

Make sure cpu load is between 0 and 100.


diffs (31 lines):

diff --git a/monetdb5/mal/mal_profiler.c b/monetdb5/mal/mal_profiler.c
--- a/monetdb5/mal/mal_profiler.c
+++ b/monetdb5/mal/mal_profiler.c
@@ -1323,6 +1323,7 @@ static int getCPULoad(char cpuload[BUFSI
 // Give users the option to check for the system load between two heart beats
 void HeartbeatCPUload_total(void *arg)
 {
+       lng load;
        char cpuload[BUFSIZ];
        FILE *ofp;
        char *outputFilename1 = getenv("TOTAL_CPULOAD");
@@ -1341,7 +1342,9 @@ void HeartbeatCPUload_total(void *arg)
 
        while(1){
                (void) getCPULoad(cpuload);
-               fprintf(ofp,"%lf\n",corestat[256].load);
+               load = corestat[256].load;
+               if ( load >= 0 && load <= 100.0)
+                       fprintf(ofp,"%lf\n",corestat[256].load);
                MT_sleep_ms(10);
        }
        fclose(ofp);
@@ -1373,7 +1376,7 @@ void HeartbeatCPUload(void *arg)
                while(1){
                        (void) getCPULoad(cpuload);
                        load = corestat[256].load;
-                       if ( load > 0 && load < threshold){
+                       if ( load >= 0 && load <= 100.0 && load < threshold){
                                N = (int) (load * max_threads) / 100.0;
                                n = max_threads - N;
                                MRschedule(n, NULL, IdleFunc);
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to