iostat: add -T to show timestamp for each line for easy grep#414
Open
dublio wants to merge 1 commit intosysstat:masterfrom
Open
iostat: add -T to show timestamp for each line for easy grep#414dublio wants to merge 1 commit intosysstat:masterfrom
dublio wants to merge 1 commit intosysstat:masterfrom
Conversation
Author
Author
This patch add new -T option to show timestamp for each output line,
it's more friendly for user to grep some time window from iostat log.
For basic stats:
./iostat -mt 1 sda sdb
Linux 5.15.0-97-generic (zwp-5820-Tower) 09/29/25 _x86_64_ (16 CPU)
09/29/25 15:22:03
avg-cpu: %user %nice %system %iowait %steal %idle
0.83 0.00 1.56 0.47 0.00 97.14
Device tps MB_read/s MB_wrtn/s MB_dscd/s MB_read MB_wrtn MB_dscd
sda 72.08 0.00 0.38 0.00 5060 2631239 0
sdb 0.00 0.00 0.00 0.00 0 0 0
./iostat -mT 1 sda sdb
Linux 5.15.0-97-generic (zwp-5820-Tower) 09/29/25 _x86_64_ (16 CPU)
Datetime avg-cpu: %user %nice %system %iowait %steal %idle
09/29/25 15:22:19 0.83 0.00 1.56 0.47 0.00 97.14
Datetime Device tps MB_read/s MB_wrtn/s MB_dscd/s MB_read MB_wrtn MB_dscd
09/29/25 15:22:19 sda 72.08 0.00 0.38 0.00 5060 2631254 0
09/29/25 15:22:19 sdb 0.00 0.00 0.00 0.00 0 0 0
For extend stats:
./iostat -xmt 1 sda sdb
Linux 5.15.0-97-generic (zwp-5820-Tower) 09/29/25 _x86_64_ (16 CPU)
09/29/25 15:21:08
avg-cpu: %user %nice %system %iowait %steal %idle
0.83 0.00 1.56 0.47 0.00 97.14
Device r/s rMB/s rrqm/s %rrqm r_await rareq-sz w/s wMB/s wrqm/s %wrqm w_await wareq-sz d/s dMB/s drqm/s %drqm d_await dareq-sz f/s f_await aqu-sz %util
sda 0.03 0.00 0.01 18.76 42.11 25.95 72.05 0.38 11.83 14.10 6.13 5.42 0.00 0.00 0.00 0.00 0.00 0.00 0.25 24.93 0.45 7.27
sdb 0.00 0.00 0.00 0.00 1.33 0.17 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
./iostat -xmT 1 sda sdb
Linux 5.15.0-97-generic (zwp-5820-Tower) 09/29/25 _x86_64_ (16 CPU)
Datetime avg-cpu: %user %nice %system %iowait %steal %idle
09/29/25 15:21:34 0.83 0.00 1.56 0.47 0.00 97.14
Datetime Device r/s rMB/s rrqm/s %rrqm r_await rareq-sz w/s wMB/s wrqm/s %wrqm w_await wareq-sz d/s dMB/s drqm/s %drqm d_await dareq-sz f/s f_await aqu-sz %util
09/29/25 15:21:34 sda 0.03 0.00 0.01 18.76 42.11 25.95 72.05 0.38 11.83 14.10 6.13 5.42 0.00 0.00 0.00 0.00 0.00 0.00 0.25 24.93 0.45 7.27
09/29/25 15:21:34 sdb 0.00 0.00 0.00 0.00 1.33 0.17 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
Signed-off-by: zhangweiping <zhangweiping@didiglobal.com>
Author
|
@sysstat ping |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



This patch add new -T option to show timestamp for each output line, it's more friendly for user to grep some time window from iostat log.
For basic stats:
./iostat -mt 1 sda sdb
Linux 5.15.0-97-generic (zwp-5820-Tower) 09/29/25 x86_64 (16 CPU)
09/29/25 15:22:03
avg-cpu: %user %nice %system %iowait %steal %idle
0.83 0.00 1.56 0.47 0.00 97.14
Device tps MB_read/s MB_wrtn/s MB_dscd/s MB_read MB_wrtn MB_dscd
sda 72.08 0.00 0.38 0.00 5060 2631239 0
sdb 0.00 0.00 0.00 0.00 0 0 0
./iostat -mT 1 sda sdb
Linux 5.15.0-97-generic (zwp-5820-Tower) 09/29/25 x86_64 (16 CPU)
Datetime avg-cpu: %user %nice %system %iowait %steal %idle
09/29/25 15:22:19 0.83 0.00 1.56 0.47 0.00 97.14
Datetime Device tps MB_read/s MB_wrtn/s MB_dscd/s MB_read MB_wrtn MB_dscd
09/29/25 15:22:19 sda 72.08 0.00 0.38 0.00 5060 2631254 0
09/29/25 15:22:19 sdb 0.00 0.00 0.00 0.00 0 0 0
For extend stats:
./iostat -xmt 1 sda sdb
Linux 5.15.0-97-generic (zwp-5820-Tower) 09/29/25 x86_64 (16 CPU)
09/29/25 15:21:08
avg-cpu: %user %nice %system %iowait %steal %idle
0.83 0.00 1.56 0.47 0.00 97.14
Device r/s rMB/s rrqm/s %rrqm r_await rareq-sz w/s wMB/s wrqm/s %wrqm w_await wareq-sz d/s dMB/s drqm/s %drqm d_await dareq-sz f/s f_await aqu-sz %util
sda 0.03 0.00 0.01 18.76 42.11 25.95 72.05 0.38 11.83 14.10 6.13 5.42 0.00 0.00 0.00 0.00 0.00 0.00 0.25 24.93 0.45 7.27
sdb 0.00 0.00 0.00 0.00 1.33 0.17 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
./iostat -xmT 1 sda sdb
Linux 5.15.0-97-generic (zwp-5820-Tower) 09/29/25 x86_64 (16 CPU)
Datetime avg-cpu: %user %nice %system %iowait %steal %idle
09/29/25 15:21:34 0.83 0.00 1.56 0.47 0.00 97.14
Datetime Device r/s rMB/s rrqm/s %rrqm r_await rareq-sz w/s wMB/s wrqm/s %wrqm w_await wareq-sz d/s dMB/s drqm/s %drqm d_await dareq-sz f/s f_await aqu-sz %util
09/29/25 15:21:34 sda 0.03 0.00 0.01 18.76 42.11 25.95 72.05 0.38 11.83 14.10 6.13 5.42 0.00 0.00 0.00 0.00 0.00 0.00 0.25 24.93 0.45 7.27
09/29/25 15:21:34 sdb 0.00 0.00 0.00 0.00 1.33 0.17 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00