mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	profiler: add transport state in the profile block
Add transport state to the profiler clock info and show this in pw-top as t and T states. Update the docs some more.
This commit is contained in:
		
							parent
							
								
									94d19f2673
								
							
						
					
					
						commit
						ccf899a709
					
				
					 4 changed files with 24 additions and 10 deletions
				
			
		| 
						 | 
					@ -27,6 +27,8 @@ Node status.
 | 
				
			||||||
- S = SUSPENDED
 | 
					- S = SUSPENDED
 | 
				
			||||||
- I = IDLE
 | 
					- I = IDLE
 | 
				
			||||||
- R = RUNNING
 | 
					- R = RUNNING
 | 
				
			||||||
 | 
					- t = RUNNING + transport starting
 | 
				
			||||||
 | 
					- T = RUNNING + transport running
 | 
				
			||||||
\endparblock
 | 
					\endparblock
 | 
				
			||||||
 | 
					
 | 
				
			||||||
\par ID
 | 
					\par ID
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -39,7 +39,8 @@ enum spa_profiler {
 | 
				
			||||||
							  *      Long : clock duration,
 | 
												  *      Long : clock duration,
 | 
				
			||||||
							  *      Long : clock delay,
 | 
												  *      Long : clock delay,
 | 
				
			||||||
							  *      Double : clock rate_diff,
 | 
												  *      Double : clock rate_diff,
 | 
				
			||||||
							  *      Long : clock next_nsec)) */
 | 
												  *      Long : clock next_nsec,
 | 
				
			||||||
 | 
												  *      Int : transport_state)) */
 | 
				
			||||||
	SPA_PROFILER_driverBlock,			/**< generic driver info block
 | 
						SPA_PROFILER_driverBlock,			/**< generic driver info block
 | 
				
			||||||
							  *  (Struct(
 | 
												  *  (Struct(
 | 
				
			||||||
							  *      Int : driver_id,
 | 
												  *      Int : driver_id,
 | 
				
			||||||
| 
						 | 
					@ -48,8 +49,9 @@ enum spa_profiler {
 | 
				
			||||||
							  *      Long : driver signal,
 | 
												  *      Long : driver signal,
 | 
				
			||||||
							  *      Long : driver awake,
 | 
												  *      Long : driver awake,
 | 
				
			||||||
							  *      Long : driver finish,
 | 
												  *      Long : driver finish,
 | 
				
			||||||
							  *      Int : driver status),
 | 
												  *      Int : driver status,
 | 
				
			||||||
							  *      Fraction : latency))  */
 | 
												  *      Fraction : latency,
 | 
				
			||||||
 | 
												  *      Int : xrun_count))  */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	SPA_PROFILER_START_Follower	= 0x20000,	/**< follower related profiler properties */
 | 
						SPA_PROFILER_START_Follower	= 0x20000,	/**< follower related profiler properties */
 | 
				
			||||||
	SPA_PROFILER_followerBlock,			/**< generic follower info block
 | 
						SPA_PROFILER_followerBlock,			/**< generic follower info block
 | 
				
			||||||
| 
						 | 
					@ -61,7 +63,8 @@ enum spa_profiler {
 | 
				
			||||||
							  *      Long : awake,
 | 
												  *      Long : awake,
 | 
				
			||||||
							  *      Long : finish,
 | 
												  *      Long : finish,
 | 
				
			||||||
							  *      Int : status,
 | 
												  *      Int : status,
 | 
				
			||||||
							  *      Fraction : latency))  */
 | 
												  *      Fraction : latency,
 | 
				
			||||||
 | 
												  *      Int : xrun_count))  */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	SPA_PROFILER_START_CUSTOM	= 0x1000000,
 | 
						SPA_PROFILER_START_CUSTOM	= 0x1000000,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -199,8 +199,8 @@ static void context_do_profile(void *data)
 | 
				
			||||||
			SPA_POD_Long(pos->clock.duration),
 | 
								SPA_POD_Long(pos->clock.duration),
 | 
				
			||||||
			SPA_POD_Long(pos->clock.delay),
 | 
								SPA_POD_Long(pos->clock.delay),
 | 
				
			||||||
			SPA_POD_Double(pos->clock.rate_diff),
 | 
								SPA_POD_Double(pos->clock.rate_diff),
 | 
				
			||||||
			SPA_POD_Long(pos->clock.next_nsec));
 | 
								SPA_POD_Long(pos->clock.next_nsec),
 | 
				
			||||||
 | 
								SPA_POD_Int(pos->state));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_pod_builder_prop(&b, SPA_PROFILER_driverBlock, 0);
 | 
						spa_pod_builder_prop(&b, SPA_PROFILER_driverBlock, 0);
 | 
				
			||||||
	spa_pod_builder_add_struct(&b,
 | 
						spa_pod_builder_add_struct(&b,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -29,6 +29,7 @@ struct driver {
 | 
				
			||||||
	float cpu_load[3];
 | 
						float cpu_load[3];
 | 
				
			||||||
	struct spa_io_clock clock;
 | 
						struct spa_io_clock clock;
 | 
				
			||||||
	uint32_t xrun_count;
 | 
						uint32_t xrun_count;
 | 
				
			||||||
 | 
						uint32_t transport_state;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct measurement {
 | 
					struct measurement {
 | 
				
			||||||
| 
						 | 
					@ -130,7 +131,8 @@ static int process_clock(struct data *d, const struct spa_pod *pod, struct drive
 | 
				
			||||||
			SPA_POD_Long(&info->clock.duration),
 | 
								SPA_POD_Long(&info->clock.duration),
 | 
				
			||||||
			SPA_POD_Long(&info->clock.delay),
 | 
								SPA_POD_Long(&info->clock.delay),
 | 
				
			||||||
			SPA_POD_Double(&info->clock.rate_diff),
 | 
								SPA_POD_Double(&info->clock.rate_diff),
 | 
				
			||||||
			SPA_POD_Long(&info->clock.next_nsec));
 | 
								SPA_POD_Long(&info->clock.next_nsec),
 | 
				
			||||||
 | 
								SPA_POD_OPT_Int(&info->transport_state));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static struct node *find_node(struct data *d, uint32_t id)
 | 
					static struct node *find_node(struct data *d, uint32_t id)
 | 
				
			||||||
| 
						 | 
					@ -455,7 +457,7 @@ static const char *print_perc(char *buf, bool active, size_t len, uint64_t val,
 | 
				
			||||||
	return buf;
 | 
						return buf;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const char *state_as_string(enum pw_node_state state)
 | 
					static const char *state_as_string(enum pw_node_state state, uint32_t transport)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	switch (state) {
 | 
						switch (state) {
 | 
				
			||||||
	case PW_NODE_STATE_ERROR:
 | 
						case PW_NODE_STATE_ERROR:
 | 
				
			||||||
| 
						 | 
					@ -467,8 +469,15 @@ static const char *state_as_string(enum pw_node_state state)
 | 
				
			||||||
	case PW_NODE_STATE_IDLE:
 | 
						case PW_NODE_STATE_IDLE:
 | 
				
			||||||
		return "I";
 | 
							return "I";
 | 
				
			||||||
	case PW_NODE_STATE_RUNNING:
 | 
						case PW_NODE_STATE_RUNNING:
 | 
				
			||||||
 | 
							switch (transport) {
 | 
				
			||||||
 | 
							case SPA_IO_POSITION_STATE_STARTING:
 | 
				
			||||||
 | 
								return "t";
 | 
				
			||||||
 | 
							case SPA_IO_POSITION_STATE_RUNNING:
 | 
				
			||||||
 | 
								return "T";
 | 
				
			||||||
 | 
							default:
 | 
				
			||||||
			return "R";
 | 
								return "R";
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	return "!";
 | 
						return "!";
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -512,7 +521,7 @@ static void print_node(struct data *d, struct driver *i, struct node *n, int y)
 | 
				
			||||||
		busy = -1;
 | 
							busy = -1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	print_mode_dependent(d, y, 0, "%s %4.1u %6.1u %6.1u %s %s %s %s  %3.1u %16.16s %s%s",
 | 
						print_mode_dependent(d, y, 0, "%s %4.1u %6.1u %6.1u %s %s %s %s  %3.1u %16.16s %s%s",
 | 
				
			||||||
			state_as_string(n->state),
 | 
								state_as_string(n->state, i->transport_state),
 | 
				
			||||||
			n->id,
 | 
								n->id,
 | 
				
			||||||
			frac.num, frac.denom,
 | 
								frac.num, frac.denom,
 | 
				
			||||||
			print_time(buf1, active, 64, waiting),
 | 
								print_time(buf1, active, 64, waiting),
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue