From 8132787168fa57da870edfb816589588d4620e1b Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Sat, 8 Jul 2023 20:20:22 -0700 Subject: til: measure til_module_render() durations This stows the duration (in ticks (which are ms for now)) of a given module context's most recent, as well as tracking the max, in til_module_context_t. For now it's also added to --print-module-contexts output, but this is still rather primitive and nearly inscrutible in practice... that output is a flickery and unsorted mess during playback. But this is just a start. Ticks may need to move up to microseconds if it'll also be the units for measuring timings. Right now things are slow enough that the low-hanging fruit stand out as multiple if not dozens of milliseconds so it's still useful for now. --- src/til.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/til.c') diff --git a/src/til.c b/src/til.c index dec18bf..c8133ef 100644 --- a/src/til.c +++ b/src/til.c @@ -414,7 +414,14 @@ static void module_render_fragment(til_module_context_t *context, til_stream_t * */ void til_module_render(til_module_context_t *context, til_stream_t *stream, unsigned ticks, til_fb_fragment_t **fragment_ptr) { + unsigned start = til_ticks_now(); + module_render_fragment(context, stream, til_threads, ticks, fragment_ptr); + + context->last_render_duration = til_ticks_now() - start; + if (context->last_render_duration > context->max_render_duration) + context->max_render_duration = context->last_render_duration; + context->renders_count++; context->last_ticks = ticks; } -- cgit v1.2.1