mpstat.c (sysstat-12.4.0.tar.xz) | : | mpstat.c (sysstat-12.4.1.tar.xz) | ||
---|---|---|---|---|
skipping to change at line 138 | skipping to change at line 138 | |||
* IN: | * IN: | |||
* @progname Name of sysstat command | * @progname Name of sysstat command | |||
*************************************************************************** | *************************************************************************** | |||
*/ | */ | |||
void usage(char *progname) | void usage(char *progname) | |||
{ | { | |||
fprintf(stderr, _("Usage: %s [ options ] [ <interval> [ <count> ] ]\n"), | fprintf(stderr, _("Usage: %s [ options ] [ <interval> [ <count> ] ]\n"), | |||
progname); | progname); | |||
fprintf(stderr, _("Options are:\n" | fprintf(stderr, _("Options are:\n" | |||
"[ -A ] [ -n ] [ -u ] [ -V ]\n" | "[ -A ] [ -n ] [ -T ] [ -u ] [ -V ]\n" | |||
"[ -I { SUM | CPU | SCPU | ALL } ] [ -N { <node_list> | ALL } ]\n" | "[ -I { SUM | CPU | SCPU | ALL } ] [ -N { <node_list> | ALL } ]\n" | |||
"[ --dec={ 0 | 1 | 2 } ] [ -o JSON ] [ -P { <cpu_list> | ALL } ]\n")); | "[ --dec={ 0 | 1 | 2 } ] [ -o JSON ] [ -P { <cpu_list> | ALL } ]\n")); | |||
exit(1); | exit(1); | |||
} | } | |||
/* | /* | |||
*************************************************************************** | *************************************************************************** | |||
* SIGALRM signal handler. No need to reset the handler here. | * SIGALRM signal handler. No need to reset the handler here. | |||
* | * | |||
* IN: | * IN: | |||
skipping to change at line 1891 | skipping to change at line 1891 | |||
* @rows Number of rows of screen. | * @rows Number of rows of screen. | |||
*************************************************************************** | *************************************************************************** | |||
*/ | */ | |||
void rw_mpstat_loop(int dis_hdr, int rows) | void rw_mpstat_loop(int dis_hdr, int rows) | |||
{ | { | |||
struct stats_cpu *scc; | struct stats_cpu *scc; | |||
int i; | int i; | |||
int curr = 1, dis = 1; | int curr = 1, dis = 1; | |||
unsigned long lines = rows; | unsigned long lines = rows; | |||
/* Dont buffer data if redirected to a pipe */ | ||||
setbuf(stdout, NULL); | ||||
/* Read system uptime and CPU stats */ | /* Read system uptime and CPU stats */ | |||
read_uptime(&(uptime_cs[0])); | read_uptime(&(uptime_cs[0])); | |||
read_stat_cpu(st_cpu[0], cpu_nr + 1); | read_stat_cpu(st_cpu[0], cpu_nr + 1); | |||
/* | /* | |||
* Calculate global CPU stats as the sum of individual ones. | * Calculate global CPU stats as the sum of individual ones. | |||
* Done only on SMP machines. On UP machines, we keep the values | * Done only on SMP machines. On UP machines, we keep the values | |||
* read from /proc/stat for global CPU stats. | * read from /proc/stat for global CPU stats. | |||
*/ | */ | |||
if (cpu_nr > 1) { | if (cpu_nr > 1) { | |||
skipping to change at line 2315 | skipping to change at line 2312 | |||
} | } | |||
if (DISPLAY_JSON_OUTPUT(flags)) { | if (DISPLAY_JSON_OUTPUT(flags)) { | |||
/* Use a decimal point to make JSON code compliant with RFC7159 * / | /* Use a decimal point to make JSON code compliant with RFC7159 * / | |||
setlocale(LC_NUMERIC, "C"); | setlocale(LC_NUMERIC, "C"); | |||
} | } | |||
/* Get time */ | /* Get time */ | |||
get_localtime(&(mp_tstamp[0]), 0); | get_localtime(&(mp_tstamp[0]), 0); | |||
/* | ||||
* Don't buffer data if redirected to a pipe. | ||||
* Note: With musl-c, the behavior of this function is undefined except | ||||
* when it is the first operation on the stream. | ||||
*/ | ||||
setbuf(stdout, NULL); | ||||
/* Get system name, release number and hostname */ | /* Get system name, release number and hostname */ | |||
__uname(&header); | __uname(&header); | |||
print_gal_header(&(mp_tstamp[0]), header.sysname, header.release, | print_gal_header(&(mp_tstamp[0]), header.sysname, header.release, | |||
header.nodename, header.machine, get_cpu_nr(~0, FALSE), | header.nodename, header.machine, get_cpu_nr(~0, FALSE), | |||
DISPLAY_JSON_OUTPUT(flags)); | DISPLAY_JSON_OUTPUT(flags)); | |||
/* Main loop */ | /* Main loop */ | |||
rw_mpstat_loop(dis_hdr, rows); | rw_mpstat_loop(dis_hdr, rows); | |||
/* Free structures */ | /* Free structures */ | |||
End of changes. 3 change blocks. | ||||
4 lines changed or deleted | 8 lines changed or added |