From 90b4b1dae95a23d7cd0f5e77c259f91ac5665c32 Mon Sep 17 00:00:00 2001 From: Wouter Wijngaards Date: Wed, 16 Sep 2009 13:01:51 +0000 Subject: [PATCH] Fixup memstats for pretty time print in log file. git-svn-id: file:///svn/unbound/trunk@1834 be551aaa-1e26-0410-a405-d3ace91eadb9 --- doc/Changelog | 1 + testcode/memstats.c | 16 +++++++--------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/doc/Changelog b/doc/Changelog index e0069a9b6..c23f713df 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,5 +1,6 @@ 16 September 2009: Wouter - Fix memory leak reported by Tao Ma. + - Fix memstats test tool for log-time-ascii log format. 15 September 2009: Wouter - iana portlist updated. diff --git a/testcode/memstats.c b/testcode/memstats.c index 5fc079dcb..fca3f2c2c 100644 --- a/testcode/memstats.c +++ b/testcode/memstats.c @@ -83,17 +83,15 @@ match(char* line) * But now also: * Sep 16 15:18:20 unbound[17428:0] info: ul/nh.c:143 memdup malloc(11) */ - if(strlen(line) < 36) /* up to 'info: ' */ + if(strlen(line) < 32) /* up to 'info: ' */ return 0; - if(strncmp(line+30, "info: ", 6) != 0 && - strncmp(line+33, "info: ", 6) != 0) + if(!strstr(line, "] info: ")) return 0; - if(strncmp(line+36, "stat ", 5) == 0 || - strncmp(line+39, "stat ", 5) == 0) + if(strstr(line, "info: stat")) return 0; /* skip the hex dumps */ - if(strstr(line+36, "malloc(")) + if(strstr(line+30, "malloc(")) return 1; - else if(strstr(line+36, "calloc(")) + else if(strstr(line+30, "calloc(")) return 1; /* skip reallocs */ return 0; @@ -203,9 +201,9 @@ readfile(rbtree_t* tree, const char* fname) if(!match(buf)) continue; - else if(strstr(buf+36, "malloc(")) + else if(strstr(buf+30, "malloc(")) read_malloc_stat(buf, tree); - else if(strstr(buf+36, "calloc(")) + else if(strstr(buf+30, "calloc(")) read_calloc_stat(buf, tree); else { printf("%s\n", buf); -- 2.47.3