[pango/speed-up-format-filtering: 7/8] fontconfig: Add some trace marks
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/speed-up-format-filtering: 7/8] fontconfig: Add some trace marks
- Date: Wed, 19 Aug 2020 20:44:44 +0000 (UTC)
commit ab5d12965cb5cc1e5f3b186eb5cea7bef19b0df4
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Aug 19 16:02:53 2020 -0400
fontconfig: Add some trace marks
Add trace marks around the expensive fontconfig
calls, and for when we are waiting on them.
pango/pangofc-fontmap.c | 23 +++++++++++++++++------
1 file changed, 17 insertions(+), 6 deletions(-)
---
diff --git a/pango/pangofc-fontmap.c b/pango/pangofc-fontmap.c
index eb43473e..e85cffb3 100644
--- a/pango/pangofc-fontmap.c
+++ b/pango/pangofc-fontmap.c
@@ -54,6 +54,7 @@
#include "pango-impl-utils.h"
#include "pango-enum-types.h"
#include "pango-coverage-private.h"
+#include "pango-trace-private.h"
#include <hb-ft.h>
@@ -832,12 +833,15 @@ match_in_thread (GTask *task,
ThreadData *td = task_data;
FcResult result;
FcPattern *match;
+ gint64 before = PANGO_TRACE_CURRENT_TIME;
match = FcFontSetMatch (td->config,
td->sets, td->nsets,
td->pattern,
&result);
+ pango_trace_mark (before, "FcFontSetMatch", NULL);
+
g_mutex_lock (&td->patterns->mutex);
td->patterns->match = match;
g_cond_signal (&td->patterns->cond);
@@ -853,6 +857,7 @@ sort_in_thread (GTask *task,
ThreadData *td = task_data;
FcResult result;
FcFontSet *fontset;
+ gint64 before = PANGO_TRACE_CURRENT_TIME;
fontset = FcFontSetSort (td->config,
td->sets, td->nsets,
@@ -861,6 +866,8 @@ sort_in_thread (GTask *task,
NULL,
&result);
+ pango_trace_mark (before, "FcFontSetSort", NULL);
+
g_mutex_lock (&td->patterns->mutex);
td->patterns->fontset = fontset;
g_cond_signal (&td->patterns->cond);
@@ -1003,6 +1010,7 @@ pango_fc_patterns_get_font_pattern (PangoFcPatterns *pats, int i, gboolean *prep
{
FcPattern *match;
FcFontSet *fontset;
+ gint64 before = PANGO_TRACE_CURRENT_TIME;
g_mutex_lock (&pats->mutex);
@@ -1014,6 +1022,8 @@ pango_fc_patterns_get_font_pattern (PangoFcPatterns *pats, int i, gboolean *prep
g_mutex_unlock (&pats->mutex);
+ pango_trace_mark (before, "wait for FcFontMatch", NULL);
+
if (match)
{
*prepare = FALSE;
@@ -1031,6 +1041,7 @@ pango_fc_patterns_get_font_pattern (PangoFcPatterns *pats, int i, gboolean *prep
else
{
FcFontSet *fontset;
+ gint64 before = PANGO_TRACE_CURRENT_TIME;
g_mutex_lock (&pats->mutex);
@@ -1041,6 +1052,8 @@ pango_fc_patterns_get_font_pattern (PangoFcPatterns *pats, int i, gboolean *prep
g_mutex_unlock (&pats->mutex);
+ pango_trace_mark (before, "wait for FcFontSort", NULL);
+
if (fontset && i < fontset->nfont)
{
*prepare = TRUE;
@@ -1327,12 +1340,11 @@ init_in_thread (GTask *task,
gpointer task_data,
GCancellable *cancellable)
{
- gint64 before = g_get_monotonic_time ();
+ gint64 before = PANGO_TRACE_CURRENT_TIME;
FcInit ();
- g_print ("FcInit took %.1f milliseconds\n",
- (g_get_monotonic_time () - before)/((double)G_TIME_SPAN_MILLISECOND));
+ pango_trace_mark (before, "FcInit", NULL);
g_mutex_lock (&fc_init_mutex);
fc_initialized = TRUE;
@@ -1343,15 +1355,14 @@ init_in_thread (GTask *task,
static void
wait_for_fc_init (void)
{
- gint64 before = g_get_monotonic_time ();
+ gint64 before = PANGO_TRACE_CURRENT_TIME;
g_mutex_lock (&fc_init_mutex);
while (!fc_initialized)
g_cond_wait (&fc_init_cond, &fc_init_mutex);
g_mutex_unlock (&fc_init_mutex);
- g_print ("wait_for_fc_init took %.1f milliseconds\n",
- (g_get_monotonic_time () - before)/((double)G_TIME_SPAN_MILLISECOND));
+ pango_trace_mark (before, "wait for FcInit", NULL);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]