diff --git a/src/modules/module-profiler.c b/src/modules/module-profiler.c index 36c096b7a..8b6360874 100644 --- a/src/modules/module-profiler.c +++ b/src/modules/module-profiler.c @@ -213,7 +213,8 @@ static void context_do_profile(void *data, struct pw_impl_node *node) SPA_POD_Long(a->awake_time), SPA_POD_Long(a->finish_time), SPA_POD_Int(a->status), - SPA_POD_Fraction(&node->latency)); + SPA_POD_Fraction(&node->latency), + SPA_POD_Int(a->xrun_count)); spa_list_for_each(t, &node->rt.target_list, link) { struct pw_impl_node *n = t->node; @@ -245,7 +246,8 @@ static void context_do_profile(void *data, struct pw_impl_node *node) SPA_POD_Long(na->awake_time), SPA_POD_Long(na->finish_time), SPA_POD_Int(na->status), - SPA_POD_Fraction(&latency)); + SPA_POD_Fraction(&latency), + SPA_POD_Int(na->xrun_count)); } spa_pod_builder_pop(&b, &f[0]); diff --git a/src/tools/pw-top.c b/src/tools/pw-top.c index 835ab85fd..5e27a7be3 100644 --- a/src/tools/pw-top.c +++ b/src/tools/pw-top.c @@ -22,6 +22,8 @@ #define MAX_FORMAT 16 #define MAX_NAME 128 +#define XRUN_INVALID (uint32_t)-1 + struct driver { int64_t count; float cpu_load[3]; @@ -38,6 +40,7 @@ struct measurement { int64_t awake; int64_t finish; struct spa_fraction latency; + uint32_t xrun_count; }; struct node { @@ -317,6 +320,7 @@ static int process_driver_block(struct data *d, const struct spa_pod *pod, struc int res; spa_zero(m); + m.xrun_count = XRUN_INVALID; if ((res = spa_pod_parse_struct(pod, SPA_POD_Int(&id), SPA_POD_String(&name), @@ -325,7 +329,8 @@ static int process_driver_block(struct data *d, const struct spa_pod *pod, struc SPA_POD_Long(&m.awake), SPA_POD_Long(&m.finish), SPA_POD_Int(&m.status), - SPA_POD_Fraction(&m.latency))) < 0) + SPA_POD_Fraction(&m.latency), + SPA_POD_OPT_Int(&m.xrun_count))) < 0) return res; if ((n = find_node(d, id)) == NULL) @@ -348,6 +353,7 @@ static int process_follower_block(struct data *d, const struct spa_pod *pod, str int res; spa_zero(m); + m.xrun_count = XRUN_INVALID; if ((res = spa_pod_parse_struct(pod, SPA_POD_Int(&id), SPA_POD_String(&name), @@ -356,7 +362,8 @@ static int process_follower_block(struct data *d, const struct spa_pod *pod, str SPA_POD_Long(&m.awake), SPA_POD_Long(&m.finish), SPA_POD_Int(&m.status), - SPA_POD_Fraction(&m.latency))) < 0) + SPA_POD_Fraction(&m.latency), + SPA_POD_OPT_Int(&m.xrun_count))) < 0) return res; if ((n = find_node(d, id)) == NULL) @@ -463,7 +470,8 @@ static void print_node(struct data *d, struct driver *i, struct node *n, int y) print_time(buf2, active, 64, busy), print_perc(buf3, active, 64, waiting, quantum), print_perc(buf4, active, 64, busy, quantum), - i->xrun_count, + n->measurement.xrun_count == XRUN_INVALID ? + i->xrun_count : n->measurement.xrun_count, active ? n->format : "", n->driver == n ? "" : " + ", n->name);