Skip to content

Commit

Permalink
Target the latest version of the WPA add-in and fill in the Wall Cloc…
Browse files Browse the repository at this point in the history
…k Time Responsibility field. (#11)
  • Loading branch information
kevcadieux authored Aug 27, 2020
1 parent 172a0f5 commit 2cf3600
Show file tree
Hide file tree
Showing 6 changed files with 159 additions and 52 deletions.
149 changes: 132 additions & 17 deletions src/CppBuildInsightsEtw.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
</tasks>

<templates>
<template tid="BuildExplorerActivityTemplate">
<template tid="BuildExplorerActivityTemplate_V0">
<data name="TimelineId" inType="win:UInt16"/>
<data name="TimelineDescription" inType="win:AnsiString"/>
<data name="Tool" inType="win:AnsiString"/>
Expand All @@ -61,6 +61,21 @@
<data name="InclusiveMillisecondCPUTime" inType="win:UInt32"/>
</template>

<template tid="BuildExplorerActivityTemplate_V1">
<data name="TimelineId" inType="win:UInt16"/>
<data name="TimelineDescription" inType="win:AnsiString"/>
<data name="Tool" inType="win:AnsiString"/>
<data name="InvocationId" inType="win:UInt32"/>
<data name="InvocationDescription" inType="win:UnicodeString"/>
<data name="Component" inType="win:UnicodeString"/>
<data name="ActivityName" inType="win:AnsiString"/>
<data name="ExclusiveMillisecondDuration" inType="win:UInt32"/>
<data name="InclusiveMillisecondDuration" inType="win:UInt32"/>
<data name="ExclusiveMillisecondCPUTime" inType="win:UInt32"/>
<data name="InclusiveMillisecondCPUTime" inType="win:UInt32"/>
<data name="WallClockMillisecondTimeResponsibility" inType="win:UInt32"/>
</template>

<template tid="BuildExplorerAnsiStringPropertyTemplate">
<data name="TimelineId" inType="win:UInt16"/>
<data name="TimelineDescription" inType="win:AnsiString"/>
Expand Down Expand Up @@ -88,14 +103,23 @@
<events>
<!-- BuildExplorer event values must be between 0 and 499 -->
<event value="0"
symbol="CppBuildInsightsBuildExplorerActivity"
symbol="CppBuildInsightsBuildExplorerActivity_V0"
task="BuildExplorer"
opcode="Activity"
template="BuildExplorerActivityTemplate"
template="BuildExplorerActivityTemplate_V0"
level="win:Informational"
version="0"
keywords="" />

<event value="0"
symbol="CppBuildInsightsBuildExplorerActivity_V1"
task="BuildExplorer"
opcode="Activity"
template="BuildExplorerActivityTemplate_V1"
level="win:Informational"
version="1"
keywords="" />

<event value="1"
symbol="CppBuildInsightsBuildExplorerAnsiStringProperty"
task="BuildExplorer"
Expand Down Expand Up @@ -127,7 +151,21 @@

<templates>

<template tid="FileActivityTemplate">
<template tid="FileActivityTemplate_V0">
<data name="TimelineId" inType="win:UInt16"/>
<data name="TimelineDescription" inType="win:AnsiString"/>
<data name="Tool" inType="win:AnsiString"/>
<data name="InvocationId" inType="win:UInt32"/>
<data name="Component" inType="win:UnicodeString"/>
<data name="IncludedPath" inType="win:AnsiString"/>
<data name="ParentPath" inType="win:AnsiString"/>
<data name="Depth" inType="win:UInt16"/>
<data name="ActivityName" inType="win:AnsiString"/>
<data name="ExclusiveMillisecondDuration" inType="win:UInt32"/>
<data name="InclusiveMillisecondDuration" inType="win:UInt32"/>
</template>

<template tid="FileActivityTemplate_V1">
<data name="TimelineId" inType="win:UInt16"/>
<data name="TimelineDescription" inType="win:AnsiString"/>
<data name="Tool" inType="win:AnsiString"/>
Expand All @@ -139,21 +177,31 @@
<data name="ActivityName" inType="win:AnsiString"/>
<data name="ExclusiveMillisecondDuration" inType="win:UInt32"/>
<data name="InclusiveMillisecondDuration" inType="win:UInt32"/>
<data name="WallClockMillisecondTimeResponsibility" inType="win:UInt32"/>
</template>

</templates>

<events>
<!-- FileActivities event values must be between 1000 and 1499 -->
<event value="1000"
symbol="CppBuildInsightsFileActivity"
symbol="CppBuildInsightsFileActivity_V0"
task="Files"
opcode="Activity"
template="FileActivityTemplate"
template="FileActivityTemplate_V0"
level="win:Informational"
version="0"
keywords="" />

<event value="1000"
symbol="CppBuildInsightsFileActivity_V1"
task="Files"
opcode="Activity"
template="FileActivityTemplate_V1"
level="win:Informational"
version="1"
keywords="" />

</events>


Expand All @@ -167,7 +215,7 @@

<templates>

<template tid="FunctionActivityTemplate">
<template tid="FunctionActivityTemplate_V0">
<data name="TimelineId" inType="win:UInt16"/>
<data name="TimelineDescription" inType="win:AnsiString"/>
<data name="Tool" inType="win:AnsiString"/>
Expand All @@ -178,11 +226,24 @@
<data name="MillisecondDuration" inType="win:UInt32"/>
</template>

<template tid="FunctionActivityTemplate_V1">
<data name="TimelineId" inType="win:UInt16"/>
<data name="TimelineDescription" inType="win:AnsiString"/>
<data name="Tool" inType="win:AnsiString"/>
<data name="InvocationId" inType="win:UInt32"/>
<data name="Component" inType="win:UnicodeString"/>
<data name="FunctionInstanceId" inType="win:UInt64"/>
<data name="FunctionName" inType="win:AnsiString"/>
<data name="ActivityName" inType="win:AnsiString"/>
<data name="MillisecondDuration" inType="win:UInt32"/>
<data name="WallClockMillisecondTimeResponsibility" inType="win:UInt32"/>
</template>

<template tid="FunctionActivityTemplate_Extended1">
<data name="FunctionInstanceId" inType="win:UInt64"/>
</template>

<template tid="FunctionSimpleEventTemplate">
<template tid="FunctionSimpleEventTemplate_V0">
<data name="TimelineId" inType="win:UInt16"/>
<data name="TimelineDescription" inType="win:AnsiString"/>
<data name="Tool" inType="win:AnsiString"/>
Expand All @@ -197,6 +258,21 @@
<data name="NumericValue" inType="win:Int32"/>
</template>

<template tid="FunctionSimpleEventTemplate_V1">
<data name="TimelineId" inType="win:UInt16"/>
<data name="TimelineDescription" inType="win:AnsiString"/>
<data name="Tool" inType="win:AnsiString"/>
<data name="InvocationId" inType="win:UInt32"/>
<data name="Component" inType="win:UnicodeString"/>
<data name="FunctionInstanceId" inType="win:UInt64"/>
<data name="FunctionName" inType="win:AnsiString"/>
<data name="ActivityName" inType="win:AnsiString"/>
<data name="EventId" inType="win:UInt16"/>
<data name="EventName" inType="win:AnsiString"/>
<data name="StringValue" inType="win:AnsiString"/>
<data name="NumericValue" inType="win:Int32"/>
</template>

<template tid="FunctionSimpleEventTemplate_Extended1">
<data name="FunctionInstanceId" inType="win:UInt64"/>
<data name="EventId" inType="win:UInt16"/>
Expand All @@ -207,25 +283,43 @@
<events>
<!-- FunctionActivities event values must be between 1500 and 1999 -->
<event value="1500"
symbol="CppBuildInsightsFunctionActivity"
symbol="CppBuildInsightsFunctionActivity_V0"
task="Functions"
opcode="Activity"
template="FunctionActivityTemplate"
template="FunctionActivityTemplate_V0"
level="win:Informational"
version="0"
keywords="" />

<event value="1500"
symbol="CppBuildInsightsFunctionActivity_V1"
task="Functions"
opcode="Activity"
template="FunctionActivityTemplate_V1"
level="win:Informational"
version="1"
keywords="" />

<event value="1501"
symbol="CppBuildInsightsFunctionSimpleEvent"
symbol="CppBuildInsightsFunctionSimpleEvent_V0"
task="Functions"
opcode="SimpleEvent"
template="FunctionSimpleEventTemplate"
template="FunctionSimpleEventTemplate_V0"
level="win:Informational"
version="0"
keywords="" />

<event value="1501"
symbol="CppBuildInsightsFunctionSimpleEvent_V1"
task="Functions"
opcode="SimpleEvent"
template="FunctionSimpleEventTemplate_V1"
level="win:Informational"
version="1"
keywords="" />

<event value="1502"
symbol="CppBuildInsightsFunctionActivity_Extended1"
symbol="CppBuildInsightsFunctionActivity_Extended1_Deprecated"
task="Functions"
opcode="ActivityExtension1"
template="FunctionActivityTemplate_Extended1"
Expand All @@ -234,7 +328,7 @@
keywords="" />

<event value="1503"
symbol="CppBuildInsightsFunctionSimpleEvent_Extended1"
symbol="CppBuildInsightsFunctionSimpleEvent_Extended1_Deprecated"
task="Functions"
opcode="SimpleEventExtension1"
template="FunctionSimpleEventTemplate_Extended1"
Expand All @@ -254,7 +348,18 @@

<templates>

<template tid="TemplateInstantiationActivityTemplate">
<template tid="TemplateInstantiationActivityTemplate_V0">
<data name="TimelineId" inType="win:UInt16"/>
<data name="TimelineDescription" inType="win:AnsiString"/>
<data name="Tool" inType="win:AnsiString"/>
<data name="InvocationId" inType="win:UInt32"/>
<data name="Component" inType="win:UnicodeString"/>
<data name="PrimaryTemplateName" inType="win:AnsiString"/>
<data name="SpecializationName" inType="win:AnsiString"/>
<data name="MicrosecondDuration" inType="win:UInt32"/>
</template>

<template tid="TemplateInstantiationActivityTemplate_V1">
<data name="TimelineId" inType="win:UInt16"/>
<data name="TimelineDescription" inType="win:AnsiString"/>
<data name="Tool" inType="win:AnsiString"/>
Expand All @@ -263,21 +368,31 @@
<data name="PrimaryTemplateName" inType="win:AnsiString"/>
<data name="SpecializationName" inType="win:AnsiString"/>
<data name="MicrosecondDuration" inType="win:UInt32"/>
<data name="WallClockMicrosecondTimeResponsibility" inType="win:UInt32"/>
</template>

</templates>

<events>
<!-- TemplateInstantiationActivities event values must be between 2000 and 2499 -->
<event value="2000"
symbol="CppBuildInsightsTemplateInstantiationActivity"
symbol="CppBuildInsightsTemplateInstantiationActivity_V0"
task="TemplateInstantiations"
opcode="Activity"
template="TemplateInstantiationActivityTemplate"
template="TemplateInstantiationActivityTemplate_V0"
level="win:Informational"
version="0"
keywords="" />

<event value="2000"
symbol="CppBuildInsightsTemplateInstantiationActivity_V1"
task="TemplateInstantiations"
opcode="Activity"
template="TemplateInstantiationActivityTemplate_V1"
level="win:Informational"
version="1"
keywords="" />

</events>

<templates>
Expand Down
2 changes: 2 additions & 0 deletions src/WPA/Analyzers/MiscellaneousCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class MiscellaneousCache : public BI::IAnalyzer
std::chrono::nanoseconds ExclusiveDuration;
std::chrono::nanoseconds CPUTime;
std::chrono::nanoseconds ExclusiveCPUTime;
std::chrono::nanoseconds WallClockTimeResponsibility;
};

