Skip to content

Commit 877f249

Browse files
Merge pull request #526 from GameTechDev/feature/svc-etw-log
Feature/svc etw log
2 parents 3ba3785 + c8a0ab8 commit 877f249

File tree

101 files changed

+2308
-226
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+2308
-226
lines changed

ETLTrimmer/main.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ struct ProviderFilter
4444
uint64_t allKeyMask;
4545
uint8_t maxLevel;
4646
GUID providerGuid;
47+
uint32_t controlCode;
4748
bool MatchesId(uint16_t eventId) const
4849
{
4950
return eventSet.empty() || eventSet.contains(eventId);
@@ -74,24 +75,25 @@ class Filter : public IFilterBuildListener
7475

7576
// NT_Process
7677
//
77-
ProviderEnabled(NT_Process::GUID, 0, 0, EnableAllLevels);
78+
ProviderEnabled(NT_Process::GUID, 0, 0, EnableAllLevels, EVENT_CONTROL_CODE_ENABLE_PROVIDER);
7879

7980
// Microsoft_Windows_EventMetadata::GUID
8081
//
81-
ProviderEnabled(Microsoft_Windows_EventMetadata::GUID, 0, 0, EnableAllLevels);
82+
ProviderEnabled(Microsoft_Windows_EventMetadata::GUID, 0, 0, EnableAllLevels, EVENT_CONTROL_CODE_ENABLE_PROVIDER);
8283
}
8384
// Inherited via IFilterBuildListener
8485
void EventAdded(uint16_t id) override
8586
{
8687
eventsOnDeck_.push_back(id);
8788
}
88-
void ProviderEnabled(const GUID& providerGuid, uint64_t anyKey, uint64_t allKey, uint8_t maxLevel) override
89+
void ProviderEnabled(const GUID& providerGuid, uint64_t anyKey, uint64_t allKey, uint8_t maxLevel, uint32_t controlCode) override
8990
{
9091
ProviderFilter filter{
9192
.anyKeyMask = anyKey ? anyKey : 0xFFFF'FFFF,
9293
.allKeyMask = allKey,
9394
.maxLevel = maxLevel,
9495
.providerGuid = providerGuid,
96+
.controlCode = controlCode,
9597
};
9698
filter.eventSet.insert_range(eventsOnDeck_);
9799
ClearEvents();
@@ -148,7 +150,7 @@ class EventCallback : public ITraceEventCallback
148150
// when trimming by timestamp, we must take care not to remove the state data psuedo-events generated
149151
// at the beginning of the trace (also true state events coming before the trim region)
150152
// nt process
151-
stateFilter_.ProviderEnabled(NT_Process::GUID, 0, 0, EnableAllLevels);
153+
stateFilter_.ProviderEnabled(NT_Process::GUID, 0, 0, EnableAllLevels, EVENT_CONTROL_CODE_ENABLE_PROVIDER);
152154
// dxgkrnl --> DCs
153155
stateFilter_.EventAdded(Microsoft_Windows_DxgKrnl::Context_DCStart::Id);
154156
stateFilter_.EventAdded(Microsoft_Windows_DxgKrnl::Device_DCStart::Id);
@@ -162,11 +164,11 @@ class EventCallback : public ITraceEventCallback
162164
stateFilter_.EventAdded(Microsoft_Windows_DxgKrnl::HwQueue_DCStart::Id);
163165
stateFilter_.EventAdded(Microsoft_Windows_DxgKrnl::HwQueue_Start::Id);
164166
// <-- finish
165-
stateFilter_.ProviderEnabled(Microsoft_Windows_DxgKrnl::GUID, 0, 0, EnableAllLevels);
167+
stateFilter_.ProviderEnabled(Microsoft_Windows_DxgKrnl::GUID, 0, 0, EnableAllLevels, EVENT_CONTROL_CODE_ENABLE_PROVIDER);
166168
// kernel proc start/stop
167169
stateFilter_.EventAdded(Microsoft_Windows_Kernel_Process::ProcessStart_Start::Id);
168170
stateFilter_.EventAdded(Microsoft_Windows_Kernel_Process::ProcessStop_Stop::Id);
169-
stateFilter_.ProviderEnabled(Microsoft_Windows_Kernel_Process::GUID, 0, 0, EnableAllLevels);
171+
stateFilter_.ProviderEnabled(Microsoft_Windows_Kernel_Process::GUID, 0, 0, EnableAllLevels, EVENT_CONTROL_CODE_ENABLE_PROVIDER);
170172
}
171173
STDMETHODIMP QueryInterface(const IID& iid, void** pObj)
172174
{

IntelPresentMon/AppCef/CefNano.vcxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
<ClInclude Include="source\SchemeFileHandler.h" />
4444
<ClInclude Include="source\SchemeHandlerFactory.h" />
4545
<ClInclude Include="source\util\ActionClientServer.h" />
46+
<ClInclude Include="source\util\async\ExploreEtls.h" />
4647
<ClInclude Include="source\util\cact\HotkeyFiredAction.h" />
4748
<ClInclude Include="source\util\cact\OverlayDiedAction.h" />
4849
<ClInclude Include="source\util\cact\PresentmonInitFailedAction.h" />

IntelPresentMon/AppCef/ipm-ui-vue/src/App.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function cyclePreset() {
4141
// === Computed ===
4242
const inSettings = computed(() => {
4343
const routeName = typeof route.name === 'symbol' ? route.name.toString() : route.name;
44-
return ['capture-config', 'overlay-config', 'data-config', 'other-config', 'flash-config']
44+
return ['capture-config', 'overlay-config', 'data-config', 'other-config', 'flash-config', 'logging-config']
4545
.includes(routeName ?? '')
4646
});
4747
const targetName = computed(() => {
@@ -85,6 +85,9 @@ Api.registerHotkeyHandler((action: number) => {
8585
case Action.ToggleCapture:
8686
prefs.toggleCapture()
8787
break;
88+
case Action.ToggleEtlLogging:
89+
prefs.toggleEtlLogging();
90+
break;
8891
default:
8992
console.warn(`Unhandled hotkey action: ${action}`);
9093
break;
@@ -173,6 +176,9 @@ watch(() => loadout.widgets, async () => {
173176
<v-list-item color="primary" :to="{ name: 'flash-config' }">
174177
<v-list-item-title class="nav-item">Flash</v-list-item-title>
175178
</v-list-item>
179+
<v-list-item color="primary" :to="{ name: 'logging-config' }">
180+
<v-list-item-title class="nav-item">Logging</v-list-item-title>
181+
</v-list-item>
176182
<v-list-item color="primary" :to="{ name: 'other-config' }">
177183
<v-list-item-title class="nav-item">Other</v-list-item-title>
178184
</v-list-item>
@@ -193,6 +199,7 @@ watch(() => loadout.widgets, async () => {
193199
<v-icon v-show="prefs.capturing" small color="red-darken-1">mdi-camera-control</v-icon>
194200
</div>
195201
<div class="sta-region">
202+
<div v-show="prefs.etlLogging">ETL</div>
196203
<div>{{ visibilityString }}</div>
197204
<div>{{ prefs.preferences.metricPollRate }}Hz</div>
198205
<div>{{ prefs.preferences.overlayDrawRate }}fps</div>

IntelPresentMon/AppCef/ipm-ui-vue/src/core/api.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ export class Api {
9292
static async setCapture(active: boolean): Promise<void> {
9393
await this.invokeEndpointFuture('SetCapture', {active});
9494
}
95+
static async setEtlLogging(active: boolean): Promise<void> {
96+
await this.invokeEndpointFuture('SetEtlLogging', {active});
97+
}
9598

9699
/////// file access-related /////////
97100
// base file endpoints
@@ -113,6 +116,9 @@ export class Api {
113116
static async exploreCaptures(): Promise<void> {
114117
await this.invokeEndpointFuture('exploreCaptures', {});
115118
}
119+
static async exploreEtls(): Promise<void> {
120+
await this.invokeEndpointFuture('exploreEtls', {});
121+
}
116122
// derived file endpoints
117123
static async loadPreset(path: string): Promise<{payload: string}> {
118124
return await this.loadFile(FileLocation.Install, `Presets\\${path}`);

IntelPresentMon/AppCef/ipm-ui-vue/src/core/hotkey.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export enum Action {
66
ToggleCapture,
77
ToggleOverlay,
88
CyclePreset,
9+
ToggleEtlLogging,
910
}
1011

1112
export type KeyCode = Distinct<number, "hotkey:KeyCode">;

IntelPresentMon/AppCef/ipm-ui-vue/src/router/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import OverlayConfigView from '@/views/OverlayConfigView.vue'
88
import CaptureConfigView from '@/views/CaptureConfigView.vue'
99
import FlashConfigView from '@/views/FlashConfigView.vue'
1010
import OtherConfigView from '@/views/OtherConfigView.vue'
11+
import LoggingConfigView from '@/views/LoggingConfigView.vue'
1112

1213
const router = createRouter({
1314
history: createMemoryHistory(),
@@ -53,6 +54,11 @@ const router = createRouter({
5354
name: 'capture-config',
5455
component: CaptureConfigView,
5556
},
57+
{
58+
path: '/logging',
59+
name: 'logging-config',
60+
component: LoggingConfigView,
61+
},
5662
{
5763
path: '/other',
5864
name: 'other-config',

IntelPresentMon/AppCef/ipm-ui-vue/src/stores/hotkey.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ export const useHotkeyStore = defineStore('hotkey', () => {
3636
action: HotkeyAction.ToggleOverlay,
3737
combination: { key: 46 as KeyCode, modifiers: [2 as ModifierCode, 4 as ModifierCode] },
3838
},
39+
{
40+
action: HotkeyAction.ToggleEtlLogging,
41+
combination: { key: 37 as KeyCode, modifiers: [2 as ModifierCode, 4 as ModifierCode] },
42+
},
3943
] as Binding[]
4044

4145
// === Actions ===

IntelPresentMon/AppCef/ipm-ui-vue/src/stores/preferences.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export const usePreferencesStore = defineStore('preferences', () => {
2525
// === State ===
2626
const preferences = ref<PreferencesType>(makeDefaultPreferences())
2727
const capturing = ref(false)
28+
const etlLogging = ref(false)
2829
const pid = ref<number | null>(null)
2930

3031
// === Nonreactive State ===
@@ -106,6 +107,11 @@ export const usePreferencesStore = defineStore('preferences', () => {
106107
writeCapture(true);
107108
}
108109
}
110+
111+
function toggleEtlLogging() {
112+
etlLogging.value = !etlLogging.value;
113+
Api.setEtlLogging(etlLogging.value);
114+
}
109115

110116
async function pushSpecification() {
111117
// we need to get a non-proxy object for the call
@@ -162,10 +168,12 @@ export const usePreferencesStore = defineStore('preferences', () => {
162168
return {
163169
preferences,
164170
capturing,
171+
etlLogging,
165172
pid,
166173
serialize,
167174
writeCapture,
168175
toggleCapture,
176+
toggleEtlLogging,
169177
pushSpecification,
170178
initPreferences,
171179
resetPreferences
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
<!-- Copyright (C) 2022 Intel Corporation -->
2+
<!-- SPDX-License-Identifier: MIT -->
3+
4+
<script setup lang="ts">
5+
import { usePreferencesStore } from '@/stores/preferences';
6+
import { Api } from '@/core/api';
7+
import { Action } from '@/core/hotkey';
8+
import HotkeyButton from '@/components/HotkeyButton.vue';
9+
10+
const prefs = usePreferencesStore();
11+
async function handleEtlCapture() {
12+
prefs.toggleEtlLogging()
13+
}
14+
async function handleEtlExplore() {
15+
await Api.exploreEtls()
16+
}
17+
function getEtlToggleButtonName() {
18+
return prefs.etlLogging ? 'Finish ETL' : 'Start ETL';
19+
}
20+
</script>
21+
22+
<template>
23+
<div class="page-wrap">
24+
<h2 class="mt-5 ml-5 header-top">
25+
Logging Configuration
26+
</h2>
27+
28+
<v-card class="page-card">
29+
30+
<v-row class="mt-5">
31+
<v-col cols="3">
32+
ETL Capture Hotkey
33+
<p class="text-medium-emphasis text-caption mb-0">
34+
Hotkey for starting/finishing an ETL trace
35+
</p>
36+
</v-col>
37+
<v-col cols="9">
38+
<v-row>
39+
<v-col cols="6">
40+
<hotkey-button :action="Action.ToggleEtlLogging"></hotkey-button>
41+
</v-col>
42+
</v-row>
43+
</v-col>
44+
</v-row>
45+
46+
<v-row class="mt-5">
47+
<v-col cols="3">
48+
Capture ETL
49+
<p class="text-medium-emphasis text-caption mb-0">
50+
Capture ETW events to a raw event stream trace for offline analysis and reporting
51+
</p>
52+
</v-col>
53+
<v-col cols="9">
54+
<v-row>
55+
<v-col cols="6">
56+
<v-btn @click="handleEtlCapture">{{ getEtlToggleButtonName() }}</v-btn>
57+
</v-col>
58+
</v-row>
59+
</v-col>
60+
</v-row>
61+
62+
<v-row class="mt-5">
63+
<v-col cols="3">
64+
ETL Folder
65+
<p class="text-medium-emphasis text-caption mb-0">
66+
Navigate to the folder that receives the captured .etl trace files
67+
</p>
68+
</v-col>
69+
<v-col cols="9">
70+
<v-row>
71+
<v-col cols="6">
72+
<v-btn @click="handleEtlExplore">Open in Explorer</v-btn>
73+
</v-col>
74+
</v-row>
75+
</v-col>
76+
</v-row>
77+
78+
</v-card>
79+
</div>
80+
</template>
81+
82+
<style scoped>
83+
.top-label {
84+
margin: 0;
85+
padding: 0;
86+
height: auto;
87+
}
88+
.header-top {
89+
color: white;
90+
user-select: none;
91+
}
92+
.page-card {
93+
margin: 15px 0;
94+
padding: 0 15px 15px;
95+
}
96+
.page-wrap {
97+
max-width: 750px;
98+
flex-grow: 1;
99+
}
100+
</style>

IntelPresentMon/AppCef/source/Action.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ namespace p2c::client
1616
HideOverlay,
1717
ToggleOverlay,
1818
CyclePreset,
19+
ToggleEtlLogging,
1920
Count_,
2021
};
2122

@@ -35,6 +36,7 @@ namespace p2c::client
3536
{ (uint32_t)Action::HideOverlay, "HideOverlay" },
3637
{ (uint32_t)Action::ToggleOverlay, "ToggleOverlay" },
3738
{ (uint32_t)Action::CyclePreset, "CyclePreset" },
39+
{ (uint32_t)Action::ToggleEtlLogging, "ToggleEtlLogging" },
3840
};
3941
}
4042
}

0 commit comments

Comments
 (0)