* [Qemu-devel] [PATCH] tracetool: Include thread id information in log backend
@ 2018-10-04 14:30 Fabiano Rosas
2018-11-05 9:18 ` Stefan Hajnoczi
0 siblings, 1 reply; 2+ messages in thread
From: Fabiano Rosas @ 2018-10-04 14:30 UTC (permalink / raw)
To: qemu-devel; +Cc: Stefan Hajnoczi
Currently the log backend prints the process id of QEMU at the start
of each output line, but since threads share the same PID there is no
clear distinction between their outputs.
Having the thread id present in the log makes it easier to see when
output comes from different threads. E.g.:
12423@1538597569.672527:qemu_mutex_lock waiting on mutex 0x1103ee60 (/root/qemu/util/main-loop.c:236)
...
12430@1538597569.503928:qemu_mutex_unlock released mutex 0x1103ee60 (/root/qemu/cpus.c:1238)
12431@1538597569.503937:qemu_mutex_locked taken mutex 0x1103ee60 (/root/qemu/cpus.c:1257)
^here
In the above, 12423 is the main process id and 12430 & 12431 are the
two vcpu threads.
(qemu) info cpus
* CPU #0: thread_id=12430
CPU #1: thread_id=12431
Suggested-by: Murilo Opsfelder Araujo <muriloo@linux.ibm.com>
Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com>
---
scripts/tracetool/backend/log.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/tracetool/backend/log.py b/scripts/tracetool/backend/log.py
index 6751f41bc5..33c95af8e9 100644
--- a/scripts/tracetool/backend/log.py
+++ b/scripts/tracetool/backend/log.py
@@ -39,7 +39,7 @@ def generate_h(event, group):
' struct timeval _now;',
' gettimeofday(&_now, NULL);',
' qemu_log("%%d@%%zu.%%06zu:%(name)s " %(fmt)s "\\n",',
- ' getpid(),',
+ ' qemu_get_thread_id(),',
' (size_t)_now.tv_sec, (size_t)_now.tv_usec',
' %(argnames)s);',
' }',
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] tracetool: Include thread id information in log backend
2018-10-04 14:30 [Qemu-devel] [PATCH] tracetool: Include thread id information in log backend Fabiano Rosas
@ 2018-11-05 9:18 ` Stefan Hajnoczi
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Hajnoczi @ 2018-11-05 9:18 UTC (permalink / raw)
To: Fabiano Rosas; +Cc: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 1205 bytes --]
On Thu, Oct 04, 2018 at 11:30:09AM -0300, Fabiano Rosas wrote:
> Currently the log backend prints the process id of QEMU at the start
> of each output line, but since threads share the same PID there is no
> clear distinction between their outputs.
>
> Having the thread id present in the log makes it easier to see when
> output comes from different threads. E.g.:
>
> 12423@1538597569.672527:qemu_mutex_lock waiting on mutex 0x1103ee60 (/root/qemu/util/main-loop.c:236)
> ...
> 12430@1538597569.503928:qemu_mutex_unlock released mutex 0x1103ee60 (/root/qemu/cpus.c:1238)
> 12431@1538597569.503937:qemu_mutex_locked taken mutex 0x1103ee60 (/root/qemu/cpus.c:1257)
> ^here
>
> In the above, 12423 is the main process id and 12430 & 12431 are the
> two vcpu threads.
>
> (qemu) info cpus
> * CPU #0: thread_id=12430
> CPU #1: thread_id=12431
>
> Suggested-by: Murilo Opsfelder Araujo <muriloo@linux.ibm.com>
> Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com>
> ---
> scripts/tracetool/backend/log.py | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Thanks, applied to my tracing-next tree:
https://github.com/stefanha/qemu/commits/tracing-next
Stefan
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-11-05 9:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-04 14:30 [Qemu-devel] [PATCH] tracetool: Include thread id information in log backend Fabiano Rosas
2018-11-05 9:18 ` Stefan Hajnoczi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).