memory indication.

typo fix.


git-svn-id: file:///svn/unbound/trunk@503 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2007-08-09 10:14:32 +00:00
parent 45f95a18af
commit d5e4fa21de
3 changed files with 20 additions and 1 deletions

View File

@ -55,6 +55,9 @@
#include <pwd.h>
#include <sys/resource.h>
/** global debug value to keep track of heap memory allocation */
void* unbound_start_brk = 0;
/** print usage. */
static void usage()
{
@ -359,6 +362,9 @@ main(int argc, char* argv[])
int cmdline_verbose = 0;
int debug_mode = 0;
/* take debug snapshot of heap */
unbound_start_brk = sbrk(0);
log_init(NULL);
/* parse the options */
while( (c=getopt(argc, argv, "c:dhv")) != -1) {

View File

@ -69,6 +69,16 @@
/** Size of an UDP datagram */
#define NORMAL_UDP_SIZE 512 /* bytes */
/** give debug heap size indication */
static void
debug_total_mem()
{
extern void* unbound_start_brk;
void* cur = sbrk(0);
int total = cur-unbound_start_brk;
log_info("Total heap memory estimate: %u", (unsigned)total);
}
/** Report on memory usage by this thread and global */
static void
worker_mem_report(struct worker* worker)
@ -95,6 +105,7 @@ worker_mem_report(struct worker* worker)
(unsigned)mesh, (unsigned)msg, (unsigned)rrset,
(unsigned)infra, (unsigned)ac, (unsigned)superac,
(unsigned)me);
debug_total_mem();
}
void
@ -151,7 +162,7 @@ worker_handle_service_reply(struct comm_point* c, void* arg, int error,
struct outbound_entry* e = (struct outbound_entry*)arg;
struct worker* worker = e->qstate->env->worker;
verbose(VERB_ALGO, "worker scvd callback for qstate %p", e->qstate);
verbose(VERB_ALGO, "worker svcd callback for qstate %p", e->qstate);
if(error != 0) {
mesh_report_reply(worker->env.mesh, e, 0, reply_info);
worker_mem_report(worker);

View File

@ -1,6 +1,8 @@
9 August 2007: Wouter
- canonicalization, signature checks
- dname signature label count and unit test.
- added debug heap size print to memory printout.
- typo fixup in worker.c
8 August 2007: Wouter
- ldns _raw routines created (in ldns trunk).