aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2010-07-06 16:26:59 +0200
committerMartin Willi <martin@revosec.ch>2010-07-06 16:28:25 +0200
commit4f99093235679959cb34525cf8cc44b955a63ec5 (patch)
treec1b9ef4ca9482c2ea8318b254e790c59053c6d5c /src
parent380106ab0d90ed157cbc75b27cbd70c23a4f60d3 (diff)
downloadstrongswan-4f99093235679959cb34525cf8cc44b955a63ec5.tar.bz2
strongswan-4f99093235679959cb34525cf8cc44b955a63ec5.tar.xz
Show mallinfo() data in statusall, if available
Diffstat (limited to 'src')
-rw-r--r--src/libcharon/plugins/stroke/stroke_list.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/libcharon/plugins/stroke/stroke_list.c b/src/libcharon/plugins/stroke/stroke_list.c
index 9981d45fc..bc9fc027f 100644
--- a/src/libcharon/plugins/stroke/stroke_list.c
+++ b/src/libcharon/plugins/stroke/stroke_list.c
@@ -17,6 +17,10 @@
#include <time.h>
+#ifdef HAVE_MALLINFO
+#include <malloc.h>
+#endif /* HAVE_MALLINFO */
+
#include <daemon.h>
#include <utils/linked_list.h>
#include <credentials/certificates/x509.h>
@@ -404,12 +408,19 @@ static void status(private_stroke_list_t *this, stroke_msg_t *msg, FILE *out, bo
u_int32_t dpd;
time_t since, now;
u_int size, online, offline;
-
now = time_monotonic(NULL);
since = time(NULL) - (now - this->uptime);
fprintf(out, "Status of IKEv2 charon daemon (strongSwan "VERSION"):\n");
fprintf(out, " uptime: %V, since %T\n", &now, &this->uptime, &since, FALSE);
+#ifdef HAVE_MALLINFO
+ {
+ struct mallinfo mi = mallinfo();
+
+ fprintf(out, " malloc: sbrk %d, mmap %d, used %d, free %d\n",
+ mi.arena, mi.hblkhd, mi.uordblks, mi.fordblks);
+ }
+#endif /* HAVE_MALLINFO */
fprintf(out, " worker threads: %d idle of %d,",
charon->processor->get_idle_threads(charon->processor),
charon->processor->get_total_threads(charon->processor));