ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/libstatgrab/src/libstatgrab/process_stats.c
(Generate patch)

Comparing projects/libstatgrab/src/libstatgrab/process_stats.c (file contents):
Revision 1.81 by tdb, Sat Sep 24 13:29:22 2005 UTC vs.
Revision 1.82 by tdb, Mon Oct 9 14:47:58 2006 UTC

# Line 143 | Line 143 | sg_process_stats *sg_get_process_stats(int *entries){
143          int len;
144          int rc;
145          time_t uptime;
146 +        long tickspersec;
147   #endif
148  
149   #ifdef LINUX
# Line 255 | Line 256 | sg_process_stats *sg_get_process_stats(int *entries){
256  
257                  /* cpu */
258                  proc_state_ptr->cpu_percent = (100.0 * (utime + stime)) / ((uptime * 100.0) - starttime);
259 +                tickspersec = sysconf (_SC_CLK_TCK);
260 +                if (tickspersec < 0) {
261 +                        proc_state_ptr->time_spent = 0;
262 +                }
263 +                else {
264 +                        proc_state_ptr->time_spent = (utime + stime) / tickspersec;
265 +                }
266  
267                  fclose(f);
268  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines