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.3 by tdb, Wed Aug 27 14:04:17 2003 UTC vs.
Revision 1.6 by ats, Fri Aug 29 06:48:04 2003 UTC

# Line 79 | Line 79 | void clear_stats() {
79  
80          for (i = 0; i < num_stats; i++)
81                  free(stats[i].name);
82        free(stats);
83        stats = NULL;
82          num_stats = 0;
85        alloc_stats = 0;
83   }
84  
85   /* Add a stat. The varargs make up the name, joined with dots; the name is
# Line 187 | Line 184 | void get_stats(int use_diffs) {
184                                   "cpu", "swap", NULL);
185                          add_stat(FLOAT, &cpu_p->nice,
186                                   "cpu", "nice", NULL);
187 <                        add_stat(TIME_T, &cpu_s->systime,
187 >                        add_stat(TIME_T, &cpu_p->systime,
188                                   "cpu", "time_taken", NULL);
189                  }
190          } else {
# Line 418 | Line 415 | void usage() {
415                 "  -s         Display stat differences repeatedly\n"
416                 "  -o         Display stat differences once\n"
417                 "  -t DELAY   When repeating, wait DELAY seconds between updates (default 1)\n"
418 <               "  -p         Display CPU usage as percentages rather than absolute values\n"
418 >               "  -p         Display CPU usage differences as percentages rather than\n"
419 >               "             absolute values\n"
420                 "\n");
421          printf("Version %s - report bugs to <%s>.\n",
422 <                PACKAGE_VERSION, PACKAGE_BUGREPORT);
422 >               PACKAGE_VERSION, PACKAGE_BUGREPORT);
423          exit(1);
424   }
425  
# Line 467 | Line 465 | int main(int argc, char **argv) {
465          if (display_mode == DISPLAY_MRTG) {
466                  if ((argc - optind) != 2)
467                          die("mrtg mode: must specify exactly two stats");
468 <                if (repeat_mode != REPEAT_NONE)
468 >                if (repeat_mode == REPEAT_FOREVER)
469                          die("mrtg mode: cannot repeat display");
470          }
471 +
472 +        if (use_cpu_percent && repeat_mode == REPEAT_NONE)
473 +                die("CPU percentage usage display requires stat differences");
474  
475          switch (repeat_mode) {
476          case REPEAT_NONE:

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines