ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/host/ihost-perl/plugins/freebsd/freebsd.c
(Generate patch)

Comparing projects/cms/source/host/ihost-perl/plugins/freebsd/freebsd.c (file contents):
Revision 1.7 by pajs, Tue Apr 2 11:25:37 2002 UTC vs.
Revision 1.8 by pajs, Fri Apr 5 12:02:09 2002 UTC

# Line 114 | Line 114 | void systemStats(){
114    long cp_time[CPUSTATES];
115    long total, user, idle, kernel, nice;
116    long totalmem, freemem, swaptotal, swapused;
117 +  float stat;
118  
119    static char *uptimename = "kern.boottime";
120    static char *cpname = "kern.cp_time";
# Line 171 | Line 172 | void systemStats(){
172      die();
173    }
174    
175 <  user-=cp_time[CP_USER];
176 <  nice-=cp_time[CP_NICE];
177 <  kernel-=cp_time[CP_SYS];
178 <  idle-=cp_time[CP_IDLE];
175 >  user=cp_time[CP_USER]-user;
176 >  nice=cp_time[CP_NICE]-nice;
177 >  kernel=cp_time[CP_SYS]-kernel;
178 >  idle=cp_time[CP_IDLE]-idle;
179    
180    total=user+nice+kernel+idle;
181 <
182 <  printf("packet.cpu.user %ld\n",((user+nice)*100)/total);
183 <  printf("packet.cpu.kernel %ld\n",(kernel*100)/total);
184 <  printf("packet.cpu.idle %ld\n",(idle*100)/total);
181 >  stat=((float)(user+nice)/(float)total)*100.0;
182 >  printf("packet.cpu.user %.2f\n",stat);
183 >  stat=((float)(kernel)/(float)total)*100.0;
184 >  printf("packet.cpu.kernel %.2f\n",stat);
185 >  stat=((float)(idle)/(float)total)*100.0;
186 >  printf("packet.cpu.idle %.2f\n",stat);
187  
188     /* Cos i-scream's expects this to be sent :/ */
189    printf("packet.cpu.iowait 0\n");
# Line 237 | Line 240 | void systemStats(){
240      die();
241    }
242    
243 <  /* Lose are setgid'ness */
243 >  /* Lose our setgid'ness */
244  
245    if ((setegid(gid)) != 0){
246      errf("Failed to release permissions, refusing to keep setgid. (%m)");

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines