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 698d1af798)
This commit is contained in:
Ell 2018-12-01 05:28:49 -05:00
parent 8593eb88fd
commit c3ce696ce0
3 changed files with 29 additions and 0 deletions

View file

@ -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;
}

View file

@ -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__ */

View file

@ -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
},
{}
}