Enlightenment CVS committal

Author  : morlenxus
Project : e_modules
Module  : cpu

Dir     : e_modules/cpu


Modified Files:
        e_mod_main.c 


Log Message:
Now this bug seems to exist since a while:
If you change the update interval from 1s to something other,
the difference between the old cpu time and the current cpu time needs to
divided by the update interval.
I also added this to the freebsd part but can't test it - hope it works.

===================================================================
RCS file: /cvs/e/e_modules/cpu/e_mod_main.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -3 -r1.27 -r1.28
--- e_mod_main.c        17 Sep 2006 13:18:12 -0000      1.27
+++ e_mod_main.c        27 Sep 2006 21:05:48 -0000      1.28
@@ -47,6 +47,7 @@
 
 static int cpu_count;
 static int cpu_stats[4];
+static float update_interval;
 
 static const E_Gadcon_Client_Class _gc_class = 
 {
@@ -155,12 +156,16 @@
      {
        ci = l->data;
        if (!ci->id) continue;
-       if (!strcmp(ci->id, id)) return ci;
+       if (!strcmp(ci->id, id))
+         {  update_interval = ci->interval;
+            return ci;
+         }
      }
 
    ci = E_NEW(Config_Item, 1);
    ci->id = evas_stringshare_add(id);
    ci->interval = 1;
+   update_interval = ci->interval;
    
    cpu_conf->items = evas_list_append(cpu_conf->items, ci);
    return ci;
@@ -245,7 +250,7 @@
    new_used = cp_time[CP_USER] + cp_time[CP_NICE] + cp_time[CP_SYS];
    new_tot = new_used + cp_time[CP_IDLE];
 
-   cpu_stats[0] = 100 * (float)(new_used - old_used) / (float)(new_tot - 
old_tot);
+   cpu_stats[0] = (100 * (float)(new_used - old_used) / (float)(new_tot - 
old_tot)) / update_interval;
 
    old_tot = new_tot;
    old_used = new_used; 
@@ -287,7 +292,7 @@
             tmp_s = ((new_s - old_s[i]));
          }
        
-       cpu_stats[i] = (tmp_u + tmp_n + tmp_s);
+       cpu_stats[i] = (tmp_u + tmp_n + tmp_s) / update_interval;
 
        old_u[i] = new_u;
        old_n[i] = new_n;



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to