Commit 95d31449 authored by loring's avatar loring
Browse files

fix libsim leak of TimingsManager

Make sure the TimeingsManager is deleted. I also added
an option to completely disable the collection of timings
because over long insitu runs this bloats our memory use
and we don't always need the timing data.



git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@23242 18c085ea-50e0-402c-830e-de6fd14e8384
parent 3fd2a761
......@@ -188,6 +188,7 @@ TimingsManager::TimingsManager()
openedFile = false;
numCurrentTimings = 0;
enabled = false;
noForcedTiming = false;
withholdOutput = false;
neverOutput = false;
outputAllTimings = false;
......@@ -379,6 +380,26 @@ TimingsManager::Disable(void)
enabled = false;
}
// ****************************************************************************
// Method: TimingsManager::NoForcedTiming
//
// Purpose:
// Disables the timing manager for real. If the timer is just disabled by
// calling Disable then it can still be forced to accumulate timing data
// bloating our memory use which is undesirable in long runs where we
// won't use the timing data anyway.
//
// Programmer: Burlen Loring
// Creation: Tue Apr 29 15:27:49 PDT 2014
//
// ****************************************************************************
void
TimingsManager::NoForcedTiming(bool v)
{
noForcedTiming = v;
}
// ****************************************************************************
// Method: TimingsManager::WithholdOutput
......@@ -501,8 +522,9 @@ TimingsManager::FindFirstUnusedEntry(void)
int
TimingsManager::StartTimer(bool forced)
{
if (!enabled && !forced)
if (!enabled && (!forced || noForcedTiming))
return -1;
numCurrentTimings += 1;
int rv = PlatformStartTimer();
if (rv == usedEntry.size())
......@@ -575,7 +597,7 @@ TimingsManager::StopTimer(int index, const std::string &summary, bool forced)
{
double t = 0.;
if (enabled || forced)
if (enabled || (forced && !noForcedTiming))
{
if (index >= 0 && index < usedEntry.size())
usedEntry[index] = false;
......
......@@ -143,6 +143,7 @@ class MISC_API TimingsManager
void Enable(void);
void Disable(void);
void NoForcedTiming(bool v=true);
bool Enabled() const {return enabled;};
int StartTimer(bool force=false);
......@@ -164,6 +165,7 @@ class MISC_API TimingsManager
bool openedFile;
int numCurrentTimings;
bool enabled;
bool noForcedTiming;
bool withholdOutput;
bool neverOutput;
bool outputAllTimings;
......
......@@ -113,8 +113,16 @@ void *simv2_get_engine()
{
// Make sure the timer is initialized. In visit this is normally
// done in the main function but for the simulation it's done here.
if ( visitTimer == NULL)
TimingsManager::Initialize( "Simulation");
if (visitTimer == NULL)
{
TimingsManager::Initialize("Simulation");
// really disable the timer since we are very likely
// running in a resource constrained environment over
// a long time period
visitTimer->Disable();
visitTimer->NoForcedTiming();
}
Engine *engine = Engine::Instance();
engine->EnableSimulationPlugins();
return (void*)engine;
......@@ -234,6 +242,8 @@ void simv2_disconnect()
TRY
{
Engine::DisconnectSimulation();
if (visitTimer)
TimingsManager::Finalize();
DataCallbacksCleanup();
}
CATCHALL
......
Markdown is supported
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