SpiecsEngine
 
Loading...
Searching...
No Matches

◆ BeginSession()

void SpicesTest::Instrumentor::BeginSession ( const std::string & name,
const std::string & filepath = "results.json" )
inline

Definition at line 38 of file Instrumentor.h.

39 {
40 std::lock_guard lock(m_Mutex);
42 {
43 // If there is already a current session, then close it before beginning new one.
44 // Subsequent profiling output meant for the original session will end up in the
45 // newly opened session instead. That's better than having badly formatted
46 // profiling output.
47 //if (Spices::Log::GetCoreLogger()) // Edge case: BeginSession() might be before Log::Init()
48 //{
49 // SPICES_CORE_ERROR("Instrumentor::BeginSession('{0}') when session '{1}' already open.", name, m_CurrentSession->Name);
50 //}
52 }
53 m_OutputStream.open(filepath);
54
55 if (m_OutputStream.is_open())
56 {
57 m_CurrentSession = new InstrumentationSession({ name });
59 }
60 else
61 {
62 //if (Spices::Log::GetCoreLogger()) // Edge case: BeginSession() might be before Log::Init()
63 //{
64 // SPICES_CORE_ERROR("Instrumentor could not open results file '{0}'.", filepath);
65 //}
66 }
67 }
InstrumentationSession * m_CurrentSession
std::ofstream m_OutputStream

References InternalEndSession(), m_CurrentSession, m_OutputStream, and WriteHeader().