From: Kern Sibbald Date: Sun, 27 Jun 2004 17:02:14 +0000 (+0000) Subject: Add heap stats to Dir and SD -- eliminate #ifdefs X-Git-Tag: Release-1.35.1~82 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=8b0e2b9cc7be5a05339cb591f016bb047c3d717d;p=bacula%2Fbacula Add heap stats to Dir and SD -- eliminate #ifdefs git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1452 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/dird/ua_status.c b/bacula/src/dird/ua_status.c index 2b2a4a400d..29eb20f6c8 100644 --- a/bacula/src/dird/ua_status.c +++ b/bacula/src/dird/ua_status.c @@ -33,12 +33,6 @@ extern char my_name[]; extern time_t daemon_start_time; extern int num_jobs_run; -#ifdef SMARTALLOC -extern uint64_t sm_max_bytes; -extern uint64_t sm_bytes; -extern uint32_t sm_max_buffers; -extern uint32_t sm_buffers; -#endif static void list_scheduled_jobs(UAContext *ua); static void list_running_jobs(UAContext *ua); @@ -212,7 +206,6 @@ static void do_director_status(UAContext *ua) bstrftime_nc(dt, sizeof(dt), daemon_start_time); bsendmsg(ua, _("Daemon started %s, %d Job%s run since started.\n"), dt, num_jobs_run, num_jobs_run == 1 ? "" : "s"); -#ifdef SMARTALLOC if (debug_level > 0) { char b1[35], b2[35], b3[35], b4[35]; bsendmsg(ua, _(" Heap: bytes=%s max_bytes=%s bufs=%s max_bufs=%s\n"), @@ -220,8 +213,7 @@ static void do_director_status(UAContext *ua) edit_uint64_with_commas(sm_max_bytes, b2), edit_uint64_with_commas(sm_buffers, b3), edit_uint64_with_commas(sm_max_buffers, b4)); - } -#endif + } /* * List scheduled Jobs */ diff --git a/bacula/src/filed/status.c b/bacula/src/filed/status.c index 6cc5fc7efb..d18b054e34 100755 --- a/bacula/src/filed/status.c +++ b/bacula/src/filed/status.c @@ -32,12 +32,6 @@ extern char my_name[]; extern int num_jobs_run; extern time_t daemon_start_time; -#ifdef SMARTALLOC -extern uint64_t sm_max_bytes; -extern uint64_t sm_bytes; -extern uint32_t sm_max_buffers; -extern uint32_t sm_buffers; -#endif /* Forward referenced functions */ static void list_terminated_jobs(void sendit(const char *msg, int len, void *sarg), void *arg); @@ -86,7 +80,6 @@ static void do_status(void sendit(const char *msg, int len, void *sarg), void *a sendit(msg, len, arg); } #endif -#ifdef SMARTALLOC if (debug_level > 0) { len = Mmsg(&msg, _(" Heap: bytes=%s max_bytes=%s bufs=%s max_bufs=%s\n"), edit_uint64_with_commas(sm_bytes, b1), @@ -95,7 +88,6 @@ static void do_status(void sendit(const char *msg, int len, void *sarg), void *a edit_uint64_with_commas(sm_max_buffers, b4)); sendit(msg, len, arg); } -#endif if (debug_level > 0) { len = Mmsg(&msg, _(" Sizeof: off_t=%d size_t=%d\n"), sizeof(off_t), sizeof(size_t)); diff --git a/bacula/src/lib/smartall.c b/bacula/src/lib/smartall.c index 6e46ca7b6b..0d75ffebef 100644 --- a/bacula/src/lib/smartall.c +++ b/bacula/src/lib/smartall.c @@ -59,6 +59,10 @@ #define Dmsg4(l,f,a1,a2,a3,a4) +uint64_t sm_max_bytes = 0; +uint64_t sm_bytes = 0; +uint32_t sm_max_buffers = 0; +uint32_t sm_buffers = 0; #ifdef SMARTALLOC @@ -86,10 +90,6 @@ static struct b_queue abqueue = { /* Allocated buffer queue */ &abqueue, &abqueue }; -uint64_t sm_max_bytes = 0; -uint64_t sm_bytes = 0; -uint32_t sm_max_buffers = 0; -uint32_t sm_buffers = 0; static bool bufimode = false; /* Buffers not tracked when True */ diff --git a/bacula/src/lib/smartall.h b/bacula/src/lib/smartall.h index 26062e371c..b879905411 100644 --- a/bacula/src/lib/smartall.h +++ b/bacula/src/lib/smartall.h @@ -26,6 +26,10 @@ */ +extern uint64_t sm_max_bytes; +extern uint64_t sm_bytes; +extern uint32_t sm_max_buffers; +extern uint32_t sm_buffers; #ifdef SMARTALLOC diff --git a/bacula/src/stored/status.c b/bacula/src/stored/status.c index 6278f41ee2..d07c43029d 100644 --- a/bacula/src/stored/status.c +++ b/bacula/src/stored/status.c @@ -39,6 +39,7 @@ extern char my_name[]; extern time_t daemon_start_time; extern int num_jobs_run; + /* Static variables */ @@ -67,6 +68,14 @@ int status_cmd(JCR *jcr) bstrftime_nc(dt, sizeof(dt), daemon_start_time); bnet_fsend(user, _("Daemon started %s, %d Job%s run since started.\n"), dt, num_jobs_run, num_jobs_run == 1 ? "" : "s"); + if (debug_level > 0) { + char b1[35], b2[35], b3[35], b4[35]; + bnet_fsend(user, _(" Heap: bytes=%s max_bytes=%s bufs=%s max_bufs=%s\n"), + edit_uint64_with_commas(sm_bytes, b1), + edit_uint64_with_commas(sm_max_bytes, b2), + edit_uint64_with_commas(sm_buffers, b3), + edit_uint64_with_commas(sm_max_buffers, b4)); + } /* * List running jobs