18 |
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 |
|
*/ |
20 |
|
|
21 |
+ |
#ifdef HAVE_CONFIG_H |
22 |
+ |
#include "config.h" |
23 |
+ |
#endif |
24 |
+ |
|
25 |
|
#include <statgrab.h> |
26 |
|
#include <string.h> |
27 |
|
#include <stdio.h> |
79 |
|
|
80 |
|
for (i = 0; i < num_stats; i++) |
81 |
|
free(stats[i].name); |
78 |
– |
free(stats); |
79 |
– |
stats = NULL; |
82 |
|
num_stats = 0; |
81 |
– |
alloc_stats = 0; |
83 |
|
} |
84 |
|
|
85 |
|
/* Add a stat. The varargs make up the name, joined with dots; the name is |
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 { |
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("Report bugs to <bugs@i-scream.org>.\n"); |
421 |
> |
printf("Version %s - report bugs to <%s>.\n", |
422 |
> |
PACKAGE_VERSION, PACKAGE_BUGREPORT); |
423 |
|
exit(1); |
424 |
|
} |
425 |
|
|
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: |