[Spice-devel] RFC: Lightweight tracing mechanism

Christophe Fergeau cfergeau at redhat.com
Thu Jun 8 15:38:59 UTC 2017


Hey,

I was about to send an email in the saim vein ;)

On Thu, Jun 08, 2017 at 10:55:55AM -0400, Frediano Ziglio wrote:
> Not much to add honestly. But maybe this thread is try to tackle too
> many things at the same time. What I see on the thread:
> - log categorization. This was similar to Djasa bug but I think he just
>   proposed to use domains in the glib log sense;
> - developer only logging/tracing/tweaks. This requiring a --enable-debug
>   option; I would agree with some additional debug code for instance to
>   check internal status or doing some test of functions or exposing some
>   code;
> - statistics. Like memory usage of different allocations. This make sense
>   if the statistics are trying to distinguish memory using application
>   level knowledge (Valgrind or other tools can distinguish using even
>   source files but can be hard to maintain such categories of memory);

> - tracing hot path code. I agree these should maybe treated in different
>   way. Honestly I fail to see these traces in spice-gtk as Marc-andre'
>   pointed out/ In the past I had done some logging were even a printf
>   was too expensive (or any formatted string by the way) but it was
>   really specific code not worth keeping at the end;

Imo systemtap or similar might be a good fit in such situations
( https://www.sourceware.org/systemtap/wiki/AddingUserSpaceProbingToApps
). Hopefully it's cheap enough.

> - internal tweaks. Tune different aspect. There are already some
>   environment variable to tweak some aspects. Not so extensive however
>   to see the introduction of a new layer of code.

I definitely would not tie this to the logging system, I think it's
marc-andré who pointed out this would get misused/confusing/...,
especially if exposed with the same commandline option as the debug
logs.


Gist of the thread to me seemed to be "do we want log
categories/filtering, and if yes, how do we do it?"

I would answer yes to the first question as Christophe is the second
person to send a patch adding this to spice-common (first attempt was
Victor's some time ago). This leaves the "how" as an open question ;)

I just wanted to note that this could be solved (on linux) with glib
structured logging and journald.
If we log using a SPICE_LOG_CATEGORY field, one can then use
"systemd-cat remote-viewer xxx", "journalctl --field SPICE_LOG_CATEGORY"
and "journalctl _COMM=remote-viewer SPICE_LOG_CATEGORY=display"
(not saying this is the perfect solution, just showing something with
minimum investment on our side).


Final note is that whichever way we decide to go, this is not going to
magically provide us with good debug log ;) And I don't think any of the
above is a prerequisite to improving that, it's easy enough to
categorize things right now with a prefix (or go through a
DEBUG(category, message..) macro if you prefer).

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20170608/0ed0e351/attachment-0001.sig>


More information about the Spice-devel mailing list