[gimp/gimp-2-10] app: add scratch-total variable to the dashboard



commit c3ce696ce0829c4394c62e2373ef615a6bf36a36
Author: Ell <ell_se yahoo com>
Date:   Sat Dec 1 05:28:49 2018 -0500

    app: add scratch-total variable to the dashboard
    
    Add a scratch-total variable to the dashboard's misc group, showing
    the total amount of memory used by the scratch allocator.
    
    (cherry picked from commit 698d1af798d48e4a9b5f403d8b8b147c25fb7e82)

 app/core/gimp-scratch.c     | 10 ++++++++++
 app/core/gimp-scratch.h     |  5 +++++
 app/widgets/gimpdashboard.c | 14 ++++++++++++++
 3 files changed, 29 insertions(+)
---
diff --git a/app/core/gimp-scratch.c b/app/core/gimp-scratch.c
index 4dcef4ed5c..75fe302951 100644
--- a/app/core/gimp-scratch.c
+++ b/app/core/gimp-scratch.c
@@ -88,3 +88,13 @@ gimp_scratch_context_free (GimpScratchContext *context)
 
   g_slice_free (GimpScratchContext, context);
 }
+
+
+/*   public functions (stats)  */
+
+
+gsize
+gimp_scratch_get_total (void)
+{
+  return gimp_scratch_total;
+}
diff --git a/app/core/gimp-scratch.h b/app/core/gimp-scratch.h
index e47f372a56..f87473ef75 100644
--- a/app/core/gimp-scratch.h
+++ b/app/core/gimp-scratch.h
@@ -161,4 +161,9 @@ gimp_scratch_free (gpointer ptr)
   ((type *) (gimp_scratch_alloc0 (sizeof (type) * (n))))
 
 
+/*  stats  */
+
+guint64    gimp_scratch_get_total (void);
+
+
 #endif /* __GIMP_SCRATCH_H__ */
diff --git a/app/widgets/gimpdashboard.c b/app/widgets/gimpdashboard.c
index 4a83f27211..be3e259bd2 100644
--- a/app/widgets/gimpdashboard.c
+++ b/app/widgets/gimpdashboard.c
@@ -57,6 +57,7 @@
 #include "core/gimp-gui.h"
 #include "core/gimp-utils.h"
 #include "core/gimp-parallel.h"
+#include "core/gimp-scratch.h"
 #include "core/gimpasync.h"
 #include "core/gimpbacktrace.h"
 #include "core/gimpwaitable.h"
@@ -138,6 +139,7 @@ typedef enum
   /* misc */
   VARIABLE_MIPMAPED,
   VARIABLE_ASYNC_RUNNING,
+  VARIABLE_SCRATCH_TOTAL,
 
 
   N_VARIABLES,
@@ -693,6 +695,15 @@ static const VariableInfo variables[] =
     .type             = VARIABLE_TYPE_INTEGER,
     .sample_func      = gimp_dashboard_sample_function,
     .data             = gimp_async_get_n_running
+  },
+
+  [VARIABLE_SCRATCH_TOTAL] =
+  { .name             = "scratch-total",
+    .title            = NC_("dashboard-variable", "Scratch"),
+    .description      = N_("Total size of scratch memory"),
+    .type             = VARIABLE_TYPE_SIZE,
+    .sample_func      = gimp_dashboard_sample_function,
+    .data             = gimp_scratch_get_total
   }
 };
 
@@ -891,6 +902,9 @@ static const GroupInfo groups[] =
                           { .variable       = VARIABLE_ASYNC_RUNNING,
                             .default_active = TRUE
                           },
+                          { .variable       = VARIABLE_SCRATCH_TOTAL,
+                            .default_active = TRUE
+                          },
 
                           {}
                         }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]