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

Comparing projects/libstatgrab/src/statgrab/statgrab.c (file contents):
Revision 1.34 by tdb, Wed Jul 13 09:31:54 2005 UTC vs.
Revision 1.36 by tdb, Sat Sep 24 13:29:25 2005 UTC

# Line 313 | Line 313 | void populate_fs() {
313                                   "fs", name, "used_inodes", NULL);
314                          add_stat(LONG_LONG, &disk[i].free_inodes,
315                                   "fs", name, "free_inodes", NULL);
316 +                        add_stat(LONG_LONG, &disk[i].avail_inodes,
317 +                                 "fs", name, "avail_inodes", NULL);
318 +                        add_stat(LONG_LONG, &disk[i].io_size,
319 +                                 "fs", name, "io_size", NULL);
320 +                        add_stat(LONG_LONG, &disk[i].block_size,
321 +                                 "fs", name, "block_size", NULL);
322 +                        add_stat(LONG_LONG, &disk[i].total_blocks,
323 +                                 "fs", name, "total_blocks", NULL);
324 +                        add_stat(LONG_LONG, &disk[i].free_blocks,
325 +                                 "fs", name, "free_blocks", NULL);
326 +                        add_stat(LONG_LONG, &disk[i].avail_blocks,
327 +                                 "fs", name, "avail_blocks", NULL);
328 +                        add_stat(LONG_LONG, &disk[i].used_blocks,
329 +                                 "fs", name, "used_blocks", NULL);
330  
331                          free(buf);
332                  }
# Line 497 | Line 511 | void print_stat_value(const stat *s) {
511  
512          switch (s->type) {
513          case LONG_LONG:
514 + #ifdef WIN32 /* Windows printf does not understand %lld, so use %I64d instead */
515 +                printf("%I64d", *(long long *)v);
516 + #else
517                  printf("%lld", *(long long *)v);
518 + #endif
519                  break;
520          case BYTES:
521                  llv = *(long long *)v;
522                  if (bytes_scale_factor != 0) {
523                          llv /= bytes_scale_factor;
524                  }
525 + #ifdef WIN32
526 +                printf("%I64d", llv);
527 + #else
528                  printf("%lld", llv);
529 + #endif
530                  break;
531          case TIME_T:
532                  /* FIXME option for formatted time? */
# Line 720 | Line 742 | int main(int argc, char **argv) {
742          /* We don't care if sg_init fails, because we can just display
743             the statistics that can be read as non-root. */
744          sg_init();
745 +        sg_snapshot();
746          if (sg_drop_privileges() != 0)
747                  die("Failed to drop setuid/setgid privileges");
748  
# Line 731 | Line 754 | int main(int argc, char **argv) {
754          case REPEAT_ONCE:
755                  get_stats();
756                  sleep(repeat_time);
757 +                sg_snapshot();
758                  get_stats();
759                  print_stats(argc, argv);
760                  break;
# Line 740 | Line 764 | int main(int argc, char **argv) {
764                          print_stats(argc, argv);
765                          printf("\n");
766                          sleep(repeat_time);
767 +                        sg_snapshot();
768                  }
769          }
770  
# Line 747 | Line 772 | int main(int argc, char **argv) {
772                  printf("\n");
773                  printf("statgrab\n");
774          }
775 +
776 +        sg_shutdown();
777  
778          return 0;
779   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines