compositor: Implement JSON-timeline logging
authorPekka Paalanen <pekka.paalanen@collabora.co.uk>
Wed, 12 Nov 2014 13:09:24 +0000 (15:09 +0200)
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>
Mon, 8 Dec 2014 13:02:56 +0000 (15:02 +0200)
commitb502654b9fd9263964ccc4bdcbd8d633233b4f87
tree7d4b06d17c4ec96a10616e27596aeb9a053dc23b
parent8274d901f119b9c7df107fe511114b1b317da59f
compositor: Implement JSON-timeline logging

Logging is activated and deactivated with the debug key binding 't'.
When activated, it creates a new log file, where it records the events.
The log file contains events and detailed object information entries in
JSON format, and is meant to be parsed in sequence from beginning to the
end.

The emitted events are mostly related to the output repaint cycle, like
when repaint begins, is submitted to GPU, and when it completes on a
vblank. This is recorded per-output. Also some per-surface events are
recorded, including when surface damage is flushed.

To reduce the log size, events refer to objects like outputs and
surfaces by id numbers. Detailed object information is emitted only as
needed: on the first object occurrence, and afterwards only if
weston_timeline_object::force_refresh asks for it.

The detailed information for surfaces includes the string returned by
weston_surface::get_label. Therefore it is important to set
weston_timeline_object::force_refresh = 1 whenever the string would
change, so that the new details get recorded.

A rudimentary parser and SVG generator can be found at:
https://github.com/ppaalanen/wesgr

The timeline logs can answer questions including:
- How does the compositor repaint cycle work timing-wise?
- When was the vblank deadline missed?
- What is the latency from surface commit to showing the new content on
  screen?
- How long does it take to process the scenegraph?

v2: weston_surface::get_description renamed to get_label.
v3: reafctor a bit into fprint_quoted_string().

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Makefile.am
desktop-shell/shell.c
src/compositor.c
src/compositor.h
src/timeline-object.h [new file with mode: 0644]
src/timeline.c [new file with mode: 0644]
src/timeline.h [new file with mode: 0644]