Commit caa50144 authored by mark's avatar mark
Browse files

STYLE: dead timer pointers left behind in profiling lookup

- not de-referenced and no current issues, but cleaner this way
parent 7ec540f5
......@@ -72,7 +72,6 @@ void Foam::Profiling::initialize
);
pool_->push(info, pool_->clockTime_);
info->push(); // mark as on stack
}
}
......@@ -107,7 +106,6 @@ Foam::Profiling::Information* Foam::Profiling::New
}
pool_->push(info, timer);
info->push(); // mark as on stack
}
return info;
......@@ -118,8 +116,7 @@ void Foam::Profiling::unstack(const Information *info)
{
if (pool_ && info)
{
Information *top = pool_->stack_.pop();
top->pop(); // mark as off stack
Information *top = pool_->pop();
if (info->id() != top->id())
{
......@@ -300,7 +297,18 @@ Foam::Profiling::Information* Foam::Profiling::store(Information *info)
void Foam::Profiling::push(Information *info, clockTime& timer)
{
stack_.push(info);
timers_.insert(info->id(), &timer);
timers_.set(info->id(), &timer);
info->push(); // mark as on stack
}
Foam::Profiling::Information* Foam::Profiling::pop()
{
Information *info = stack_.pop();
timers_.erase(info->id());
info->pop(); // mark as off stack
return info;
}
......
......@@ -41,6 +41,8 @@ SourceFiles
#include "Time.H"
#include "clockTime.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
......@@ -130,6 +132,10 @@ protected:
//- Add to stack and set timer lookup (based on Id)
void push(Information*, clockTime& timer);
//- Remove from stack and remove timer lookup (based on Id).
// Returns pointer to profiling information element
Information* pop();
// Static control elements
......@@ -139,7 +145,7 @@ protected:
//- Stop profiling, cleanup pool if possible
static void stop(const Time&);
//- Existing or new element on pool, add to stack
//- Existing or new element on pool, add to stack.
// Returns null if profiling has not been initialized
static Information* New(const string& name, clockTime& timer);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment