HomeFreeBSD

script add -T fmt to print time-stamps

Description

script add -T fmt to print time-stamps

script -r is useful for recording time-stamps of when output
happened. With -T, rather than playback the script in real-time
we simply print the time-stamps to show when the output happened.

This is very useful for example, for analyzing boot time activity.

If the fmt provided contains no % characters the default
%n@ %s [%Y-%m-%d %T]
is used, which lends itself to analysis by tools as well as humans.

Sponsored by: Juniper Networks, Inc.

Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D34511

(cherry picked from commit 6c4afed5667a65f3c5bd308a934e7de8c0526954)

script -T skip timstamps for same second

The result is much more readable if we only output the time-stamp
when it is at least 1s since last one.

(cherry picked from commit 7b45ad3f89cc4d65a23f7d034329dd3f8dd3105f)

script: use %n at the end of default tstamp_fmt

Since we are only outputting time-stamps when they differ
ending it with a newline, interferes with the output less.

(cherry picked from commit 31fde973577d0e09caccf0d762135bfa6b14f1f3)

Details

Provenance
sjgAuthored on Mar 9 2022, 9:33 PM
desCommitted on Nov 2 2022, 9:44 AM
Reviewer
allanjude
Differential Revision
D34511: script add -T fmt to print time-stamps
Parents
rG7302f8697124: w: cosmetic fixes.
Branches
Unknown
Tags
Unknown