aboutsummaryrefslogtreecommitdiffstats
path: root/src/libcharon/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/libcharon/plugins')
-rw-r--r--src/libcharon/plugins/stroke/stroke_socket.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/libcharon/plugins/stroke/stroke_socket.c b/src/libcharon/plugins/stroke/stroke_socket.c
index 3adebb523..cf7ec369c 100644
--- a/src/libcharon/plugins/stroke/stroke_socket.c
+++ b/src/libcharon/plugins/stroke/stroke_socket.c
@@ -490,6 +490,25 @@ static void stroke_leases(private_stroke_socket_t *this,
}
/**
+ * Callback function for usage report
+ */
+static void report_usage(FILE *out, int count, size_t bytes,
+ backtrace_t *bt, bool detailed)
+{
+ fprintf(out, "%d bytes total, %d allocations, %d bytes average:\n",
+ bytes, count, bytes / count);
+ bt->log(bt, out, detailed);
+}
+
+/**
+ * Callback function for memusage summary
+ */
+static void sum_usage(FILE *out, int count, size_t bytes, int whitelisted)
+{
+ fprintf(out, "Total memory usage: %zu\n", bytes);
+}
+
+/**
* Show memory usage
*/
static void stroke_memusage(private_stroke_socket_t *this,
@@ -497,7 +516,9 @@ static void stroke_memusage(private_stroke_socket_t *this,
{
if (lib->leak_detective)
{
- lib->leak_detective->usage(lib->leak_detective, out);
+ lib->leak_detective->usage(lib->leak_detective,
+ (leak_detective_report_cb_t)report_usage,
+ (leak_detective_summary_cb_t)sum_usage, out);
}
}