with the totals (-I) option, most of the fields overflow. comically. this bumps many of their sizes, such that at least my laptop with a whopping three hours uptime doesn't print out a tangled mess. normal display untouched. if we need to pad the fields larger later we can, this is a start.
Index: iostat.c =================================================================== RCS file: /cvs/src/usr.sbin/iostat/iostat.c,v retrieving revision 1.32 diff -u -p -r1.32 iostat.c --- iostat.c 23 Nov 2013 22:51:42 -0000 1.32 +++ iostat.c 11 Feb 2014 23:21:16 -0000 @@ -205,12 +205,18 @@ header(void) /* Main Headers. */ if (ISSET(todo, SHOW_TTY)) - printf(" tty"); + if (ISSET(todo, SHOW_TOTALS)) + printf(" tty"); + else + printf(" tty"); if (ISSET(todo, SHOW_STATS_1)) for (i = 0; i < dk_ndrive; i++) if (cur.dk_select[i]) - printf(" %16.16s ", cur.dk_name[i]); + if (ISSET(todo, SHOW_TOTALS)) + printf(" %18.18s ", cur.dk_name[i]); + else + printf(" %16.16s ", cur.dk_name[i]); if (ISSET(todo, SHOW_STATS_2)) for (i = 0; i < dk_ndrive; i++) if (cur.dk_select[i]) @@ -222,13 +228,16 @@ header(void) /* Sub-Headers. */ if (ISSET(todo, SHOW_TTY)) - printf(" tin tout"); + if (ISSET(todo, SHOW_TOTALS)) + printf(" tin tout"); + else + printf(" tin tout"); if (ISSET(todo, SHOW_STATS_1)) for (i = 0; i < dk_ndrive; i++) if (cur.dk_select[i]) { if (ISSET(todo, SHOW_TOTALS)) - printf(" KB/t xfr MB "); + printf(" KB/t xfr MB "); else printf(" KB/t t/s MB/s "); } @@ -262,7 +271,10 @@ disk_stats(double etime) printf(" %5.2f", mbps); /* average transfers per second. */ - printf(" %4.0f", (cur.dk_rxfer[dn] + cur.dk_wxfer[dn]) / etime); + if (ISSET(todo, SHOW_TOTALS)) + printf(" %5.0f", (cur.dk_rxfer[dn] + cur.dk_wxfer[dn]) / etime); + else + printf(" %4.0f", (cur.dk_rxfer[dn] + cur.dk_wxfer[dn]) / etime); /* time busy in disk activity */ atime = (double)cur.dk_time[dn].tv_sec + @@ -274,7 +286,10 @@ disk_stats(double etime) (double)(1024 * 1024); else mbps = 0; - printf(" %5.2f ", mbps / etime); + if (ISSET(todo, SHOW_TOTALS)) + printf(" %6.2f ", mbps / etime); + else + printf(" %5.2f ", mbps / etime); } } @@ -347,7 +362,12 @@ display(void) etime = 1.0; if (ISSET(todo, SHOW_TTY)) - printf("%4.0f %4.0f", cur.tk_nin / etime, cur.tk_nout / etime); + if (ISSET(todo, SHOW_TOTALS)) + printf("%6.0f %8.0f", cur.tk_nin / etime, + cur.tk_nout / etime); + else + printf("%4.0f %4.0f", cur.tk_nin / etime, + cur.tk_nout / etime); if (ISSET(todo, SHOW_STATS_1)) disk_stats(etime);