From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: qemu-devel@nongnu.org,
"Pierrick Bouvier" <pierrick.bouvier@linaro.org>,
"Mahmoud Mandour" <ma.mandourr@gmail.com>,
"Alexandre Iooss" <erdnaxe@crans.org>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Mads Ynddal" <mads@ynddal.dk>,
"Vladimir Sementsov-Ogievskiy" <vsementsov@yandex-team.ru>
Subject: Re: [PULL 1/1] trace: log.py: human-readable timestamp
Date: Mon, 21 Jul 2025 19:57:06 +0100 [thread overview]
Message-ID: <aH6Ngt6dmk56uMEt@redhat.com> (raw)
In-Reply-To: <20250721181051.61143-2-stefanha@redhat.com>
On Mon, Jul 21, 2025 at 02:10:51PM -0400, Stefan Hajnoczi wrote:
> From: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
>
> So tired to parse all these timestamps, when need to compare them
> with other logs.
>
> Use iso8601 format as in warn_report() (info_report(), error_report())
> already used.
>
> Also, start line with date, to be similar with warn_report() as well.
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
> Message-id: 20250626195514.366177-1-vsementsov@yandex-team.ru
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
> scripts/tracetool/backend/log.py | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/scripts/tracetool/backend/log.py b/scripts/tracetool/backend/log.py
> index 17ba1cd90e..61118474b1 100644
> --- a/scripts/tracetool/backend/log.py
> +++ b/scripts/tracetool/backend/log.py
> @@ -39,10 +39,15 @@ def generate_h(event, group):
> ' if (message_with_timestamp) {',
> ' struct timeval _now;',
> ' gettimeofday(&_now, NULL);',
> + ' time_t _seconds = _now.tv_sec;',
> + ' struct tm _tm;',
> + ' gmtime_r(&_seconds, &_tm);',
> '#line %(event_lineno)d "%(event_filename)s"',
> - ' qemu_log("%%d@%%zu.%%06zu:%(name)s " %(fmt)s "\\n",',
> - ' qemu_get_thread_id(),',
> - ' (size_t)_now.tv_sec, (size_t)_now.tv_usec',
> + ' qemu_log("%%04d-%%02d-%%02dT%%02d:%%02d:%%02d.%%06ldZ'
> + ' (%%d) %(name)s " %(fmt)s "\\n",',
> + ' _tm.tm_year + 1900, _tm.tm_mon + 1, _tm.tm_mday,',
> + ' _tm.tm_hour, _tm.tm_min, _tm.tm_sec, _now.tv_usec,',
> + ' qemu_get_thread_id()',
> ' %(argnames)s);',
IMHO this is undesirable, as it bloats the QEMU binaries by another 1 MB
as we have an excessive amount of code being inlined in every trace call
location. I've co-incidentally just sent a patch that would fix the same
problem based on a discussion last week about a bug caused by this log
backend adding 'error-report.h' into all files:
https://lists.nongnu.org/archive/html/qemu-devel/2025-07/msg04905.html
> '#line %(out_next_lineno)d "%(out_filename)s"',
> ' } else {',
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
next prev parent reply other threads:[~2025-07-21 19:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-21 18:10 [PULL 0/1] Tracing patches Stefan Hajnoczi
2025-07-21 18:10 ` [PULL 1/1] trace: log.py: human-readable timestamp Stefan Hajnoczi
2025-07-21 18:57 ` Daniel P. Berrangé [this message]
2025-07-21 20:16 ` Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aH6Ngt6dmk56uMEt@redhat.com \
--to=berrange@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=erdnaxe@crans.org \
--cc=ma.mandourr@gmail.com \
--cc=mads@ynddal.dk \
--cc=pierrick.bouvier@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=vsementsov@yandex-team.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.