summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libappstream-glib/as-profile.c19
-rw-r--r--libappstream-glib/as-profile.h2
2 files changed, 20 insertions, 1 deletions
diff --git a/libappstream-glib/as-profile.c b/libappstream-glib/as-profile.c
index c220577..9fb3a14 100644
--- a/libappstream-glib/as-profile.c
+++ b/libappstream-glib/as-profile.c
@@ -34,6 +34,7 @@ struct _AsProfile
GThread *unthreaded;
guint autodump_id;
guint autoprune_duration;
+ guint duration_min;
};
typedef struct {
@@ -174,7 +175,7 @@ as_profile_dump_safe (AsProfile *profile)
const gchar *printable;
item = g_ptr_array_index (profile->archived, i);
time_ms = (item->time_stop - item->time_start) / 1000;
- if (time_ms < 5)
+ if (time_ms < profile->duration_min)
continue;
/* print a timechart of what we've done */
@@ -398,6 +399,21 @@ as_profile_set_autoprune (AsProfile *profile, guint duration)
}
/**
+ * as_profile_set_duration_min:
+ * @profile: A #AsProfile
+ * @duration_min: A time in ms
+ *
+ * Sets the smallest recordable task duration.
+ *
+ * Since: 0.6.5
+ **/
+void
+as_profile_set_duration_min (AsProfile *profile, guint duration_min)
+{
+ profile->duration_min = duration_min;
+}
+
+/**
* as_profile_dump:
* @profile: A #AsProfile
*
@@ -463,6 +479,7 @@ as_profile_class_init (AsProfileClass *klass)
static void
as_profile_init (AsProfile *profile)
{
+ profile->duration_min = 5;
profile->current = g_ptr_array_new ();
profile->unthreaded = g_thread_self ();
profile->archived = g_ptr_array_new_with_free_func ((GDestroyNotify) as_profile_item_free);
diff --git a/libappstream-glib/as-profile.h b/libappstream-glib/as-profile.h
index 3169e4d..9f3fc83 100644
--- a/libappstream-glib/as-profile.h
+++ b/libappstream-glib/as-profile.h
@@ -49,6 +49,8 @@ void as_profile_set_autodump (AsProfile *profile,
guint delay);
void as_profile_set_autoprune (AsProfile *profile,
guint duration);
+void as_profile_set_duration_min (AsProfile *profile,
+ guint duration_min);
void as_profile_task_set_threaded (AsProfileTask *ptask,
gboolean threaded);
void as_profile_task_free (AsProfileTask *ptask);