/*
* pr_stats.c: Functions used by sar to display statistics
- * (C) 1999-2018 by Sebastien GODARD (sysstat <at> orange.fr)
+ * (C) 1999-2019 by Sebastien GODARD (sysstat <at> orange.fr)
*
***************************************************************************
* This program is free software; you can redistribute it and/or modify it *
#endif
extern unsigned int flags;
-extern int dis;
+extern int dish;
extern char timestamp[][TIMESTAMP_LEN];
extern unsigned long avg_count;
* Display current activity header line.
*
* IN:
- * @timestamp Timestamp for previous stat sample.
+ * @p_timestamp Timestamp for previous stat sample.
* @a Activity structure.
* @pos Index in @.hdr_line string, 0 being the first one (header
* are delimited by the '|' character).
* @vwidth Column width for stats values.
***************************************************************************
*/
-void print_hdr_line(char *timestamp, struct activity *a, int pos, int iwidth, int vwidth)
+void print_hdr_line(char *p_timestamp, struct activity *a, int pos, int iwidth, int vwidth)
{
char hline[HEADER_LINE_LEN] = "";
char *hl, *tk, *it = NULL;
/* Bad @pos arg given to function */
return;
- printf("\n%-11s", timestamp);
+ printf("\n%-11s", p_timestamp);
if (strchr(hl, '&')) {
j = strcspn(hl, "&");
struct stats_cpu *scc, *scp;
unsigned char offline_cpu_bitmap[BITMAP_SIZE(NR_CPUS)] = {0};
- if (dis) {
+ if (dish) {
print_hdr_line(timestamp[!curr], a, FIRST + DISPLAY_CPU_ALL(a->opt_flags), 7, 9);
}
* %irq, %soft, %guest, %gnice.
*/
else if (DISPLAY_CPU_ALL(a->opt_flags)) {
- cprintf_pc(DISPLAY_UNIT(flags), 4, 9, 2,
- 0.0, 0.0, 0.0, 100.0);
+ cprintf_pc(DISPLAY_UNIT(flags), 5, 9, 2,
+ 0.0, 0.0, 0.0, 0.0, 100.0);
printf("\n");
}
continue;
*spc = (struct stats_pcsw *) a->buf[curr],
*spp = (struct stats_pcsw *) a->buf[prev];
- if (dis) {
+ if (dish) {
print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
}
int i;
struct stats_irq *sic, *sip;
- if (dis || DISPLAY_ZERO_OMIT(flags)) {
+ if (dish || DISPLAY_ZERO_OMIT(flags)) {
print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
}
*ssc = (struct stats_swap *) a->buf[curr],
*ssp = (struct stats_swap *) a->buf[prev];
- if (dis) {
+ if (dish) {
print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
}
*spc = (struct stats_paging *) a->buf[curr],
*spp = (struct stats_paging *) a->buf[prev];
- if (dis) {
+ if (dish) {
print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
}
*sic = (struct stats_io *) a->buf[curr],
*sip = (struct stats_io *) a->buf[prev];
- if (dis) {
+ if (dish) {
print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
}
* We display 0.0 in this case though we should rather tell
* the user that the value cannot be calculated here.
*/
- cprintf_f(NO_UNIT, 5, 9, 2,
+ cprintf_f(NO_UNIT, 7, 9, 2,
sic->dk_drive < sip->dk_drive ? 0.0 :
S_VALUE(sip->dk_drive, sic->dk_drive, itv),
sic->dk_drive_rio < sip->dk_drive_rio ? 0.0 :
S_VALUE(sip->dk_drive_rio, sic->dk_drive_rio, itv),
sic->dk_drive_wio < sip->dk_drive_wio ? 0.0 :
S_VALUE(sip->dk_drive_wio, sic->dk_drive_wio, itv),
+ sic->dk_drive_dio < sip->dk_drive_dio ? 0.0 :
+ S_VALUE(sip->dk_drive_dio, sic->dk_drive_dio, itv),
sic->dk_drive_rblk < sip->dk_drive_rblk ? 0.0 :
S_VALUE(sip->dk_drive_rblk, sic->dk_drive_rblk, itv),
sic->dk_drive_wblk < sip->dk_drive_wblk ? 0.0 :
- S_VALUE(sip->dk_drive_wblk, sic->dk_drive_wblk, itv));
+ S_VALUE(sip->dk_drive_wblk, sic->dk_drive_wblk, itv),
+ sic->dk_drive_dblk < sip->dk_drive_dblk ? 0.0 :
+ S_VALUE(sip->dk_drive_dblk, sic->dk_drive_dblk, itv));
printf("\n");
}
}
if (DISPLAY_MEMORY(a->opt_flags)) {
- if (dis) {
+ if (dish) {
print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
}
}
if (DISPLAY_SWAP(a->opt_flags)) {
- if (dis) {
+ if (dish) {
print_hdr_line(timestamp[!curr], a, SECOND, 0, 9);
}
avg_pty_nr = 0;
- if (dis) {
+ if (dish) {
print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
}
avg_load_avg_15 = 0,
avg_procs_blocked = 0;
- if (dis) {
+ if (dish) {
print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
}
int i, j, j0, found;
struct stats_serial *ssc, *ssp;
- if (dis || DISPLAY_ZERO_OMIT(flags)) {
+ if (dish || DISPLAY_ZERO_OMIT(flags)) {
print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
}
unit = UNIT_KILOBYTE;
}
- if (dis || DISPLAY_ZERO_OMIT(flags)) {
+ if (dish || DISPLAY_ZERO_OMIT(flags)) {
print_hdr_line(timestamp[!curr], a, FIRST, DISPLAY_HUMAN_READ(flags) ? -1 : 0, 9);
}
continue;
/* Get device name */
- dev_name = get_sa_devname(sdc->major, sdc->minor, flags);
+ dev_name = get_sa_devname(sdc->major, sdc->minor, sdc->wwn, sdc->part_nr, flags);
if (a->item_list != NULL) {
/* A list of devices has been entered on the command line */
}
cprintf_f(NO_UNIT, 1, 9, 2,
S_VALUE(sdp->nr_ios, sdc->nr_ios, itv));
- cprintf_f(unit, 2, 9, 2,
+ cprintf_f(unit, 3, 9, 2,
S_VALUE(sdp->rd_sect, sdc->rd_sect, itv) / 2,
- S_VALUE(sdp->wr_sect, sdc->wr_sect, itv) / 2);
+ S_VALUE(sdp->wr_sect, sdc->wr_sect, itv) / 2,
+ S_VALUE(sdp->dc_sect, sdc->dc_sect, itv) / 2);
/* See iostat for explanations */
cprintf_f(unit, 1, 9, 2,
xds.arqsz / 2);
- cprintf_f(NO_UNIT, 3, 9, 2,
+ cprintf_f(NO_UNIT, 2, 9, 2,
S_VALUE(sdp->rq_ticks, sdc->rq_ticks, itv) / 1000.0,
- xds.await,
- xds.svctm);
+ xds.await);
cprintf_pc(DISPLAY_UNIT(flags), 1, 9, 2,
xds.util / 10.0);
if (DISPLAY_HUMAN_READ(flags)) {
unit = UNIT_BYTE;
}
- if (dis || DISPLAY_ZERO_OMIT(flags)) {
+ if (dish || DISPLAY_ZERO_OMIT(flags)) {
print_hdr_line(timestamp[!curr], a, FIRST, DISPLAY_HUMAN_READ(flags) ? -1 : 0, 9);
}
memset(&snedzero, 0, STATS_NET_EDEV_SIZE);
- if (dis || DISPLAY_ZERO_OMIT(flags)) {
+ if (dish || DISPLAY_ZERO_OMIT(flags)) {
print_hdr_line(timestamp[!curr], a, FIRST, DISPLAY_HUMAN_READ(flags) ? -1 : 0, 9);
}
*snnc = (struct stats_net_nfs *) a->buf[curr],
*snnp = (struct stats_net_nfs *) a->buf[prev];
- if (dis) {
+ if (dish) {
print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
}
*snndc = (struct stats_net_nfsd *) a->buf[curr],
*snndp = (struct stats_net_nfsd *) a->buf[prev];
- if (dis) {
+ if (dish) {
print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
}
avg_frag_inuse = 0,
avg_tcp_tw = 0;
- if (dis) {
+ if (dish) {
print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
}
*snic = (struct stats_net_ip *) a->buf[curr],
*snip = (struct stats_net_ip *) a->buf[prev];
- if (dis) {
+ if (dish) {
print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
}
*sneic = (struct stats_net_eip *) a->buf[curr],
*sneip = (struct stats_net_eip *) a->buf[prev];
- if (dis) {
+ if (dish) {
print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
}
*snic = (struct stats_net_icmp *) a->buf[curr],
*snip = (struct stats_net_icmp *) a->buf[prev];
- if (dis) {
+ if (dish) {
print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
}
*sneic = (struct stats_net_eicmp *) a->buf[curr],
*sneip = (struct stats_net_eicmp *) a->buf[prev];
- if (dis) {
+ if (dish) {
print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
}
*sntc = (struct stats_net_tcp *) a->buf[curr],
*sntp = (struct stats_net_tcp *) a->buf[prev];
- if (dis) {
+ if (dish) {
print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
}
*snetc = (struct stats_net_etcp *) a->buf[curr],
*snetp = (struct stats_net_etcp *) a->buf[prev];
- if (dis) {
+ if (dish) {
print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
}
*snuc = (struct stats_net_udp *) a->buf[curr],
*snup = (struct stats_net_udp *) a->buf[prev];
- if (dis) {
+ if (dish) {
print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
}
avg_raw6_inuse = 0,
avg_frag6_inuse = 0;
- if (dis) {
+ if (dish) {
print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
}
*snic = (struct stats_net_ip6 *) a->buf[curr],
*snip = (struct stats_net_ip6 *) a->buf[prev];
- if (dis) {
+ if (dish) {
print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
}
*sneic = (struct stats_net_eip6 *) a->buf[curr],
*sneip = (struct stats_net_eip6 *) a->buf[prev];
- if (dis) {
+ if (dish) {
print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
}
*snic = (struct stats_net_icmp6 *) a->buf[curr],
*snip = (struct stats_net_icmp6 *) a->buf[prev];
- if (dis) {
+ if (dish) {
print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
}
*sneic = (struct stats_net_eicmp6 *) a->buf[curr],
*sneip = (struct stats_net_eicmp6 *) a->buf[prev];
- if (dis) {
+ if (dish) {
print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
}
*snuc = (struct stats_net_udp6 *) a->buf[curr],
*snup = (struct stats_net_udp6 *) a->buf[prev];
- if (dis) {
+ if (dish) {
print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
}
nr_alloc = a->nr[curr];
}
- if (dis) {
+ if (dish) {
print_hdr_line(timestamp[!curr], a, FIRST, 7, 9);
}
nr_alloc = a->nr[curr];
}
- if (dis) {
+ if (dish) {
print_hdr_line(timestamp[!curr], a, FIRST, -2, 9);
}
nr_alloc = a->nr[curr];
}
- if (dis) {
+ if (dish) {
print_hdr_line(timestamp[!curr], a, FIRST, -2, 9);
}
nr_alloc = a->nr[curr];
}
- if (dis) {
+ if (dish) {
print_hdr_line(timestamp[!curr], a, FIRST, -2, 9);
}
unit = UNIT_KILOBYTE;
}
- if (dis) {
+ if (dish) {
print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
}
struct stats_pwr_wghfreq *spc, *spp, *spc_k, *spp_k;
unsigned long long tis, tisfreq;
- if (dis) {
+ if (dish) {
print_hdr_line(timestamp[!curr], a, FIRST, 7, 9);
}
char fmt[16];
struct stats_pwr_usb *suc, *sum;
- if (dis) {
+ if (dish) {
printf("\n%-11s BUS idvendor idprod maxpower",
(dispavg ? _("Summary:") : timestamp[!curr]));
printf(" %-*s product\n", MAX_MANUF_LEN - 1, "manufact");
unit = UNIT_BYTE;
}
- if (dis || DISPLAY_ZERO_OMIT(flags)) {
+ if (dish || DISPLAY_ZERO_OMIT(flags)) {
print_hdr_line((dispavg ? _("Summary:") : timestamp[!curr]),
a, FIRST + DISPLAY_MOUNT(a->opt_flags), -1, 9);
}
unsigned long long itv)
{
int i, j, j0, found;
- struct stats_fchost *sfcc, *sfcp;
+ struct stats_fchost *sfcc, *sfcp, sfczero;
- if (dis) {
+ memset(&sfczero, 0, sizeof(struct stats_fchost));
+
+ if (dish) {
print_hdr_line(timestamp[!curr], a, FIRST, -1, 9);
}
}
}
- if (!found)
- continue;
+ if (!found) {
+ /* This is a newly registered host */
+ sfcp = &sfczero;
+ }
printf("%-11s", timestamp[curr]);
cprintf_f(NO_UNIT, 4, 9, 2,
*ssnp = (struct stats_softnet *) a->buf[prev];
unsigned char offline_cpu_bitmap[BITMAP_SIZE(NR_CPUS)] = {0};
- if (dis || DISPLAY_ZERO_OMIT(flags)) {
+ if (dish || DISPLAY_ZERO_OMIT(flags)) {
print_hdr_line(timestamp[!curr], a, FIRST, 7, 9);
}