blob: f7c6147f47fd13beaa090b3dfcf02453b40e60fd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
|
@echo off
@setlocal
@rem -------------------------------------------------------------------------
@rem OBTAIN INPUT
@rem -------------------------------------------------------------------------
set TR_MODULE=%1
shift
set TR_LEVEL=%1
shift
set TR_VERB=%1
@rem -------------------------------------------------------------------------
@rem VALIDATE COMPONENT & TRACING LEVEL
@rem -------------------------------------------------------------------------
if /i "%TR_MODULE%"=="MONITOR" (
set TR_GUID={dd65554d-9925-49d1-83b6-46125feb4207}
set TR_MODULE=MsnMntrMonitor
if "%TR_LEVEL%"=="0" (
set TR_BITS=
set TR_LEVEL=0
) else if "%TR_LEVEL%"=="1" (
set TR_BITS=
set TR_LEVEL=1
) else if /i "%TR_LEVEL%"=="2" (
set TR_BITS=
set TR_LEVEL=2
) else if /i "%TR_LEVEL%"=="9" (
set TR_BITS=
set TR_LEVEL=9
) else (
echo.
echo Error: Monitor component does not support this trace detail.
goto :show_usage_MsnMntrMonitor
)
) else if /i "%TR_MODULE%"=="NOTIFY" (
set TR_GUID={aca2f74a-7a0d-4f47-be4b-66900813b8e5}
set TR_MODULE=MsnMntrNotify
if "%TR_LEVEL%"=="0" (
set TR_BITS=
set TR_LEVEL=0
) else if "%TR_LEVEL%"=="1" (
set TR_BITS=
set TR_LEVEL=1
) else if /i "%TR_LEVEL%"=="2" (
set TR_BITS=
set TR_LEVEL=2
) else if /i "%TR_LEVEL%"=="3" (
set TR_BITS=
set TR_LEVEL=3
) else if /i "%TR_LEVEL%"=="9" (
set TR_BITS=
set TR_LEVEL=9
) else (
echo.
echo Error: Notify component does not support this trace detail.
goto :show_usage_MsnMntrNotify
)
) else if /i "%TR_MODULE%"=="CONTROL" (
set TR_GUID={eab718af-52de-477c-874d-cb49746bb131}
set TR_MODULE=MsnMntrCtl
if "%TR_LEVEL%"=="0" (
set TR_BITS=
set TR_LEVEL=0
) else if "%TR_LEVEL%"=="1" (
set TR_BITS=
set TR_LEVEL=1
) else if /i "%TR_LEVEL%"=="2" (
set TR_BITS=
set TR_LEVEL=2
) else if /i "%TR_LEVEL%"=="9" (
set TR_BITS=
set TR_LEVEL=9
) else (
echo.
echo Error: Control component does not support this trace detail.
goto :show_usage_MsnMntrCtl
)
) else if /i "%TR_MODULE%"=="INIT" (
set TR_GUID={e7db16bb-41be-4c05-b73e-5feca06f8207}
set TR_MODULE=MsnMntrInit
if "%TR_LEVEL%"=="0" (
set TR_BITS=
set TR_LEVEL=0
) else if "%TR_LEVEL%"=="1" (
set TR_BITS=
set TR_LEVEL=1
) else if /i "%TR_LEVEL%"=="9" (
set TR_BITS=
set TR_LEVEL=9
) else (
echo.
echo Error: Init component does not support this trace detail.
goto :show_usage_MsnMntrInit
)
) else (
echo.
echo Error: No module was selected.
goto :show_usage
)
set TR_NAME=%TR_MODULE%
set TR_DIR=%SystemRoot%\Tracing\%TR_NAME%
set TR_LOG=%TR_DIR%\%TR_NAME%.etl
set TR_BITS=0xFFFFFFFF
set TR_OPTS=
set TR_RT_OPTS=-rt -ft 1
set TRACE_FORMAT_PREFIX=%%9!d!:%%3!04X! %%!FUNC!:
set TRACE_FORMAT_SEARCH_PATH=%TR_DIR%
@rem -------------------------------------------------------------------------
@rem VALIDATE VERB
@rem -------------------------------------------------------------------------
if /i "%TR_VERB%"=="start" (
call :start_trace
) else if /i "%TR_VERB%"=="stop" (
call :stop_trace
) else if /i "%TR_VERB%"=="pdb" (
call :extract_format_info %1
) else if /i "%TR_VERB%"=="rt" (
call :format_realtime
) else if /i "%TR_VERB%"=="fmt" (
call :format_offline
) else (
echo.
echo Error: A supported verb has not been specified.
goto :show_usage
)
goto :eof
:ShowSummary
echo.
echo Trace name : %TR_NAME%
echo Trace directory : %TR_DIR%
echo Trace log : %TR_LOG%
echo Trace level : %TR_LEVEL%
@rem -------------------------------------------------------------------------
@rem START TRACING
@rem -------------------------------------------------------------------------
:start_trace
if not exist %TR_DIR% mkdir %TR_DIR%
logman query %TR_NAME% -ets 1 > NUL
if errorlevel 1 (
logman start %TR_NAME% %TR_OPTS% -p %TR_GUID% %TR_BITS% %TR_LEVEL% -o %TR_LOG% -ets
) else (
echo Collection is already started.
)
goto :eof
@rem -------------------------------------------------------------------------
@rem STOP TRACING
@rem -------------------------------------------------------------------------
:stop_trace
logman query %TR_NAME% -ets 1>NUL
if NOT errorlevel 1 (
logman stop %TR_NAME% -ets
)
goto :eof
@rem -------------------------------------------------------------------------
@rem EXTRACT FORMAT INFO
@rem -------------------------------------------------------------------------
:extract_format_info
if "%1" == "" (
set TR_PDB=.\%TR_MODULE%.pdb
)else (
set TR_PDB=%1
)
tracepdb -f %TR_PDB% -p %TR_DIR%
goto :eof
@rem -------------------------------------------------------------------------
@rem FORMAT REALTIME
@rem -------------------------------------------------------------------------
:format_realtime
call :stop_trace
set TR_OPTS=%TR_RT_OPTS%
call :start_trace
start "%TR_NAME% Tracing" /low tracefmt -displayonly -rt %TR_NAME%
goto :eof
@rem -------------------------------------------------------------------------
@rem FORMAT OFFLINE
@rem -------------------------------------------------------------------------
:format_offline
tracefmt -o %TR_NAME%.txt %TR_LOG% -display
goto :eof
goto :eof
@rem -------------------------------------------------------------------------
@rem CONTEXT SENSITIVE HELP
@rem -------------------------------------------------------------------------
:show_usage
call :show_usage_header
echo 9 Display all trace events
echo Select a component to see individual supported tracing levels.
call :show_usage_footer
goto :eof
:show_usage_MsnMntrMonitor
call :show_usage_header
echo 0 Established flow
echo 1 Change of state information
echo 2 Layer notifications
echo 9 Display all trace events
call :show_usage_footer
goto :eof
:show_usage_MsnMntrNotify
call :show_usage_header
echo 0 Client to server
echo 1 Peer to peer
echo 2 Unknown
echo 3 All traffic
echo 9 Display all trace events
call :show_usage_footer
goto :eof
:show_usage_MsnMntrCtl
call :show_usage_header
echo 0 Initialization
echo 1 Device control
echo 2 State
echo 9 Display all trace events
call :show_usage_footer
goto :eof
:show_usage_MsnMntrInit
call :show_usage_header
echo 0 Initialization
echo 1 Shutdown
echo 9 Display all trace events
call :show_usage_footer
goto :eof
:show_usage_header
echo.
echo Usage: monitor_trace COMPONENT LEVEL VERB
echo.
echo Components:
echo MONITOR, NOTIFY, CONTROL and INIT
echo.
echo Trace detail:
goto :eof
:show_usage_footer
echo.
echo Verbs:
echo start Start collection.
echo stop Stop collection.
echo pdb Extract format information from the pdb in the current
echo directory.
echo pdb [file] Like the above, but allows the full path to the pdb
echo to be specified.
echo rt Displays the trace output in real-time. This
echo automatically stops any existing collection and begins
echo a new one with appropriate parameters for real-time.
echo fmt Format the trace logfile to the console.
echo.
echo Note:
echo The most common scenario is to extract the format information from
echo the pdb, and then display the output in real-time.
echo.
echo Example:
echo cd /d MySymbolDir
echo monitor_trace init 0 pdb
echo monitor_trace init 0 rt
goto :eof
|