2016-12-16 21:34:36 +00:00
|
|
|
//============================================================================
|
|
|
|
// Copyright (c) Kitware, Inc.
|
|
|
|
// All rights reserved.
|
|
|
|
// See LICENSE.txt for details.
|
2019-04-15 23:24:21 +00:00
|
|
|
//
|
2016-12-16 21:34:36 +00:00
|
|
|
// This software is distributed WITHOUT ANY WARRANTY; without even
|
|
|
|
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
// PURPOSE. See the above copyright notice for more information.
|
|
|
|
//============================================================================
|
2017-06-17 21:28:45 +00:00
|
|
|
#include <vtkm/rendering/raytracing/Logger.h>
|
2016-12-16 21:34:36 +00:00
|
|
|
|
2017-05-18 14:29:41 +00:00
|
|
|
namespace vtkm
|
|
|
|
{
|
|
|
|
namespace rendering
|
|
|
|
{
|
|
|
|
namespace raytracing
|
|
|
|
{
|
2016-12-16 21:34:36 +00:00
|
|
|
|
2017-09-25 13:57:23 +00:00
|
|
|
Logger* Logger::Instance = nullptr;
|
2017-06-17 21:28:45 +00:00
|
|
|
|
2020-08-17 14:18:24 +00:00
|
|
|
Logger::Logger() {}
|
2017-06-17 21:28:45 +00:00
|
|
|
|
|
|
|
Logger::~Logger()
|
|
|
|
{
|
|
|
|
Stream.str("");
|
|
|
|
}
|
|
|
|
|
|
|
|
Logger* Logger::GetInstance()
|
|
|
|
{
|
2017-09-25 13:57:23 +00:00
|
|
|
if (Instance == nullptr)
|
2017-06-17 21:28:45 +00:00
|
|
|
{
|
|
|
|
Instance = new Logger();
|
|
|
|
}
|
|
|
|
return Instance;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::stringstream& Logger::GetStream()
|
|
|
|
{
|
|
|
|
return Stream;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Logger::Clear()
|
|
|
|
{
|
|
|
|
Stream.str("");
|
|
|
|
while (!Entries.empty())
|
|
|
|
{
|
|
|
|
Entries.pop();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Logger::OpenLogEntry(const std::string& entryName)
|
|
|
|
{
|
|
|
|
Stream << entryName << " "
|
|
|
|
<< "<\n";
|
|
|
|
Entries.push(entryName);
|
|
|
|
}
|
|
|
|
void Logger::CloseLogEntry(const vtkm::Float64& entryTime)
|
2016-12-16 21:34:36 +00:00
|
|
|
{
|
2017-06-17 21:28:45 +00:00
|
|
|
this->Stream << "total_time " << entryTime << "\n";
|
|
|
|
this->Stream << this->Entries.top() << " >\n";
|
|
|
|
Entries.pop();
|
2016-12-16 21:34:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-06-17 21:28:45 +00:00
|
|
|
} // namespace vtkm::renderng::raytracing
|