diff --git a/sub/osd.c b/sub/osd.c index a3da1dd3ca..6a57574a52 100644 --- a/sub/osd.c +++ b/sub/osd.c @@ -333,6 +333,8 @@ struct sub_bitmap_list *osd_render(struct osd_state *osd, struct mp_osd_res res, { mp_mutex_lock(&osd->lock); + int64_t start_time = mp_time_ns(); + struct sub_bitmap_list *list = talloc_zero(NULL, struct sub_bitmap_list); list->change_id = 1; list->w = res.w; @@ -388,6 +390,11 @@ struct sub_bitmap_list *osd_render(struct osd_state *osd, struct mp_osd_res res, if (!(draw_flags & OSD_DRAW_SUB_FILTER)) osd->want_redraw_notification = false; + double elapsed = MP_TIME_NS_TO_MS(mp_time_ns() - start_time); + bool slow = elapsed > 5; + mp_msg(osd->log, slow ? MSGL_DEBUG : MSGL_TRACE, "Spent %.3f ms in %s%s\n", + elapsed, __func__, slow ? " (slow!)" : ""); + mp_mutex_unlock(&osd->lock); return list; }