mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	module-profiler: add per client xrun count in profiler data
So that pw-top can show the client xruns instead of the driver xruns
This commit is contained in:
		
							parent
							
								
									9727bf3c4b
								
							
						
					
					
						commit
						2d253de359
					
				
					 2 changed files with 15 additions and 5 deletions
				
			
		| 
						 | 
					@ -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->awake_time),
 | 
				
			||||||
			SPA_POD_Long(a->finish_time),
 | 
								SPA_POD_Long(a->finish_time),
 | 
				
			||||||
			SPA_POD_Int(a->status),
 | 
								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) {
 | 
						spa_list_for_each(t, &node->rt.target_list, link) {
 | 
				
			||||||
		struct pw_impl_node *n = t->node;
 | 
							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->awake_time),
 | 
				
			||||||
			SPA_POD_Long(na->finish_time),
 | 
								SPA_POD_Long(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_builder_pop(&b, &f[0]);
 | 
						spa_pod_builder_pop(&b, &f[0]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -22,6 +22,8 @@
 | 
				
			||||||
#define MAX_FORMAT		16
 | 
					#define MAX_FORMAT		16
 | 
				
			||||||
#define MAX_NAME		128
 | 
					#define MAX_NAME		128
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define XRUN_INVALID	(uint32_t)-1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct driver {
 | 
					struct driver {
 | 
				
			||||||
	int64_t count;
 | 
						int64_t count;
 | 
				
			||||||
	float cpu_load[3];
 | 
						float cpu_load[3];
 | 
				
			||||||
| 
						 | 
					@ -38,6 +40,7 @@ struct measurement {
 | 
				
			||||||
	int64_t awake;
 | 
						int64_t awake;
 | 
				
			||||||
	int64_t finish;
 | 
						int64_t finish;
 | 
				
			||||||
	struct spa_fraction latency;
 | 
						struct spa_fraction latency;
 | 
				
			||||||
 | 
						uint32_t xrun_count;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct node {
 | 
					struct node {
 | 
				
			||||||
| 
						 | 
					@ -317,6 +320,7 @@ static int process_driver_block(struct data *d, const struct spa_pod *pod, struc
 | 
				
			||||||
	int res;
 | 
						int res;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_zero(m);
 | 
						spa_zero(m);
 | 
				
			||||||
 | 
						m.xrun_count = XRUN_INVALID;
 | 
				
			||||||
	if ((res = spa_pod_parse_struct(pod,
 | 
						if ((res = spa_pod_parse_struct(pod,
 | 
				
			||||||
			SPA_POD_Int(&id),
 | 
								SPA_POD_Int(&id),
 | 
				
			||||||
			SPA_POD_String(&name),
 | 
								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.awake),
 | 
				
			||||||
			SPA_POD_Long(&m.finish),
 | 
								SPA_POD_Long(&m.finish),
 | 
				
			||||||
			SPA_POD_Int(&m.status),
 | 
								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;
 | 
							return res;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((n = find_node(d, id)) == NULL)
 | 
						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;
 | 
						int res;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_zero(m);
 | 
						spa_zero(m);
 | 
				
			||||||
 | 
						m.xrun_count = XRUN_INVALID;
 | 
				
			||||||
	if ((res = spa_pod_parse_struct(pod,
 | 
						if ((res = spa_pod_parse_struct(pod,
 | 
				
			||||||
			SPA_POD_Int(&id),
 | 
								SPA_POD_Int(&id),
 | 
				
			||||||
			SPA_POD_String(&name),
 | 
								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.awake),
 | 
				
			||||||
			SPA_POD_Long(&m.finish),
 | 
								SPA_POD_Long(&m.finish),
 | 
				
			||||||
			SPA_POD_Int(&m.status),
 | 
								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;
 | 
							return res;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((n = find_node(d, id)) == NULL)
 | 
						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_time(buf2, active, 64, busy),
 | 
				
			||||||
			print_perc(buf3, active, 64, waiting, quantum),
 | 
								print_perc(buf3, active, 64, waiting, quantum),
 | 
				
			||||||
			print_perc(buf4, active, 64, busy, 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 : "",
 | 
								active ? n->format : "",
 | 
				
			||||||
			n->driver == n ? "" : " + ",
 | 
								n->driver == n ? "" : " + ",
 | 
				
			||||||
			n->name);
 | 
								n->name);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue