diff options
-rw-r--r-- | src/util/service.c | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/src/util/service.c b/src/util/service.c index 173b5d987..cb2644d74 100644 --- a/src/util/service.c +++ b/src/util/service.c | |||
@@ -36,6 +36,11 @@ | |||
36 | #include "gnunet_server_lib.h" | 36 | #include "gnunet_server_lib.h" |
37 | #include "gnunet_service_lib.h" | 37 | #include "gnunet_service_lib.h" |
38 | 38 | ||
39 | #if HAVE_MALLINFO | ||
40 | #include "gauger.h" | ||
41 | #endif | ||
42 | |||
43 | |||
39 | #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) | 44 | #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) |
40 | 45 | ||
41 | #define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util", syscall) | 46 | #define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util", syscall) |
@@ -62,6 +67,7 @@ struct IPv4NetworkSet | |||
62 | }; | 67 | }; |
63 | 68 | ||
64 | /** | 69 | /** |
70 | |||
65 | * @brief network in CIDR notation for IPV6. | 71 | * @brief network in CIDR notation for IPV6. |
66 | */ | 72 | */ |
67 | struct IPv6NetworkSet | 73 | struct IPv6NetworkSet |
@@ -1799,7 +1805,26 @@ shutdown: | |||
1799 | LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "write"); | 1805 | LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "write"); |
1800 | GNUNET_break (0 == CLOSE (sctx.ready_confirm_fd)); | 1806 | GNUNET_break (0 == CLOSE (sctx.ready_confirm_fd)); |
1801 | } | 1807 | } |
1802 | 1808 | #if HAVE_MALLINFO | |
1809 | { | ||
1810 | char *counter; | ||
1811 | |||
1812 | if ( (GNUNET_YES == | ||
1813 | GNUNET_CONFIGURATION_have_value (sctx.cfg, service_name, | ||
1814 | "GAUGER_HEAP")) && | ||
1815 | (GNUNET_OK == | ||
1816 | GNUNET_CONFIGURATION_get_value_string (sctx.cfg, service_name, | ||
1817 | "GAUGER_HEAP", | ||
1818 | &counter)) ) | ||
1819 | { | ||
1820 | struct mallinfo mi; | ||
1821 | |||
1822 | mi = mallinfo (); | ||
1823 | GAUGER (service_name, counter, mi.usmblks, "blocks"); | ||
1824 | GNUNET_free (counter); | ||
1825 | } | ||
1826 | } | ||
1827 | #endif | ||
1803 | GNUNET_SPEEDUP_stop_ (); | 1828 | GNUNET_SPEEDUP_stop_ (); |
1804 | GNUNET_CONFIGURATION_destroy (cfg); | 1829 | GNUNET_CONFIGURATION_destroy (cfg); |
1805 | i = 0; | 1830 | i = 0; |
@@ -1899,6 +1924,26 @@ GNUNET_SERVICE_stop (struct GNUNET_SERVICE_Context *sctx) | |||
1899 | { | 1924 | { |
1900 | unsigned int i; | 1925 | unsigned int i; |
1901 | 1926 | ||
1927 | #if HAVE_MALLINFO | ||
1928 | { | ||
1929 | char *counter; | ||
1930 | |||
1931 | if ( (GNUNET_YES == | ||
1932 | GNUNET_CONFIGURATION_have_value (sctx->cfg, sctx->service_name, | ||
1933 | "GAUGER_HEAP")) && | ||
1934 | (GNUNET_OK == | ||
1935 | GNUNET_CONFIGURATION_get_value_string (sctx->cfg, sctx->service_name, | ||
1936 | "GAUGER_HEAP", | ||
1937 | &counter)) ) | ||
1938 | { | ||
1939 | struct mallinfo mi; | ||
1940 | |||
1941 | mi = mallinfo (); | ||
1942 | GAUGER (service_name, counter, mi.usmblks, "blocks"); | ||
1943 | GNUNET_free (counter); | ||
1944 | } | ||
1945 | } | ||
1946 | #endif | ||
1902 | if (GNUNET_SCHEDULER_NO_TASK != sctx->shutdown_task) | 1947 | if (GNUNET_SCHEDULER_NO_TASK != sctx->shutdown_task) |
1903 | { | 1948 | { |
1904 | GNUNET_SCHEDULER_cancel (sctx->shutdown_task); | 1949 | GNUNET_SCHEDULER_cancel (sctx->shutdown_task); |