const TimingData& GetTimingData(const A::Activity& a)
Expand Down Expand Up @@ -52,6 +53,7 @@ class MiscellaneousCache : public BI::IAnalyzer

t.Duration = a.Duration();
t.CPUTime = a.CPUTime();
t.WallClockTimeResponsibility = a.WallClockTimeResponsibility();

auto it = exclusivityLeaves_.find(eventStack.Back().EventInstanceId());

Expand Down
9 changes: 5 additions & 4 deletions src/WPA/Views/BuildExplorerView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,14 +165,14 @@ void BuildExplorerView::LogActivity(const void* relogSession, const Activity& a,
using std::chrono::duration_cast;
using std::chrono::milliseconds;

PCEVENT_DESCRIPTOR desc = &CppBuildInsightsBuildExplorerActivity;
PCEVENT_DESCRIPTOR desc = &CppBuildInsightsBuildExplorerActivity_V1;

auto* context = contextBuilder_->GetContextData();
auto& td = miscellaneousCache_->GetTimingData(a);

Payload p = PayloadBuilder<
uint16_t, const char*, const char*, uint32_t, const wchar_t*,
const wchar_t*, const char*, uint32_t, uint32_t, uint32_t, uint32_t>::Build(
uint16_t, const char*, const char*, uint32_t, const wchar_t*, const wchar_t*,
const char*, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t>::Build(
context->TimelineId,
context->TimelineDescription,
context->Tool,
Expand All @@ -183,7 +183,8 @@ void BuildExplorerView::LogActivity(const void* relogSession, const Activity& a,
(uint32_t)duration_cast<milliseconds>(td.ExclusiveDuration).count(),
(uint32_t)duration_cast<milliseconds>(td.Duration).count(),
(uint32_t)duration_cast<milliseconds>(td.ExclusiveCPUTime).count(),
(uint32_t)duration_cast<milliseconds>(td.CPUTime).count());
(uint32_t)duration_cast<milliseconds>(td.CPUTime).count(),
(uint32_t)duration_cast<milliseconds>(td.WallClockTimeResponsibility).count());

InjectEvent(relogSession, &CppBuildInsightsGuid, desc, a.ProcessId(), a.ThreadId(),
a.ProcessorIndex(), a.StartTimestamp(), p.GetData(), (unsigned long)p.Size());
Expand Down
7 changes: 4 additions & 3 deletions src/WPA/Views/FilesView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void FilesView::OnFileParse(const FrontEndFileGroup& files, const void* relogSes
using std::chrono::duration_cast;
using std::chrono::milliseconds;

PCEVENT_DESCRIPTOR desc = &CppBuildInsightsFileActivity;
PCEVENT_DESCRIPTOR desc = &CppBuildInsightsFileActivity_V1;

auto* context = contextBuilder_->GetContextData();

Expand All @@ -37,7 +37,7 @@ void FilesView::OnFileParse(const FrontEndFileGroup& files, const void* relogSes
auto& td = miscellaneousCache_->GetTimingData(currentFile);

Payload p = PayloadBuilder<uint16_t, const char*, const char*, uint32_t, const wchar_t*, const char*,
const char*, uint16_t, const char*, uint32_t, uint32_t>::Build(
const char*, uint16_t, const char*, uint32_t, uint32_t, uint32_t>::Build(
context->TimelineId,
context->TimelineDescription,
context->Tool,
Expand All @@ -48,7 +48,8 @@ void FilesView::OnFileParse(const FrontEndFileGroup& files, const void* relogSes
(uint16_t)files.Size() - 1,
"Parsing",
(uint32_t)duration_cast<milliseconds>(td.ExclusiveDuration).count(),
(uint32_t)duration_cast<milliseconds>(td.Duration).count()
(uint32_t)duration_cast<milliseconds>(td.Duration).count(),
(uint32_t)duration_cast<milliseconds>(td.WallClockTimeResponsibility).count()
);

InjectEvent(relogSession, &CppBuildInsightsGuid, desc,
Expand Down
Loading

0 comments on commit 2cf3600

Please sign in to comment.