All of lore.kernel.org
 help / color / mirror / Atom feed
* dmesg feature request: timestamps relative to current time
@ 2022-02-16  8:33 Wesley Aptekar-Cassels
  2022-02-28  9:54 ` Karel Zak
  0 siblings, 1 reply; 2+ messages in thread
From: Wesley Aptekar-Cassels @ 2022-02-16  8:33 UTC (permalink / raw)
  To: util-linux

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. 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).

Is this a feature people would be open to adding? 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.

Thanks,

:w

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: dmesg feature request: timestamps relative to current time
  2022-02-16  8:33 dmesg feature request: timestamps relative to current time Wesley Aptekar-Cassels
@ 2022-02-28  9:54 ` Karel Zak
  0 siblings, 0 replies; 2+ messages in thread
From: Karel Zak @ 2022-02-28  9:54 UTC (permalink / raw)
  To: Wesley Aptekar-Cassels; +Cc: util-linux

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@redhat.com>
 http://karelzak.blogspot.com


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-02-28  9:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-16  8:33 dmesg feature request: timestamps relative to current time Wesley Aptekar-Cassels
2022-02-28  9:54 ` Karel Zak

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.