impl-node: save all previous timestamps on start

When the driver starts, save all previous node timestamps, not just the
previous signal time.

For async nodes, uses the previous timestamps in the profiler messages
so that we get stats with 1 cycle of delay instead of bogus values
because the node is still processing.

Fixes pw-top for async nodes.
This commit is contained in:
Wim Taymans 2024-11-15 18:06:12 +01:00
parent 1084cc24b6
commit a997627906
3 changed files with 11 additions and 6 deletions

View file

@ -285,10 +285,10 @@ static void context_do_profile(void *data)
spa_pod_builder_add_struct(&b, spa_pod_builder_add_struct(&b,
SPA_POD_Int(t->id), SPA_POD_Int(t->id),
SPA_POD_String(t->name), SPA_POD_String(t->name),
SPA_POD_Long(a->signal_time), SPA_POD_Long(a->prev_signal_time),
SPA_POD_Long(na->signal_time), SPA_POD_Long(n->async ? na->prev_signal_time : na->signal_time),
SPA_POD_Long(na->awake_time), SPA_POD_Long(n->async ? na->prev_awake_time : na->awake_time),
SPA_POD_Long(na->finish_time), SPA_POD_Long(n->async ? na->prev_finish_time : na->finish_time),
SPA_POD_Int(na->status), SPA_POD_Int(na->status),
SPA_POD_Fraction(&latency), SPA_POD_Fraction(&latency),
SPA_POD_Int(na->xrun_count)); SPA_POD_Int(na->xrun_count));

View file

@ -2183,9 +2183,11 @@ retry_status:
} else { } else {
all_ready &= ta->pending_sync == false; all_ready &= ta->pending_sync == false;
} }
ta->prev_signal_time = ta->signal_time;
ta->prev_awake_time = ta->awake_time;
ta->prev_finish_time = ta->finish_time;
} }
a->prev_signal_time = a->signal_time;
node->driver_start = nsec; node->driver_start = nsec;
a->sync_timeout = SPA_MIN(min_timeout, DEFAULT_SYNC_TIMEOUT); a->sync_timeout = SPA_MIN(min_timeout, DEFAULT_SYNC_TIMEOUT);

View file

@ -610,7 +610,10 @@ struct pw_node_activation {
uint32_t segment_owner[16]; /* id of owners for each segment info struct. uint32_t segment_owner[16]; /* id of owners for each segment info struct.
* nodes that want to update segment info need to * nodes that want to update segment info need to
* CAS their node id in this array. */ * CAS their node id in this array. */
uint32_t padding[11]; /* must be 0 */ uint64_t prev_awake_time;
uint64_t prev_finish_time;
uint32_t padding[7]; /* must be 0 */
uint32_t client_version; /* verions of client, see above */ uint32_t client_version; /* verions of client, see above */
uint32_t server_version; /* verions of server, see above */ uint32_t server_version; /* verions of server, see above */