remote-node: don't send signal/awake time in ready

Let the server calculate signal time when it starts the graph. Otherwise
we overwrite old values and we can't do stats.

We might be able to piggyback the signal time in the prev_signal_time
field later.
This commit is contained in:
Wim Taymans 2023-05-03 11:06:14 +02:00
parent 604d60650a
commit bcbb6e42e7
2 changed files with 4 additions and 15 deletions

View file

@ -1181,9 +1181,7 @@ static int node_ready(void *d, int status)
struct pw_impl_node *node = data->node; struct pw_impl_node *node = data->node;
struct pw_node_activation *a = node->rt.activation; struct pw_node_activation *a = node->rt.activation;
struct spa_system *data_system = data->data_system; struct spa_system *data_system = data->data_system;
struct timespec ts;
struct pw_impl_port *p; struct pw_impl_port *p;
uint64_t now;
pw_log_trace_fp("node %p: ready driver:%d exported:%d status:%d", node, pw_log_trace_fp("node %p: ready driver:%d exported:%d status:%d", node,
node->driver, node->exported, status); node->driver, node->exported, status);
@ -1194,11 +1192,6 @@ static int node_ready(void *d, int status)
} }
a->state[0].status = status; a->state[0].status = status;
spa_system_clock_gettime(data_system, CLOCK_MONOTONIC, &ts);
now = SPA_TIMESPEC_TO_NSEC(&ts);
a->signal_time = now;
a->awake_time = now;
if (SPA_UNLIKELY(spa_system_eventfd_write(data_system, data->rtwritefd, 1) < 0)) if (SPA_UNLIKELY(spa_system_eventfd_write(data_system, data->rtwritefd, 1) < 0))
pw_log_warn("node %p: write failed %m", node); pw_log_warn("node %p: write failed %m", node);

View file

@ -1713,8 +1713,6 @@ static int node_ready(void *data, int status)
node_signal_func(node); node_signal_func(node);
} else { } else {
/* calculate CPU time */ /* calculate CPU time */
uint64_t new_signal = a->signal_time;
a->signal_time = a->prev_signal_time; a->signal_time = a->prev_signal_time;
a->prev_signal_time = impl->prev_signal_time; a->prev_signal_time = impl->prev_signal_time;
@ -1729,9 +1727,6 @@ static int node_ready(void *data, int status)
a->cpu_load[0], a->cpu_load[1], a->cpu_load[2]); a->cpu_load[0], a->cpu_load[1], a->cpu_load[2]);
pw_context_driver_emit_complete(node->context, node); pw_context_driver_emit_complete(node->context, node);
a->prev_signal_time = a->signal_time;
a->signal_time = new_signal;
} }
/* This update is done too late, the driver should do this /* This update is done too late, the driver should do this
@ -1784,11 +1779,10 @@ again:
} }
a->status = PW_NODE_ACTIVATION_TRIGGERED; a->status = PW_NODE_ACTIVATION_TRIGGERED;
if (!node->exported) a->signal_time = nsec;
a->signal_time = nsec;
impl->prev_signal_time = a->prev_signal_time; impl->prev_signal_time = a->prev_signal_time;
a->prev_signal_time = a->signal_time; a->prev_signal_time = a->signal_time;
a->sync_timeout = SPA_MIN(min_timeout, DEFAULT_SYNC_TIMEOUT); a->sync_timeout = SPA_MIN(min_timeout, DEFAULT_SYNC_TIMEOUT);
if (SPA_UNLIKELY(reposition_node)) { if (SPA_UNLIKELY(reposition_node)) {
@ -1807,6 +1801,8 @@ again:
return 0; return 0;
if (!node->driver) { if (!node->driver) {
/* legacy, nodes should directly resume the graph by calling
* the peer eventfd directly, node_ready is only for drivers */
a->status = PW_NODE_ACTIVATION_FINISHED; a->status = PW_NODE_ACTIVATION_FINISHED;
a->finish_time = nsec; a->finish_time = nsec;
} }