From 2ee7996cf7137783c0131b3e7c2e77a6d6e563f7 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 25 May 2023 20:22:49 +0200 Subject: [PATCH] impl-node: improve stats The signal_time of the driver is supposed to be the time when the driver started, not when it was signaled the last time to complete the graph. Remember the start time and override the signal time when the graph completes. --- src/pipewire/impl-node.c | 2 ++ src/pipewire/private.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/pipewire/impl-node.c b/src/pipewire/impl-node.c index cadf0515c..7295242fa 100644 --- a/src/pipewire/impl-node.c +++ b/src/pipewire/impl-node.c @@ -1242,6 +1242,7 @@ static inline int process_node(void *data) trigger_targets(this, status, nsec); } else { /* calculate CPU time when finished */ + a->signal_time = this->driver_start; calculate_stats(this, a); pw_context_driver_emit_complete(this->context, this); } @@ -1821,6 +1822,7 @@ again: a->status = PW_NODE_ACTIVATION_TRIGGERED; a->prev_signal_time = a->signal_time; a->signal_time = nsec; + node->driver_start = nsec; a->sync_timeout = SPA_MIN(min_timeout, DEFAULT_SYNC_TIMEOUT); diff --git a/src/pipewire/private.h b/src/pipewire/private.h index f1cec889d..0743a3d8b 100644 --- a/src/pipewire/private.h +++ b/src/pipewire/private.h @@ -803,6 +803,8 @@ struct pw_impl_node { struct spa_fraction target_rate; uint64_t target_quantum; + uint64_t driver_start; + void *user_data; /**< extra user data */ };