Re: dmesg feature request: timestamps relative to current time

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Feb 16, 2022 at 04:33:43PM +0800, Wesley Aptekar-Cassels wrote:
> Hi all,
> 
> When I use dmesg, I'm often annoyed that there isn't a good way to tell how
> long ago a specific log line was from. The only accurate way to do so that I've
> found is to look at /proc/uptime and compare that value to the log line I care
> about. The ctime and iso options could be useful, but as the manpage points
> out, they are inaccurate in the case of suspend/resume, and I'd still have to
> do math in my head to see how long ago something was, even if it's easier to do
> the conversion than with the default style of timestamp.
> 
> I'd like to see a value for the --time-format option that prints timestamps as
> values in seconds relative to the time dmesg was executed.

Do we really need it? :-) I mean that

     --time-format ctime

makes connection between the log messages and real clocks. Is it enough?

> This would allow
> people to quickly see how long ago a relevant event happened. I'm not sure
> whether it would make more sense to conceive of times in the past as being
> negative or positive, but one or the other would need to be selected (one might
> see both in the case of --follow)

I think negative numbers makes sense for this use-case. For example
"--time-format reltime" uses positive number relative to system start,
you want something like "reverse-reltime". Something like:

    [    -6.634976] IPv6: ADDRCONF(NETDEV_CHANGE): eno1: link becomes ready

> I'm happy to write a patch if
> so, but wanted to check here first to see if it's something that'd be likely to
> be accepted.

I have nothing against this feature. So, go ahead if you want.

    Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux