[gtk/wip/otte/sortlistmodel: 30/38] sor3listmodel: Count the number of steps
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/otte/sortlistmodel: 30/38] sor3listmodel: Count the number of steps
- Date: Tue, 21 Jul 2020 14:42:17 +0000 (UTC)
commit aa2eea445896ea4062d09a656dc46a9aa8dd45f6
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Jul 11 14:10:28 2020 -0400
sor3listmodel: Count the number of steps
gtk/gtksor3listmodel.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtksor3listmodel.c b/gtk/gtksor3listmodel.c
index 57940e5ca9..6a35619c9d 100644
--- a/gtk/gtksor3listmodel.c
+++ b/gtk/gtksor3listmodel.c
@@ -101,6 +101,7 @@ struct _GtkSor3ListModel
PivotStack stack;
gint64 start_time;
+ guint steps;
};
struct _GtkSor3ListModelClass
@@ -189,7 +190,7 @@ gtk_sor3_list_model_stop_sorting (GtkSor3ListModel *self)
guint n_items = g_list_model_get_n_items (G_LIST_MODEL (self));
if (self->start_time != 0)
- gdk_profiler_add_markf (self->start_time, g_get_monotonic_time () - self->start_time, "quicksort",
"sorting %u", n_items);
+ gdk_profiler_add_markf (self->start_time, g_get_monotonic_time () - self->start_time, "quicksort",
"sorting %u items, %u steps", n_items, self->steps);
self->start_time = 0;
}
@@ -289,6 +290,8 @@ gtk_sor3_list_model_sort_cb (gpointer data)
guint changed_end;
guint changed_items = 0;
+ self->steps++;
+
start = self->sorted_to;
n_items = sort_array_get_size (&self->items);
end = MIN (512, n_items - start);
@@ -327,6 +330,7 @@ gtk_sor3_list_model_start_sorting (GtkSor3ListModel *self)
g_assert (self->sorting_cb == 0);
self->start_time = g_get_monotonic_time ();
+ self->steps = 0;
pivot_stack_push (&self->stack, (guint)sort_array_get_size (&self->items) - 1);
self->sorted_to = 0;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]