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

Comparing projects/libstatgrab/src/libstatgrab/disk_stats.c (file contents):
Revision 1.26 by tdb, Wed Oct 8 09:20:56 2003 UTC vs.
Revision 1.27 by pajs, Thu Oct 9 14:59:52 2003 UTC

# Line 347 | Line 347 | diskio_stat_t *get_diskio_stats(int *entries){
347           * find a machine with more than 999 disks, then i'll change
348           * this number :)
349           */
350 + #ifdef FREEBSD5
351 +        if ((devstat_getdevs(NULL, &stats)) < 0) return NULL;
352 + #else
353          if (selectdevs(&dev_sel, &n_selected, &n_selections, &sel_gen, stats.dinfo->generation, stats.dinfo->devices, stats.dinfo->numdevs, NULL, 0, NULL, 0, DS_SELECT_ONLY, 999, 1) < 0) return NULL;
354 + #endif
355  
356          for(counter=0;counter<stats.dinfo->numdevs;counter++){
357                  dev_ptr=&stats.dinfo->devices[dev_sel[counter].position];
# Line 356 | Line 360 | diskio_stat_t *get_diskio_stats(int *entries){
360                   * devices.. like mem, proc.. and also doesn't report floppy
361                   * drives etc unless they are doing stuff :)
362                   */
363 + #ifdef FREEBSD5
364 +                if((dev_ptr->bytes[DEVSTAT_READ]==0) && (dev_ptr->bytes[DEVSTAT_WRITE]==0)) continue;
365 + #else
366                  if((dev_ptr->bytes_read==0) && (dev_ptr->bytes_written==0)) continue;
367 + #endif
368                  if((diskio_stats=diskio_stat_malloc(num_diskio+1, &sizeof_diskio_stats, diskio_stats))==NULL){
369                          return NULL;
370                  }
371                  diskio_stats_ptr=diskio_stats+num_diskio;
372 <                
372 >
373 > #ifdef FREEBSD5        
374 >                diskio_stats_ptr->read_bytes=dev_ptr->bytes[DEVSTAT_READ];
375 >                diskio_stats_ptr->write_bytes=dev_ptr->bytes[DEVSTAT_WRITE];
376 > #else
377                  diskio_stats_ptr->read_bytes=dev_ptr->bytes_read;
378                  diskio_stats_ptr->write_bytes=dev_ptr->bytes_written;
379 + #endif
380                  if(diskio_stats_ptr->disk_name!=NULL) free(diskio_stats_ptr->disk_name);
381                  asprintf((&diskio_stats_ptr->disk_name), "%s%d", dev_ptr->device_name, dev_ptr->unit_number);
382                  diskio_stats_ptr->systime=time(NULL);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines