mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	Add log level argument to ratelimit_test function
If a log message is rate limited, we only need to know about it if we are actually interested in that log level. We therefore add an argument to the ratelimit_test function to set the log level of the message printed if a message is skipped Change-Id: I5ccd4a78bf7e972fe8b0e7133cd7e08c1e38835f
This commit is contained in:
		
							parent
							
								
									be6824cb15
								
							
						
					
					
						commit
						eff67c3c03
					
				
					 3 changed files with 5 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -140,7 +140,7 @@ int stream_send_underflow(struct stream *stream, int64_t offset, uint32_t underr
 | 
			
		|||
	struct impl *impl = client->impl;
 | 
			
		||||
	struct message *reply;
 | 
			
		||||
 | 
			
		||||
	if (ratelimit_test(&impl->rate_limit, stream->timestamp)) {
 | 
			
		||||
	if (ratelimit_test(&impl->rate_limit, stream->timestamp, SPA_LOG_LEVEL_INFO)) {
 | 
			
		||||
		pw_log_info("client %p [%s]: stream %p UNDERFLOW channel:%u offset:%" PRIi64 " underrun:%u",
 | 
			
		||||
			    client, client->name, stream, stream->channel, offset, underrun_for);
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1533,7 +1533,7 @@ static int node_ready(void *data, int status)
 | 
			
		|||
 | 
			
		||||
		if (SPA_UNLIKELY(state->pending > 0)) {
 | 
			
		||||
			pw_context_driver_emit_incomplete(node->context, node);
 | 
			
		||||
			if (ratelimit_test(&node->rt.rate_limit, a->signal_time)) {
 | 
			
		||||
			if (ratelimit_test(&node->rt.rate_limit, a->signal_time, SPA_LOG_LEVEL_DEBUG)) {
 | 
			
		||||
				pw_log_debug("(%s-%u) graph not finished: state:%p quantum:%"PRIu64
 | 
			
		||||
						" pending %d/%d", node->name, node->info.id,
 | 
			
		||||
						state, a->position.clock.duration,
 | 
			
		||||
| 
						 | 
				
			
			@ -1631,7 +1631,7 @@ static int node_xrun(void *data, uint64_t trigger, uint64_t delay, struct spa_po
 | 
			
		|||
	if (da && da != a)
 | 
			
		||||
		update_xrun_stats(da, trigger, delay);
 | 
			
		||||
 | 
			
		||||
	if (ratelimit_test(&this->rt.rate_limit, a->signal_time)) {
 | 
			
		||||
	if (ratelimit_test(&this->rt.rate_limit, a->signal_time, SPA_LOG_LEVEL_INFO)) {
 | 
			
		||||
		struct spa_fraction rate;
 | 
			
		||||
		if (da) {
 | 
			
		||||
			struct spa_io_clock *cl = &da->position.clock;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -81,11 +81,11 @@ struct ratelimit {
 | 
			
		|||
	unsigned n_printed, n_missed;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static inline bool ratelimit_test(struct ratelimit *r, uint64_t now)
 | 
			
		||||
static inline bool ratelimit_test(struct ratelimit *r, uint64_t now, enum spa_log_level level)
 | 
			
		||||
{
 | 
			
		||||
	if (r->begin + r->interval < now) {
 | 
			
		||||
		if (r->n_missed)
 | 
			
		||||
			pw_log_warn("%u events suppressed", r->n_missed);
 | 
			
		||||
			pw_log(level, "%u events suppressed", r->n_missed);
 | 
			
		||||
		r->begin = now;
 | 
			
		||||
		r->n_printed = 0;
 | 
			
		||||
		r->n_missed = 0;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue