diff options
author | John Wiegley <johnw@newartisans.com> | 2009-10-28 02:34:40 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-10-28 02:34:40 -0400 |
commit | bd96928410124e70e70ada7fd05820e2cf781d2c (patch) | |
tree | a054e62051e8a2cdb7351f9b166a1fba5d5ba43f /src/utils.cc | |
parent | ade0a8b6f3eeb893eda2ae7355d503bf6514f147 (diff) | |
parent | 65e8eca6cfd394390c1e2091cf8674a93d2eae2d (diff) | |
download | fork-ledger-bd96928410124e70e70ada7fd05820e2cf781d2c.tar.gz fork-ledger-bd96928410124e70e70ada7fd05820e2cf781d2c.tar.bz2 fork-ledger-bd96928410124e70e70ada7fd05820e2cf781d2c.zip |
Merge branch 'next'
Diffstat (limited to 'src/utils.cc')
-rw-r--r-- | src/utils.cc | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/utils.cc b/src/utils.cc index 85a7aa46..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; } @@ -531,14 +538,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 +624,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 +645,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 +665,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 +690,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; } |