From cc532c31aa8aa745d6d02c5c0cb22b3d75866590 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Wed, 28 Oct 2009 01:17:54 -0400 Subject: Added TRUE_CURRENT_TIME() macro Because CURRENT_TIME() can now be a past date if --now is used. --- src/utils.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/utils.cc') diff --git a/src/utils.cc b/src/utils.cc index 85a7aa46..a5334155 100644 --- a/src/utils.cc +++ b/src/utils.cc @@ -531,14 +531,15 @@ bool logger_func(log_level_t level) { if (! logger_has_run) { logger_has_run = true; - logger_start = CURRENT_TIME(); + logger_start = TRUE_CURRENT_TIME(); IF_VERIFY() *_log_stream << " TIME OBJSZ MEMSZ" << std::endl; } *_log_stream << std::right << std::setw(5) - << (CURRENT_TIME() - logger_start).total_milliseconds() << "ms"; + << (TRUE_CURRENT_TIME() - + logger_start).total_milliseconds() << "ms"; #if defined(VERIFY_ON) IF_VERIFY() { @@ -616,7 +617,7 @@ struct timer_t bool active; timer_t(log_level_t _level, std::string _description) - : level(_level), begin(CURRENT_TIME()), + : level(_level), begin(TRUE_CURRENT_TIME()), spent(time_duration(0, 0, 0, 0)), description(_description), active(true) {} }; @@ -637,7 +638,7 @@ void start_timer(const char * name, log_level_t lvl) timers.insert(timer_map::value_type(name, timer_t(lvl, _log_buffer.str()))); } else { assert((*i).second.description == _log_buffer.str()); - (*i).second.begin = CURRENT_TIME(); + (*i).second.begin = TRUE_CURRENT_TIME(); (*i).second.active = true; } _log_buffer.str(""); @@ -657,7 +658,7 @@ void stop_timer(const char * name) timer_map::iterator i = timers.find(name); assert(i != timers.end()); - (*i).second.spent += CURRENT_TIME() - (*i).second.begin; + (*i).second.spent += TRUE_CURRENT_TIME() - (*i).second.begin; (*i).second.active = false; #if defined(VERIFY_ON) @@ -682,7 +683,7 @@ void finish_timer(const char * name) time_duration spent = (*i).second.spent; if ((*i).second.active) { - spent = CURRENT_TIME() - (*i).second.begin; + spent = TRUE_CURRENT_TIME() - (*i).second.begin; (*i).second.active = false; } -- cgit v1.2.3 From a53874d56c3d9be05b015bec7bd42a14460ab152 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Wed, 28 Oct 2009 01:27:20 -0400 Subject: Disabled a memory check when --verify is on The check is not complete enough to be trustworthy. --- src/utils.cc | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/utils.cc') diff --git a/src/utils.cc b/src/utils.cc index a5334155..c68737dc 100644 --- a/src/utils.cc +++ b/src/utils.cc @@ -190,8 +190,15 @@ static void trace_delete_func(void * ptr, const char * which) i = freed_memory->find(ptr); if (i != freed_memory->end()) VERIFY(! "Freeing a block of memory twice"); +#if 0 + // There can be memory allocated by Boost or the standard library, which + // was allocated before memory tracing got turned on, that the system + // might free for some coincidental reason. As such, we can't rely on + // this check being valid. I've seen cases where processes ran to + // completion with it on, and then others where valid processes failed. else VERIFY(! "Freeing an unknown block of memory"); +#endif memory_tracing_active = true; return; } -- cgit v1.2.3