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.
This commit is contained in:
Wim Taymans 2023-05-25 20:22:49 +02:00
parent 3d68c7124d
commit 2ee7996cf7
2 changed files with 4 additions and 0 deletions

View File

@ -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);

View File

@ -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 */
};