mirror of
https://gitlab.freedesktop.org/wayland/weston.git
synced 2026-05-25 15:08:15 +02:00
trace: Ensure flow id is always set
Ever since 160394b2c3 we can have
perfetto flow ids in const structs.
We need to preserve the perfetto flow even when tracing is disabled -
a flow will start in a function that has non-const access to a struct,
but other functions further along the flow may only have const access.
Fix up "instant annotations" to preserve flows when not tracing, and to
reset the annotation count on commit when not tracing.
I suppose this also fixes a potential race where annotations aren't
properly reset if tracing is started and stopped multiple times during
the execution of a single function - but I can't imagine that being possible
to hit.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This commit is contained in:
parent
8a1c91e771
commit
9ce3759bc5
1 changed files with 10 additions and 9 deletions
|
|
@ -106,9 +106,7 @@
|
|||
|
||||
#define _WESTON_TRACE_COMMIT_ANNOTATION(id, name) \
|
||||
do { \
|
||||
if (unlikely(util_perfetto_is_tracing_enabled())) { \
|
||||
_weston_trace_scope_annotate_commit(id, name, &__pd_annots); \
|
||||
} \
|
||||
_weston_trace_scope_annotate_commit(id, name, &__pd_annots); \
|
||||
} while (0)
|
||||
|
||||
/* annotated funcs */
|
||||
|
|
@ -219,15 +217,18 @@ static inline void
|
|||
_weston_trace_scope_annotate_commit(uint64_t *id, const char *name,
|
||||
struct weston_debug_annotations *annots)
|
||||
{
|
||||
if (id && *id == 0) {
|
||||
*id = util_perfetto_next_id();
|
||||
util_perfetto_trace_commit_debug_annots(*id, name, annots);
|
||||
goto reset_entries;
|
||||
uint64_t flow_id = 0;
|
||||
|
||||
if (id) {
|
||||
if (*id == 0)
|
||||
*id = util_perfetto_next_id();
|
||||
|
||||
flow_id = *id;
|
||||
}
|
||||
|
||||
util_perfetto_trace_commit_debug_annots(0, name, annots);
|
||||
if (unlikely(util_perfetto_is_tracing_enabled()))
|
||||
util_perfetto_trace_commit_debug_annots(flow_id, name, annots);
|
||||
|
||||
reset_entries:
|
||||
annots->count = 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue