}
if (DISPLAY_MEM(actflag)) {
- cprintf_f(2, 9, 2,
+ cprintf_f(-1, 2, 9, 2,
S_VALUE(pstp->minflt, pstc->minflt, itv),
S_VALUE(pstp->majflt, pstc->majflt, itv));
- cprintf_u64(2, 7,
+ cprintf_u64(-1, 2, 7,
(unsigned long long) pstc->vsz,
(unsigned long long) pstc->rss);
cprintf_pc(1, 6, 2,
}
if (DISPLAY_STACK(actflag)) {
- cprintf_u64(2, 7,
+ cprintf_u64(-1, 2, 7,
(unsigned long long) pstc->stack_size,
(unsigned long long) pstc->stack_ref);
}
if (DISPLAY_IO(actflag)) {
if (!NO_PID_IO(pstc->flags))
{
- cprintf_f(3, 9, 2,
+ cprintf_f(-1, 3, 9, 2,
S_VALUE(pstp->read_bytes, pstc->read_bytes, itv) / 1024,
S_VALUE(pstp->write_bytes, pstc->write_bytes, itv) / 1024,
S_VALUE(pstp->cancelled_write_bytes,
cprintf_s(IS_ZERO, "%s", dstr);
}
/* I/O delays come from another file (/proc/#/stat) */
- cprintf_u64(1, 7,
+ cprintf_u64(-1, 1, 7,
(unsigned long long) (pstc->blkio_swapin_delays - pstp->blkio_swapin_delays));
}
if (DISPLAY_CTXSW(actflag)) {
- cprintf_f(2, 9, 2,
+ cprintf_f(-1, 2, 9, 2,
S_VALUE(pstp->nvcsw, pstc->nvcsw, itv),
S_VALUE(pstp->nivcsw, pstc->nivcsw, itv));
}
if (DISPLAY_KTAB(actflag)) {
- cprintf_u64(1, 7,
+ cprintf_u64(-1, 1, 7,
(unsigned long long) pstc->threads);
if (NO_PID_FD(pstc->flags)) {
/* /proc/#/fd directory not readable */
cprintf_s(IS_ZERO, " %7s", "-1");
}
else {
- cprintf_u64(1, 7, (unsigned long long) pstc->fd_nr);
+ cprintf_u64(-1, 1, 7, (unsigned long long) pstc->fd_nr);
}
}
if (DISPLAY_RT(actflag)) {
- cprintf_u64(1, 4,
+ cprintf_u64(-1, 1, 4,
(unsigned long long) pstc->priority);
cprintf_s(IS_STR, " %6s",
GET_POLICY(pstc->policy));
__print_line_id(pstc, '0');
if (DISPLAY_CPU(actflag)) {
- cprintf_f(3, 9, 0,
+ cprintf_f(-1, 3, 9, 0,
(pstc->utime + pstc->cutime - pstc->gtime - pstc->cgtime) <
(pstp->utime + pstp->cutime - pstp->gtime - pstp->cgtime) ?
0.0 :
}
if (DISPLAY_MEM(actflag)) {
- cprintf_u64(2, 9,
+ cprintf_u64(-1, 2, 9,
(unsigned long long) ((pstc->minflt + pstc->cminflt) - (pstp->minflt + pstp->cminflt)),
(unsigned long long) ((pstc->majflt + pstc->cmajflt) - (pstp->majflt + pstp->cmajflt)));
}
print_line_id(curr_string, pstc);
if (disp_avg) {
- cprintf_f(3, 9, 0,
+ cprintf_f(-1, 3, 9, 0,
(pstc->utime + pstc->cutime - pstc->gtime - pstc->cgtime) <
(pstp->utime + pstp->cutime - pstp->gtime - pstp->cgtime) ?
0.0 :
(HZ * pstc->uc_asum_count) * 1000);
}
else {
- cprintf_f(3, 9, 0,
+ cprintf_f(-1, 3, 9, 0,
(pstc->utime + pstc->cutime - pstc->gtime - pstc->cgtime) <
(pstp->utime + pstp->cutime - pstp->gtime - pstp->cgtime) ?
0.0 :
print_line_id(curr_string, pstc);
- cprintf_f(2, 9, 2,
+ cprintf_f(-1, 2, 9, 2,
S_VALUE(pstp->minflt, pstc->minflt, itv),
S_VALUE(pstp->majflt, pstc->majflt, itv));
if (disp_avg) {
- cprintf_f(2, 7, 0,
+ cprintf_f(-1, 2, 7, 0,
(double) pstc->total_vsz / pstc->rt_asum_count,
(double) pstc->total_rss / pstc->rt_asum_count);
: 0.0);
}
else {
- cprintf_u64(2, 7,
+ cprintf_u64(-1, 2, 7,
(unsigned long long) pstc->vsz,
(unsigned long long) pstc->rss);
print_line_id(curr_string, pstc);
if (disp_avg) {
- cprintf_f(2, 9, 0,
+ cprintf_f(-1, 2, 9, 0,
(double) ((pstc->minflt + pstc->cminflt) -
(pstp->minflt + pstp->cminflt)) / pstc->rc_asum_count,
(double) ((pstc->majflt + pstc->cmajflt) -
(pstp->majflt + pstp->cmajflt)) / pstc->rc_asum_count);
}
else {
- cprintf_u64(2, 9,
+ cprintf_u64(-1, 2, 9,
(unsigned long long) ((pstc->minflt + pstc->cminflt) - (pstp->minflt + pstp->cminflt)),
(unsigned long long) ((pstc->majflt + pstc->cmajflt) - (pstp->majflt + pstp->cmajflt)));
}
print_line_id(curr_string, pstc);
if (disp_avg) {
- cprintf_f(2, 7, 0,
+ cprintf_f(-1, 2, 7, 0,
(double) pstc->total_stack_size / pstc->sk_asum_count,
(double) pstc->total_stack_ref / pstc->sk_asum_count);
}
else {
- cprintf_u64(2, 7,
+ cprintf_u64(-1, 2, 7,
(unsigned long long) pstc->stack_size,
(unsigned long long) pstc->stack_ref);
}
print_line_id(curr_string, pstc);
if (!NO_PID_IO(pstc->flags)) {
- cprintf_f(3, 9, 2,
+ cprintf_f(-1, 3, 9, 2,
S_VALUE(pstp->read_bytes, pstc->read_bytes, itv) / 1024,
S_VALUE(pstp->write_bytes, pstc->write_bytes, itv) / 1024,
S_VALUE(pstp->cancelled_write_bytes,
}
/* I/O delays come from another file (/proc/#/stat) */
if (disp_avg) {
- cprintf_f(1, 7, 0,
+ cprintf_f(-1, 1, 7, 0,
(double) (pstc->blkio_swapin_delays - pstp->blkio_swapin_delays) /
pstc->delay_asum_count);
}
else {
- cprintf_u64(1, 7,
+ cprintf_u64(-1, 1, 7,
(unsigned long long) (pstc->blkio_swapin_delays - pstp->blkio_swapin_delays));
}
continue;
print_line_id(curr_string, pstc);
- cprintf_f(2, 9, 2,
+ cprintf_f(-1, 2, 9, 2,
S_VALUE(pstp->nvcsw, pstc->nvcsw, itv),
S_VALUE(pstp->nivcsw, pstc->nivcsw, itv));
print_comm(pstc);
continue;
print_line_id(curr_string, pstc);
- cprintf_u64(1, 4,
+ cprintf_u64(-1, 1, 4,
(unsigned long long) pstc->priority);
cprintf_s(IS_STR, " %6s", GET_POLICY(pstc->policy));
print_comm(pstc);
print_line_id(curr_string, pstc);
if (disp_avg) {
- cprintf_f(2, 7, 0,
+ cprintf_f(-1, 2, 7, 0,
(double) pstc->total_threads / pstc->tf_asum_count,
NO_PID_FD(pstc->flags) ?
-1.0 :
(double) pstc->total_fd_nr / pstc->tf_asum_count);
}
else {
- cprintf_u64(1, 7,
+ cprintf_u64(-1, 1, 7,
(unsigned long long) pstc->threads);
if (NO_PID_FD(pstc->flags)) {
cprintf_s(IS_ZERO, " %7s", "-1");
}
else {
- cprintf_u64(1, 7,
+ cprintf_u64(-1, 1, 7,
(unsigned long long) pstc->fd_nr);
}
}
}
printf("%-11s", timestamp[curr]);
- cprintf_f(2, 9, 2,
+ cprintf_f(-1, 2, 9, 2,
S_VALUE(spp->processes, spc->processes, itv),
S_VALUE(spp->context_switch, spc->context_switch, itv));
printf("\n");
cprintf_in(IS_INT, " %9d", "", i -1);
}
- cprintf_f(1, 9, 2, S_VALUE(sip->irq_nr, sic->irq_nr, itv));
+ cprintf_f(-1, 1, 9, 2, S_VALUE(sip->irq_nr, sic->irq_nr, itv));
printf("\n");
}
}
}
printf("%-11s", timestamp[curr]);
- cprintf_f(2, 9, 2,
+ cprintf_f(-1, 2, 9, 2,
S_VALUE(ssp->pswpin, ssc->pswpin, itv),
S_VALUE(ssp->pswpout, ssc->pswpout, itv));
printf("\n");
}
printf("%-11s", timestamp[curr]);
- cprintf_f(8, 9, 2,
+ cprintf_f(-1, 8, 9, 2,
S_VALUE(spp->pgpgin, spc->pgpgin, itv),
S_VALUE(spp->pgpgout, spc->pgpgout, itv),
S_VALUE(spp->pgfault, spc->pgfault, itv),
* We display 0.0 in this case though we should rather tell
* the user that the value cannot be calculated here.
*/
- cprintf_f(5, 9, 2,
+ cprintf_f(-1, 5, 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 :
avg_frskb = 0,
avg_tlskb = 0,
avg_caskb = 0;
+ int unit = -1;
+
+ if (DISPLAY_UNIT(flags)) {
+ /* Default values unit is kB */
+ unit = 2;
+ }
if (DISPLAY_MEMORY(a->opt_flags)) {
if (dis) {
}
printf("%-11s", timestamp[curr]);
- cprintf_f(3, 9, 2,
+ cprintf_f(-1, 3, 9, 2,
S_VALUE((double) KB_TO_PG(smp->frmkb), (double) KB_TO_PG(smc->frmkb), itv),
S_VALUE((double) KB_TO_PG(smp->bufkb), (double) KB_TO_PG(smc->bufkb), itv),
S_VALUE((double) KB_TO_PG(smp->camkb), (double) KB_TO_PG(smc->camkb), itv));
if (!dispavg) {
/* Display instantaneous values */
printf("%-11s", timestamp[curr]);
- cprintf_u64(3, 9,
+ cprintf_u64(unit, 3, 9,
(unsigned long long) smc->frmkb,
(unsigned long long) smc->availablekb,
(unsigned long long) (smc->tlmkb - smc->frmkb));
smc->tlmkb ?
SP_VALUE(smc->frmkb, smc->tlmkb, smc->tlmkb)
: 0.0);
- cprintf_u64(3, 9,
+ cprintf_u64(unit, 3, 9,
(unsigned long long) smc->bufkb,
(unsigned long long) smc->camkb,
(unsigned long long) smc->comkb);
(smc->tlmkb + smc->tlskb) ?
SP_VALUE(0, smc->comkb, smc->tlmkb + smc->tlskb)
: 0.0);
- cprintf_u64(3, 9,
+ cprintf_u64(unit, 3, 9,
(unsigned long long) smc->activekb,
(unsigned long long) smc->inactkb,
(unsigned long long) smc->dirtykb);
if (DISPLAY_MEM_ALL(a->opt_flags)) {
/* Display extended memory statistics */
- cprintf_u64(5, 9,
+ cprintf_u64(unit, 5, 9,
(unsigned long long) smc->anonpgkb,
(unsigned long long) smc->slabkb,
(unsigned long long) smc->kstackkb,
else {
/* Display average values */
printf("%-11s", timestamp[curr]);
- cprintf_f(3, 9, 0,
+ cprintf_f(unit, 3, 9, 0,
(double) avg_frmkb / avg_count,
(double) avg_availablekb / avg_count,
(double) smc->tlmkb - ((double) avg_frmkb / avg_count));
smc->tlmkb ?
SP_VALUE((double) (avg_frmkb / avg_count), smc->tlmkb, smc->tlmkb)
: 0.0);
- cprintf_f(3, 9, 0,
+ cprintf_f(unit, 3, 9, 0,
(double) avg_bufkb / avg_count,
(double) avg_camkb / avg_count,
(double) avg_comkb / avg_count);
(smc->tlmkb + smc->tlskb) ?
SP_VALUE(0.0, (double) (avg_comkb / avg_count), smc->tlmkb + smc->tlskb)
: 0.0);
- cprintf_f(3, 9, 0,
+ cprintf_f(unit, 3, 9, 0,
(double) avg_activekb / avg_count,
(double) avg_inactkb / avg_count,
(double) avg_dirtykb / avg_count);
if (DISPLAY_MEM_ALL(a->opt_flags)) {
- cprintf_f(5, 9, 0,
+ cprintf_f(unit, 5, 9, 0,
(double) avg_anonpgkb / avg_count,
(double) avg_slabkb / avg_count,
(double) avg_kstackkb / avg_count,
if (!dispavg) {
/* Display instantaneous values */
printf("%-11s", timestamp[curr]);
- cprintf_u64(2, 9,
+ cprintf_u64(unit, 2, 9,
(unsigned long long) smc->frskb,
(unsigned long long) (smc->tlskb - smc->frskb));
cprintf_pc(1, 9, 2,
smc->tlskb ?
SP_VALUE(smc->frskb, smc->tlskb, smc->tlskb)
: 0.0);
- cprintf_u64(1, 9,
+ cprintf_u64(unit, 1, 9,
(unsigned long long) smc->caskb);
cprintf_pc(1, 9, 2,
(smc->tlskb - smc->frskb) ?
else {
/* Display average values */
printf("%-11s", timestamp[curr]);
- cprintf_f(2, 9, 0,
+ cprintf_f(unit, 2, 9, 0,
(double) avg_frskb / avg_count,
((double) avg_tlskb / avg_count) -
((double) avg_frskb / avg_count));
(double) avg_tlskb / avg_count,
(double) avg_tlskb / avg_count)
: 0.0);
- cprintf_f(1, 9, 0,
+ cprintf_f(unit, 1, 9, 0,
(double) avg_caskb / avg_count);
cprintf_pc(1, 9, 2,
(avg_tlskb != avg_frskb) ?
if (!dispavg) {
/* Display instantaneous values */
printf("%-11s", timestamp[curr]);
- cprintf_u64(4, 9,
+ cprintf_u64(-1, 4, 9,
(unsigned long long) skc->dentry_stat,
(unsigned long long) skc->file_used,
(unsigned long long) skc->inode_used,
else {
/* Display average values */
printf("%-11s", timestamp[curr]);
- cprintf_f(4, 9, 0,
+ cprintf_f(-1, 4, 9, 0,
(double) avg_dentry_stat / avg_count,
(double) avg_file_used / avg_count,
(double) avg_inode_used / avg_count,
if (!dispavg) {
/* Display instantaneous values */
printf("%-11s", timestamp[curr]);
- cprintf_u64(2, 9,
+ cprintf_u64(-1, 2, 9,
(unsigned long long) sqc->nr_running,
(unsigned long long) sqc->nr_threads);
- cprintf_f(3, 9, 2,
+ cprintf_f(-1, 3, 9, 2,
(double) sqc->load_avg_1 / 100,
(double) sqc->load_avg_5 / 100,
(double) sqc->load_avg_15 / 100);
- cprintf_u64(1, 9,
+ cprintf_u64(-1, 1, 9,
(unsigned long long) sqc->procs_blocked);
printf("\n");
else {
/* Display average values */
printf("%-11s", timestamp[curr]);
- cprintf_f(2, 9, 0,
+ cprintf_f(-1, 2, 9, 0,
(double) avg_nr_running / avg_count,
(double) avg_nr_threads / avg_count);
- cprintf_f(3, 9, 2,
+ cprintf_f(-1, 3, 9, 2,
(double) avg_load_avg_1 / (avg_count * 100),
(double) avg_load_avg_5 / (avg_count * 100),
(double) avg_load_avg_15 / (avg_count * 100));
- cprintf_f(1, 9, 0,
+ cprintf_f(-1, 1, 9, 0,
(double) avg_procs_blocked / avg_count);
printf("\n");
cprintf_in(IS_INT, " %3d", "", ssc->line - 1);
if ((ssc->line == ssp->line) || WANT_SINCE_BOOT(flags)) {
- cprintf_f(6, 9, 2,
+ cprintf_f(-1, 6, 9, 2,
S_VALUE(ssp->rx, ssc->rx, itv),
S_VALUE(ssp->tx, ssc->tx, itv),
S_VALUE(ssp->frame, ssc->frame, itv),
struct stats_disk *sdc, *sdp;
struct ext_disk_stats xds;
char *dev_name, *persist_dev_name;
+ int unit = -1;
+
+ if (DISPLAY_UNIT(flags)) {
+ /* Default values unit is sectors */
+ unit = 0;
+ }
if (dis) {
print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
printf("%-11s", timestamp[curr]);
cprintf_in(IS_STR, " %9s", dev_name, 0);
- cprintf_f(7, 9, 2,
- S_VALUE(sdp->nr_ios, sdc->nr_ios, itv),
+ cprintf_f(-1, 1, 9, 2,
+ S_VALUE(sdp->nr_ios, sdc->nr_ios, itv));
+ cprintf_f(unit, 2, 9, 2,
S_VALUE(sdp->rd_sect, sdc->rd_sect, itv),
- S_VALUE(sdp->wr_sect, sdc->wr_sect, itv),
+ S_VALUE(sdp->wr_sect, sdc->wr_sect, itv));
+ cprintf_f(-1, 4, 9, 2,
/* See iostat for explanations */
xds.arqsz,
S_VALUE(sdp->rq_ticks, sdc->rq_ticks, itv) / 1000.0,
int i, j;
struct stats_net_dev *sndc, *sndp;
double rxkb, txkb, ifutil;
+ int unit = -1;
+
+ if (DISPLAY_UNIT(flags)) {
+ /* Default values unit is bytes */
+ unit = 1;
+ }
if (dis) {
print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
rxkb = S_VALUE(sndp->rx_bytes, sndc->rx_bytes, itv);
txkb = S_VALUE(sndp->tx_bytes, sndc->tx_bytes, itv);
- cprintf_f(7, 9, 2,
+ cprintf_f(-1, 2, 9, 2,
S_VALUE(sndp->rx_packets, sndc->rx_packets, itv),
- S_VALUE(sndp->tx_packets, sndc->tx_packets, itv),
- rxkb / 1024,
- txkb / 1024,
+ S_VALUE(sndp->tx_packets, sndc->tx_packets, itv));
+ cprintf_f(unit, 2, 9, 2,
+ unit < 0 ? rxkb / 1024 : rxkb,
+ unit < 0 ? txkb / 1024 : txkb);
+ cprintf_f(-1, 3, 9, 2,
S_VALUE(sndp->rx_compressed, sndc->rx_compressed, itv),
S_VALUE(sndp->tx_compressed, sndc->tx_compressed, itv),
S_VALUE(sndp->multicast, sndc->multicast, itv));
printf("%-11s", timestamp[curr]);
cprintf_in(IS_STR, " %9s", snedc->interface, 0);
- cprintf_f(9, 9, 2,
+ cprintf_f(-1, 9, 9, 2,
S_VALUE(snedp->rx_errors, snedc->rx_errors, itv),
S_VALUE(snedp->tx_errors, snedc->tx_errors, itv),
S_VALUE(snedp->collisions, snedc->collisions, itv),
}
printf("%-11s", timestamp[curr]);
- cprintf_f(6, 9, 2,
+ cprintf_f(-1, 6, 9, 2,
S_VALUE(snnp->nfs_rpccnt, snnc->nfs_rpccnt, itv),
S_VALUE(snnp->nfs_rpcretrans, snnc->nfs_rpcretrans, itv),
S_VALUE(snnp->nfs_readcnt, snnc->nfs_readcnt, itv),
}
printf("%-11s", timestamp[curr]);
- cprintf_f(11, 9, 2,
+ cprintf_f(-1, 11, 9, 2,
S_VALUE(snndp->nfsd_rpccnt, snndc->nfsd_rpccnt, itv),
S_VALUE(snndp->nfsd_rpcbad, snndc->nfsd_rpcbad, itv),
S_VALUE(snndp->nfsd_netcnt, snndc->nfsd_netcnt, itv),
if (!dispavg) {
/* Display instantaneous values */
printf("%-11s", timestamp[curr]);
- cprintf_u64(6, 9,
+ cprintf_u64(-1, 6, 9,
(unsigned long long) snsc->sock_inuse,
(unsigned long long) snsc->tcp_inuse,
(unsigned long long) snsc->udp_inuse,
else {
/* Display average values */
printf("%-11s", timestamp[curr]);
- cprintf_f(6, 9, 0,
+ cprintf_f(-1, 6, 9, 0,
(double) avg_sock_inuse / avg_count,
(double) avg_tcp_inuse / avg_count,
(double) avg_udp_inuse / avg_count,
}
printf("%-11s", timestamp[curr]);
- cprintf_f(8, 9, 2,
+ cprintf_f(-1, 8, 9, 2,
S_VALUE(snip->InReceives, snic->InReceives, itv),
S_VALUE(snip->ForwDatagrams, snic->ForwDatagrams, itv),
S_VALUE(snip->InDelivers, snic->InDelivers, itv),
}
printf("%-11s", timestamp[curr]);
- cprintf_f(8, 9, 2,
+ cprintf_f(-1, 8, 9, 2,
S_VALUE(sneip->InHdrErrors, sneic->InHdrErrors, itv),
S_VALUE(sneip->InAddrErrors, sneic->InAddrErrors, itv),
S_VALUE(sneip->InUnknownProtos, sneic->InUnknownProtos, itv),
}
printf("%-11s", timestamp[curr]);
- cprintf_f(14, 9, 2,
+ cprintf_f(-1, 14, 9, 2,
S_VALUE(snip->InMsgs, snic->InMsgs, itv),
S_VALUE(snip->OutMsgs, snic->OutMsgs, itv),
S_VALUE(snip->InEchos, snic->InEchos, itv),
}
printf("%-11s", timestamp[curr]);
- cprintf_f(12, 9, 2,
+ cprintf_f(-1, 12, 9, 2,
S_VALUE(sneip->InErrors, sneic->InErrors, itv),
S_VALUE(sneip->OutErrors, sneic->OutErrors, itv),
S_VALUE(sneip->InDestUnreachs, sneic->InDestUnreachs, itv),
}
printf("%-11s", timestamp[curr]);
- cprintf_f(4, 9, 2,
+ cprintf_f(-1, 4, 9, 2,
S_VALUE(sntp->ActiveOpens, sntc->ActiveOpens, itv),
S_VALUE(sntp->PassiveOpens, sntc->PassiveOpens, itv),
S_VALUE(sntp->InSegs, sntc->InSegs, itv),
}
printf("%-11s", timestamp[curr]);
- cprintf_f(5, 9, 2,
+ cprintf_f(-1, 5, 9, 2,
S_VALUE(snetp->AttemptFails, snetc->AttemptFails, itv),
S_VALUE(snetp->EstabResets, snetc->EstabResets, itv),
S_VALUE(snetp->RetransSegs, snetc->RetransSegs, itv),
}
printf("%-11s", timestamp[curr]);
- cprintf_f(4, 9, 2,
+ cprintf_f(-1, 4, 9, 2,
S_VALUE(snup->InDatagrams, snuc->InDatagrams, itv),
S_VALUE(snup->OutDatagrams, snuc->OutDatagrams, itv),
S_VALUE(snup->NoPorts, snuc->NoPorts, itv),
if (!dispavg) {
/* Display instantaneous values */
printf("%-11s", timestamp[curr]);
- cprintf_u64(4, 9,
+ cprintf_u64(-1, 4, 9,
(unsigned long long) snsc->tcp6_inuse,
(unsigned long long) snsc->udp6_inuse,
(unsigned long long) snsc->raw6_inuse,
else {
/* Display average values */
printf("%-11s", timestamp[curr]);
- cprintf_f(4, 9, 0,
+ cprintf_f(-1, 4, 9, 0,
(double) avg_tcp6_inuse / avg_count,
(double) avg_udp6_inuse / avg_count,
(double) avg_raw6_inuse / avg_count,
}
printf("%-11s", timestamp[curr]);
- cprintf_f(10, 9, 2,
+ cprintf_f(-1, 10, 9, 2,
S_VALUE(snip->InReceives6, snic->InReceives6, itv),
S_VALUE(snip->OutForwDatagrams6, snic->OutForwDatagrams6, itv),
S_VALUE(snip->InDelivers6, snic->InDelivers6, itv),
}
printf("%-11s", timestamp[curr]);
- cprintf_f(11, 9, 2,
+ cprintf_f(-1, 11, 9, 2,
S_VALUE(sneip->InHdrErrors6, sneic->InHdrErrors6, itv),
S_VALUE(sneip->InAddrErrors6, sneic->InAddrErrors6, itv),
S_VALUE(sneip->InUnknownProtos6, sneic->InUnknownProtos6, itv),
}
printf("%-11s", timestamp[curr]);
- cprintf_f(17, 9, 2,
+ cprintf_f(-1, 17, 9, 2,
S_VALUE(snip->InMsgs6, snic->InMsgs6, itv),
S_VALUE(snip->OutMsgs6, snic->OutMsgs6, itv),
S_VALUE(snip->InEchos6, snic->InEchos6, itv),
}
printf("%-11s", timestamp[curr]);
- cprintf_f(11, 9, 2,
+ cprintf_f(-1, 11, 9, 2,
S_VALUE(sneip->InErrors6, sneic->InErrors6, itv),
S_VALUE(sneip->InDestUnreachs6, sneic->InDestUnreachs6, itv),
S_VALUE(sneip->OutDestUnreachs6, sneic->OutDestUnreachs6, itv),
}
printf("%-11s", timestamp[curr]);
- cprintf_f(4, 9, 2,
+ cprintf_f(-1, 4, 9, 2,
S_VALUE(snup->InDatagrams6, snuc->InDatagrams6, itv),
S_VALUE(snup->OutDatagrams6, snuc->OutDatagrams6, itv),
S_VALUE(snup->NoPorts6, snuc->NoPorts6, itv),
if (!dispavg) {
/* Display instantaneous values */
- cprintf_f(1, 9, 2,
+ cprintf_f(-1, 1, 9, 2,
((double) spc->cpufreq) / 100);
printf("\n");
/*
}
else {
/* Display average values */
- cprintf_f(1, 9, 2,
+ cprintf_f(-1, 1, 9, 2,
(double) avg_cpufreq[i] / (100 * avg_count));
printf("\n");
}
if (dispavg) {
/* Display average values */
- cprintf_f(2, 9, 2,
+ cprintf_f(-1, 2, 9, 2,
(double) avg_fan[i] / avg_count,
(double) (avg_fan[i] - avg_fan_min[i]) / avg_count);
}
else {
/* Display instantaneous values */
- cprintf_f(2, 9, 2,
+ cprintf_f(-1, 2, 9, 2,
spc->rpm,
spc->rpm - spc->rpm_min);
avg_fan[i] += spc->rpm;
if (dispavg) {
/* Display average values */
- cprintf_f(1, 9, 2, (double) avg_temp[i] / avg_count);
+ cprintf_f(-1, 1, 9, 2, (double) avg_temp[i] / avg_count);
cprintf_pc(1, 9, 2,
(avg_temp_max[i] - avg_temp_min[i]) ?
((double) (avg_temp[i] / avg_count) - avg_temp_min[i]) / (avg_temp_max[i] - avg_temp_min[i]) * 100
}
else {
/* Display instantaneous values */
- cprintf_f(1, 9, 2, spc->temp);
+ cprintf_f(-1, 1, 9, 2, spc->temp);
cprintf_pc(1, 9, 2,
(spc->temp_max - spc->temp_min) ?
(spc->temp - spc->temp_min) / (spc->temp_max - spc->temp_min) * 100
if (dispavg) {
/* Display average values */
- cprintf_f(1, 9, 2, (double) avg_in[i] / avg_count);
+ cprintf_f(-1, 1, 9, 2, (double) avg_in[i] / avg_count);
cprintf_pc(1, 9, 2,
(avg_in_max[i] - avg_in_min[i]) ?
((double) (avg_in[i] / avg_count) - avg_in_min[i]) / (avg_in_max[i] - avg_in_min[i]) * 100
}
else {
/* Display instantaneous values */
- cprintf_f(1, 9, 2, spc->in);
+ cprintf_f(-1, 1, 9, 2, spc->in);
cprintf_pc(1, 9, 2,
(spc->in_max - spc->in_min) ?
(spc->in - spc->in_min) / (spc->in_max - spc->in_min) * 100
static unsigned long long
avg_frhkb = 0,
avg_tlhkb = 0;
+ int unit = -1;
+
+ if (DISPLAY_UNIT(flags)) {
+ /* Default values unit is kB */
+ unit = 2;
+ }
if (dis) {
print_hdr_line(timestamp[!curr], a, FIRST, 0, 9);
if (!dispavg) {
/* Display instantaneous values */
printf("%-11s", timestamp[curr]);
- cprintf_u64(2, 9,
+ cprintf_u64(unit, 2, 9,
(unsigned long long) smc->frhkb,
(unsigned long long) (smc->tlhkb - smc->frhkb));
cprintf_pc(1, 9, 2,
else {
/* Display average values */
printf("%-11s", timestamp[curr]);
- cprintf_f(2, 9, 0,
+ cprintf_f(unit, 2, 9, 0,
(double) avg_frhkb / avg_count,
((double) avg_tlhkb / avg_count) -
((double) avg_frhkb / avg_count));
}
/* Display weighted frequency for current CPU */
- cprintf_f(1, 9, 2,
+ cprintf_f(-1, 1, 9, 2,
tis ? ((double) tisfreq) / tis : 0.0);
printf("\n");
}
cprintf_x(2, 9,
suc->vendor_id,
suc->product_id);
- cprintf_u64(1, 9,
+ cprintf_u64(-1, 1, 9,
/* bMaxPower is expressed in 2 mA units */
(unsigned long long) (suc->bmaxpower << 1));
{
int i, j;
struct stats_filesystem *sfc, *sfm;
+ int unit = -1;
+
+ if (DISPLAY_UNIT(flags)) {
+ /* Default values unit is B */
+ unit = 1;
+ }
if (dis) {
print_hdr_line((dispavg ? _("Summary:") : timestamp[!curr]),
break;
printf("%-11s", (dispavg ? _("Summary:") : timestamp[curr]));
- cprintf_f(2, 9, 0,
- (double) sfc->f_bfree / 1024 / 1024,
- (double) (sfc->f_blocks - sfc->f_bfree) / 1024 / 1024);
+ cprintf_f(unit, 2, 9, 0,
+ unit < 0 ? (double) sfc->f_bfree / 1024 / 1024 : (double) sfc->f_bfree,
+ unit < 0 ? (double) (sfc->f_blocks - sfc->f_bfree) / 1024 / 1024 :
+ (double) (sfc->f_blocks - sfc->f_bfree));
cprintf_pc(2, 9, 2,
/* f_blocks is not zero. But test it anyway ;-) */
sfc->f_blocks ? SP_VALUE(sfc->f_bfree, sfc->f_blocks, sfc->f_blocks)
: 0.0,
sfc->f_blocks ? SP_VALUE(sfc->f_bavail, sfc->f_blocks, sfc->f_blocks)
: 0.0);
- cprintf_u64(2, 9,
+ cprintf_u64(-1, 2, 9,
(unsigned long long) sfc->f_ffree,
(unsigned long long) (sfc->f_files - sfc->f_ffree));
cprintf_pc(1, 9, 2,
break;
printf("%-11s", timestamp[curr]);
- cprintf_f(4, 9, 2,
+ cprintf_f(-1, 4, 9, 2,
S_VALUE(sfcp->f_rxframes, sfcc->f_rxframes, itv),
S_VALUE(sfcp->f_txframes, sfcc->f_txframes, itv),
S_VALUE(sfcp->f_rxwords, sfcc->f_rxwords, itv),
cprintf_in(IS_INT, " %7d", "", i - 1);
}
- cprintf_f(5, 9, 2,
+ cprintf_f(-1, 5, 9, 2,
S_VALUE(ssnp->processed, ssnc->processed, itv),
S_VALUE(ssnp->dropped, ssnc->dropped, itv),
S_VALUE(ssnp->time_squeeze, ssnc->time_squeeze, itv),