Integrating latest 47acbe8
This commit is contained in:
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "StandaloneTools_precompiled.h"
|
||||
|
||||
#include "EventTraceDataParser.h"
|
||||
#include "EventTraceDataAggregator.h"
|
||||
#include "EventTraceEvents.h"
|
||||
|
||||
namespace Driller
|
||||
{
|
||||
AZ::Debug::DrillerHandlerParser* EventTraceDataParser::OnEnterTag(AZ::u32 tagName)
|
||||
{
|
||||
AZ_Assert(m_data, "You must set a valid aggregator before we can process the data!");
|
||||
if (tagName == AZ_CRC("Slice"))
|
||||
{
|
||||
m_data->AddEvent(aznew EventTrace::SliceEvent());
|
||||
return this;
|
||||
}
|
||||
else if (tagName == AZ_CRC("Instant"))
|
||||
{
|
||||
m_data->AddEvent(aznew EventTrace::InstantEvent());
|
||||
return this;
|
||||
}
|
||||
else if (tagName == AZ_CRC("ThreadInfo"))
|
||||
{
|
||||
m_data->AddEvent(aznew EventTrace::ThreadInfoEvent());
|
||||
return this;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void EventTraceDataParser::OnData(const AZ::Debug::DrillerSAXParser::Data& dataNode)
|
||||
{
|
||||
AZ_Assert(m_data, "You must set a valid aggregator before we can process the data!");
|
||||
|
||||
DrillerEvent& drillerEvent = static_cast<DrillerEvent&>(*m_data->GetEvents().back());
|
||||
|
||||
switch (drillerEvent.GetEventType())
|
||||
{
|
||||
case EventTrace::ET_SLICE:
|
||||
{
|
||||
EventTrace::SliceEvent& slice = static_cast<EventTrace::SliceEvent&>(drillerEvent);
|
||||
if (dataNode.m_name == AZ_CRC("Name"))
|
||||
{
|
||||
slice.m_Name = dataNode.ReadPooledString();
|
||||
}
|
||||
if (dataNode.m_name == AZ_CRC("Category"))
|
||||
{
|
||||
slice.m_Category = dataNode.ReadPooledString();
|
||||
}
|
||||
else if (dataNode.m_name == AZ_CRC("ThreadId"))
|
||||
{
|
||||
dataNode.Read(slice.m_ThreadId);
|
||||
}
|
||||
else if (dataNode.m_name == AZ_CRC("Timestamp"))
|
||||
{
|
||||
dataNode.Read(slice.m_Timestamp);
|
||||
}
|
||||
else if (dataNode.m_name == AZ_CRC("Duration"))
|
||||
{
|
||||
dataNode.Read(slice.m_Duration);
|
||||
}
|
||||
} break;
|
||||
|
||||
case EventTrace::ET_INSTANT:
|
||||
{
|
||||
EventTrace::InstantEvent& instant = static_cast<EventTrace::InstantEvent&>(drillerEvent);
|
||||
if (dataNode.m_name == AZ_CRC("Name"))
|
||||
{
|
||||
instant.m_Name = dataNode.ReadPooledString();
|
||||
}
|
||||
if (dataNode.m_name == AZ_CRC("Category"))
|
||||
{
|
||||
instant.m_Category = dataNode.ReadPooledString();
|
||||
}
|
||||
else if (dataNode.m_name == AZ_CRC("ThreadId"))
|
||||
{
|
||||
dataNode.Read(instant.m_ThreadId);
|
||||
}
|
||||
else if (dataNode.m_name == AZ_CRC("Timestamp"))
|
||||
{
|
||||
dataNode.Read(instant.m_Timestamp);
|
||||
}
|
||||
|
||||
} break;
|
||||
|
||||
case EventTrace::ET_THREAD_INFO:
|
||||
{
|
||||
EventTrace::ThreadInfoEvent& threadInfo = static_cast<EventTrace::ThreadInfoEvent&>(drillerEvent);
|
||||
if (dataNode.m_name == AZ_CRC("Name"))
|
||||
{
|
||||
threadInfo.m_Name = dataNode.ReadPooledString();
|
||||
}
|
||||
else if (dataNode.m_name == AZ_CRC("ThreadId"))
|
||||
{
|
||||
dataNode.Read(threadInfo.m_ThreadId);
|
||||
}
|
||||
|
||||
} break;
|
||||
}
|
||||
}
|
||||
} // namespace Driller
|
||||
Reference in New Issue
Block a user