mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-20 15:40:14 +00:00
Audio performance measurements
Added DEBUG_TIMER_START and DEBUG_TIMER_STOP to debug.h to for performance measurements. If DEBUG is not defined, the code is not compiled (doesn't impose any runtime overhead).
This commit is contained in:
@@ -169,4 +169,13 @@ if (level <= log_level) Logger(level).Get()
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
#define DEBUG_TIMER_EVENT(name) struct timeval name = { 0, 0 }; gettimeofday(&name, NULL)
|
||||
#define DEBUG_TIMER_START(name) DEBUG_TIMER_EVENT(name##_start);
|
||||
#define DEBUG_TIMER_STOP(name) DEBUG_TIMER_EVENT(name##_stop); log_msg(LOG_LEVEL_DEBUG2, "%s duration: %lf s\n", #name, tv_diff(name##_stop, name##_start)) // NOLINT(cppcoreguidelines-pro-type-vararg, hicpp-vararg)
|
||||
#else
|
||||
#define DEBUG_TIMER_START(name)
|
||||
#define DEBUG_TIMER_STOP(name)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -449,6 +449,7 @@ int decode_audio_frame(struct coded_data *cdata, void *pbuf_data, struct pbuf_st
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
DEBUG_TIMER_START(audio_decode);
|
||||
audio_frame2 received_frame;
|
||||
received_frame.init(decoder->saved_desc.ch_count,
|
||||
get_audio_codec_to_tag(decoder->saved_audio_tag),
|
||||
@@ -702,6 +703,7 @@ int decode_audio_frame(struct coded_data *cdata, void *pbuf_data, struct pbuf_st
|
||||
packet_counter_clear(decoder->packet_counter);
|
||||
}
|
||||
|
||||
DEBUG_TIMER_START(audio_decode_compute_autoscale);
|
||||
if(!decoder->fixed_scale) {
|
||||
for(int i = 0; i <= decoder->channel_map.max_output; ++i) {
|
||||
double avg = get_avg_volume(s->buffer.data, bps,
|
||||
@@ -710,6 +712,8 @@ int decode_audio_frame(struct coded_data *cdata, void *pbuf_data, struct pbuf_st
|
||||
s->buffer.data_len / output_channels / bps, sample_rate);
|
||||
}
|
||||
}
|
||||
DEBUG_TIMER_STOP(audio_decode_compute_autoscale);
|
||||
DEBUG_TIMER_STOP(audio_decode);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user