Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

407 lines
16 KiB

  1. @echo off
  2. rem Name : Runtrace.cmd
  3. rem Author: Shiwei Sun
  4. rem Date : January 29th 1999
  5. rem
  6. rem CMD script file to test event tracing. All the variations are very trivial
  7. rem and test for basic functionality.
  8. rem
  9. rem Variation 1 - single provider - start, query, update and stop tested
  10. rem Variation 2 - three providers - intermingled start and stop tested
  11. rem Variation 3 - changes buffer numbers and sizes
  12. rem Variation 4 - tests sequential and circular buffer modifications
  13. rem Variation 5 - tests kernel logger and all kernel flags
  14. if "%1"=="?" goto help
  15. if "%1"=="/?" goto help
  16. if "%1"=="-?" goto help
  17. if "%1"=="/h" goto help
  18. if "%1"=="-h" goto help
  19. if "%1"=="help" goto help
  20. if exist evntrace.log del evntrace.log
  21. if exist provider.log del provider.log
  22. if exist SuccessTests.log del SuccessTests.log
  23. if exist FailedTests.log del FailedTests.log
  24. if exist ST.txt del ST.txt
  25. if exist FT.txt del FT.txt
  26. @set Guid1=d58c126f-b309-11d1-969e-0000f875a5bc
  27. @set Guid2=dcb8c570-2c70-11d2-90ba-00805f8a4d63
  28. @set Guid3=f5b6d380-2c70-11d2-90ba-00805f8a4d63
  29. @set Guid4=f5b6d381-2c70-11d1-90ba-00805f8a4d63
  30. @set Guid5=f5b6d382-2c70-11d1-90ba-00805f8a4d63
  31. @set Guid6=f5b6d383-2c70-11d1-90ba-00805f8a4d63
  32. @echo ========================================================
  33. @echo Variation 1 - single provider and logger - trivial tests
  34. @echo ========================================================
  35. start /b "Variation 1 - provider 1" tracedp.exe 8000 -guid #%Guid1% -UseEventTraceHeader -GuidPtrMofPtr
  36. sleep 1
  37. tracelog.exe -start dp1 -guid #%Guid1% -f dp1.log -b 1024>rundrt.log
  38. for /F "tokens=3" %%I in ('findstr Status: rundrt.log') do set test1=%%I
  39. call :SUB1 %test1% 1
  40. sleep 1
  41. tracelog -q dp1 -guid #%Guid1% -f dp1.log>rundrt.log
  42. for /F "tokens=3" %%I in ('findstr Status: rundrt.log') do set test2=%%I
  43. call :SUB1 %test2% 2
  44. sleep 1
  45. tracelog -flush dp1 -guid #%Guid1%>rundrt.log
  46. for /F "tokens=3" %%I in ('findstr Status: rundrt.log') do set test3=%%I
  47. call :SUB1 %test3% 3
  48. sleep 1
  49. tracelog -update dp1 -guid #%Guid1%>rundrt.log
  50. for /F "tokens=3" %%I in ('findstr Status: rundrt.log') do set test4=%%I
  51. call :SUB1 %test4% 4
  52. sleep 1
  53. tracelog -stop dp1 -guid #%Guid1% -f dp1.log>rundrt.log
  54. for /F "tokens=3" %%I in ('findstr Status: rundrt.log') do set test5=%%I
  55. call :SUB1 %test5% 5
  56. @echo ==================================================================
  57. @echo Variation 2 - three providers - intermingled start and stop tested
  58. @echo ==================================================================
  59. start /b "Variation 2 - provider 2" tracedp.exe 10000 -guid #dcb8c570-2c70-11d2-90ba-00805f8a4d63 -UseEventInstanceHeader -UseMofPtrFlag
  60. rem echo ! Starting provider 3 ...
  61. rem start "Variation 2 - provider 3" tracedp.exe 20000 -guid #%Guid3% -UseEventTraceHeader -GuidPtr
  62. rem echo ! Starting provider 3 finished
  63. tracelog.exe -start dp2 -guid #dcb8c570-2c70-11d2-90ba-00805f8a4d63 -f dp2.log -ft 2 -b 1>rundrt.log
  64. for /F "tokens=3" %%I in ('findstr Status: rundrt.log') do set test6=%%I
  65. call :SUB1 %test6% 6
  66. sleep 1
  67. start /b "Variation 2 - provider 4" tracedp.exe 7000 -guid #054b1ae0-2c71-11d2-90ba-00805f8a4d63 -UseEventTraceHeader -UseMofPtrFlag
  68. rem echo ! Starting Logger dp3 for provider 3
  69. rem tracelog.exe -start dp3 -guid #-%Guid3%" -f dp3.log
  70. rem echo ! Starting logger dp3 finished
  71. rem echo !
  72. rem echo ! Sleeping for 1 seconds...
  73. rem sleep 1
  74. rem echo ! Querying logger dp3...
  75. rem tracelog.exe -q dp3 -guid #%Guid3% -f dp3.log
  76. rem echo ! Querying logger dp3 finished
  77. rem echo !
  78. rem echo "Sleeping for 1 seconds..."
  79. rem sleep 1
  80. tracelog.exe -start dp4 -guid #054b1ae0-2c71-11d2-90ba-00805f8a4d63 -f dp4.log -b 128 -max 100>rundrt.log
  81. for /F "tokens=3" %%I in ('findstr Status: rundrt.log') do set test7=%%I
  82. call :SUB1 %test7% 7
  83. rem echo ! Update request to logger dp3...
  84. rem tracelog.exe -update dp3 -guid #%Guid3% -f dp3.log
  85. rem echo ! Update request to logger dp3 finished
  86. rem echo !
  87. tracelog.exe -flush dp2 -guid #%Guid2% -f dp2.log -rt>rundrt.log
  88. for /F "tokens=3" %%I in ('findstr Status: rundrt.log') do set test8=%%I
  89. call :SUB1 %test8% 8
  90. tracelog.exe -update dp2 -guid #%Guid2% >rundrt.log
  91. for /F "tokens=3" %%I in ('findstr Status: rundrt.log') do set test9=%%I
  92. call :SUB1 %test9% 9
  93. tracelog.exe -stop dp2 -guid #%Guid2% -f dp2.log>rundrt.log
  94. for /F "tokens=3" %%I in ('findstr Status: rundrt.log') do set test10=%%I
  95. call :SUB1 %test10% 10
  96. sleep 3
  97. tracelog.exe -stop dp4 -guid #054b1ae0-2c71-11d2-90ba-00805f8a4d63 -f dp4.log>rundrt.log
  98. for /F "tokens=3" %%I in ('findstr Status: rundrt.log') do set test11=%%I
  99. call :SUB1 %test11% 11
  100. sleep 1
  101. rem echo ! Stopping logger dp3 (provider 3 should terminate now) ...
  102. rem tracelog.exe -stop dp3 -guid #%Guid3% -f dp3.log
  103. rem echo ! Stopping logger dp3 finished
  104. rem echo !
  105. @echo ==============================================
  106. @echo Variation 3 - changes buffer numbers and sizes
  107. @echo ==============================================
  108. start /b "Variation 3 - provider 5" tracedp.exe 25000 -guid #b39d2858-2c79-11d2-90ba-00805f8a4d63
  109. start /b "Variation 3 - provider 6" tracedp.exe 1000 -guid #d0ca64d8-2c79-11d2-90ba-00805f8a4d63
  110. tracelog.exe -start dp5 -guid #b39d2858-2c79-11d2-90ba-00805f8a4d63 -f dp5.log -b 20 -min 50 -max 100>rundrt.log
  111. for /F "tokens=3" %%I in ('findstr Status: rundrt.log') do set test12=%%I
  112. call :SUB1 %test12% 12
  113. sleep 1
  114. tracelog.exe -start dp6 -guid #d0ca64d8-2c79-11d2-90ba-00805f8a4d63 -f dp6.log -b 1024 -min 1024 -max 8192>rundrt.log
  115. for /F "tokens=3" %%I in ('findstr Status: rundrt.log') do set test13=%%I
  116. call :SUB1 %test13% 13
  117. sleep 3
  118. tracelog.exe -stop dp5 -guid #b39d2858-2c79-11d2-90ba-00805f8a4d63 -f dp5.log>rundrt.log
  119. for /F "tokens=3" %%I in ('findstr Status: rundrt.log') do set test14=%%I
  120. call :SUB1 %test14% 14
  121. tracelog.exe -update dp6 -guid #d0ca64d8-2c79-11d2-90ba-00805f8a4d63 >rundrt.log
  122. for /F "tokens=3" %%I in ('findstr Status: rundrt.log') do set test15=%%I
  123. call :SUB1 %test15% 15
  124. tracelog.exe -stop dp6 -guid #d0ca64d8-2c79-11d2-90ba-00805f8a4d63 -f dp6.log>rundrt.log
  125. for /F "tokens=3" %%I in ('findstr Status: rundrt.log') do set test16=%%I
  126. call :SUB1 %test16% 16
  127. @echo ================================================================
  128. @echo Variation 4 - tests sequential and circular buffer modifications
  129. @echo Trace File Variations
  130. @echo ================================================================
  131. start /b "Variation 4 - provider 7" tracedp.exe 25000 -guid #68799948-2c7f-11d2-90bb-00805f8a4d63
  132. start /b "Variation 4 - provider 8" tracedp.exe 25000 -guid #c9bf20c8-2c7f-11d2-90bb-00805f8a4d63
  133. start /b "Variation 4 - provider 9" tracedp.exe 25000 -guid #c9f49c58-2c7f-11d2-90bb-00805f8a4d63
  134. sleep 1
  135. tracelog.exe -start dp7 -guid #68799948-2c7f-11d2-90bb-00805f8a4d63 -f dp7.log -seq>rundrt.log
  136. for /F "tokens=3" %%I in ('findstr Status: rundrt.log') do set test17=%%I
  137. call :SUB1 %test17% 17
  138. sleep 1
  139. tracelog.exe -start dp8 -guid #c9bf20c8-2c7f-11d2-90bb-00805f8a4d63 -f dp8.log -cir 1>rundrt.log
  140. for /F "tokens=3" %%I in ('findstr Status: rundrt.log') do set test18=%%I
  141. call :SUB1 %test18% 18
  142. sleep 2
  143. tracelog.exe -start dp9 -guid #c9f49c58-2c7f-11d2-90bb-00805f8a4d63 -f dp9.log>rundrt.log
  144. for /F "tokens=3" %%I in ('findstr Status: rundrt.log') do set test19=%%I
  145. call :SUB1 %test19% 19
  146. sleep 2
  147. tracelog.exe -q dp7 -guid #68799948-2c7f-11d2-90bb-00805f8a4d63 -f dp7.log -seq>rundrt.log
  148. for /F "tokens=3" %%I in ('findstr Status: rundrt.log') do set test20=%%I
  149. call :SUB1 %test20% 20
  150. sleep 2
  151. tracelog.exe -update dp8 -guid #c9bf20c8-2c7f-11d2-90bb-00805f8a4d63 -cir 1>rundrt.log
  152. for /F "tokens=3" %%I in ('findstr Status: rundrt.log') do set test21=%%I
  153. call :SUB1 %test21% 21
  154. sleep 2
  155. tracelog.exe -update dp8 -guid #c9bf20c8-2c7f-11d2-90bb-00805f8a4d63 -cir 1>rundrt.log
  156. for /F "tokens=3" %%I in ('findstr Status: rundrt.log') do set test22=%%I
  157. call :SUB1 %test22% 22
  158. tracelog.exe -q dp9 -guid #c9f49c58-2c7f-11d2-90bb-00805f8a4d63 -f dp9.log>rundrt.log
  159. for /F "tokens=3" %%I in ('findstr Status: rundrt.log') do set test23=%%I
  160. call :SUB1 %test23% 23
  161. sleep 2
  162. tracelog.exe -flush dp7 -guid #68799948-2c7f-11d2-90bb-00805f8a4d63 -f dp7.log -seq>rundrt.log
  163. for /F "tokens=3" %%I in ('findstr Status: rundrt.log') do set test24=%%I
  164. call :SUB1 %test24% 24
  165. sleep 2
  166. tracelog.exe -update dp7 -guid #68799948-2c7f-11d2-90bb-00805f8a4d63 -seq>rundrt.log
  167. for /F "tokens=3" %%I in ('findstr Status: rundrt.log') do set test25=%%I
  168. call :SUB1 %test25% 25
  169. sleep 4
  170. tracelog.exe -stop dp7 -guid #68799948-2c7f-11d2-90bb-00805f8a4d63 -f dp7.log -seq>rundrt.log
  171. for /F "tokens=3" %%I in ('findstr Status: rundrt.log') do set test26=%%I
  172. call :SUB1 %test26% 26
  173. tracelog.exe -stop dp8 -guid #c9bf20c8-2c7f-11d2-90bb-00805f8a4d63 -f dp8.log -cir>rundrt.log
  174. for /F "tokens=3" %%I in ('findstr Status: rundrt.log') do set test27=%%I
  175. call :SUB1 %test27% 27
  176. tracelog.exe -stop dp9 -guid #c9f49c58-2c7f-11d2-90bb-00805f8a4d63 -f dp9.log>rundrt.log
  177. for /F "tokens=3" %%I in ('findstr Status: rundrt.log') do set test28=%%I
  178. call :SUB1 %test28% 28
  179. @echo ======================================================
  180. @echo Variation 5 - tests kernel logger and all kernel flags
  181. @echo ======================================================
  182. tracelog.exe -start -img -fio -pf -hf>rundrt.log
  183. for /F "tokens=3" %%I in ('findstr Status: rundrt.log') do set test29=%%I
  184. call :SUB1 %test29% 29
  185. sleep 2
  186. tracelog.exe -q>rundrt.log
  187. for /F "tokens=3" %%I in ('findstr Status: rundrt.log') do set test30=%%I
  188. call :SUB1 %test30% 30
  189. tracelog.exe -stop>rundrt.log
  190. for /F "tokens=3" %%I in ('findstr Status: rundrt.log') do set test31=%%I
  191. call :SUB1 %test31% 31
  192. @echo =====================================
  193. @echo Variation 6 - tests real-time loggers
  194. @echo Starting Realtime Kernel Logger
  195. @echo =====================================
  196. tracelog.exe -start -rt -pf -fio -ft 1 -b 1>rundrt.log
  197. for /F "tokens=3" %%I in ('findstr Status: rundrt.log') do set test32=%%I
  198. call :SUB1 %test32% 32
  199. sleep 5
  200. tracelog.exe -stop -rt>rundrt.log
  201. for /F "tokens=3" %%I in ('findstr Status: rundrt.log') do set test33=%%I
  202. call :SUB1 %test33% 33
  203. @echo Starting Realtime Kernel Logger with large Buffers
  204. tracelog.exe -start -rt -pf -fio -ft 1 -b 512>rundrt.log
  205. for /F "tokens=3" %%I in ('findstr Status: rundrt.log') do set test34=%%I
  206. call :SUB1 %test34% 34
  207. sleep 5
  208. tracelog.exe -stop -rt>rundrt.log
  209. for /F "tokens=3" %%I in ('findstr Status: rundrt.log') do set test35=%%I
  210. call :SUB1 %test35% 35
  211. start /b "Variation 6 - provider 5" tracedp.exe 25000 -guid #b39d2858-2c79-11d2-90ba-00805f8a4d63
  212. start /b "Variation 6 - provider 6" tracedp.exe 1000 -guid #d0ca64d8-2c79-11d2-90ba-00805f8a4d63
  213. tracelog.exe -start dp5 -guid #b39d2858-2c79-11d2-90ba-00805f8a4d63 -rt -b 20 -min 50 -max 100>rundrt.log
  214. for /F "tokens=3" %%I in ('findstr Status: rundrt.log') do set test36=%%I
  215. call :SUB1 %test36% 36
  216. tracelog.exe -start dp6 -guid #d0ca64d8-2c79-11d2-90ba-00805f8a4d63 -rt -b 20 -min 50 -max 100>rundrt.log
  217. for /F "tokens=3" %%I in ('findstr Status: rundrt.log') do set test37=%%I
  218. call :SUB1 %test37% 37
  219. tracelog.exe -stop dp5>rundrt.log
  220. for /F "tokens=3" %%I in ('findstr Status: rundrt.log') do set test38=%%I
  221. call :SUB1 %test38% 38
  222. tracelog.exe -stop dp6>rundrt.log
  223. for /F "tokens=3" %%I in ('findstr Status: rundrt.log') do set test39=%%I
  224. call :SUB1 %test39% 39
  225. @echo ===========================================================
  226. @echo Variation 7 - Kernel Logger Tests - Different Logger Types
  227. @echo Sequential Logger Starting Sequential Kernel Logger
  228. @echo ==========================================================
  229. tracelog.exe -start -f krnl7.log>rundrt.log
  230. for /F "tokens=3" %%I in ('findstr Status: rundrt.log') do set test40=%%I
  231. call :SUB1 %test40% 40
  232. sleep 5
  233. tracelog.exe -stop>rundrt.log
  234. for /F "tokens=3" %%I in ('findstr Status: rundrt.log') do set test41=%%I
  235. call :SUB1 %test41% 41
  236. @echo Circular Logger 1 MB
  237. tracelog.exe -start -f krnl8.log -cir 1>rundrt.log
  238. for /F "tokens=3" %%I in ('findstr Status: rundrt.log') do set test42=%%I
  239. call :SUB1 %test42% 42
  240. sleep 50
  241. tracelog.exe -stop>rundrt.log
  242. for /F "tokens=3" %%I in ('findstr Status: rundrt.log') do set test43=%%I
  243. call :SUB1 %test43% 43
  244. @echo Circular Logger 20 MB With Flush Timer with Large buffer Size
  245. tracelog.exe -start -f krnl9.log -cir 20 -ft 1 -b 128 -fio -pf>rundrt.log
  246. for /F "tokens=3" %%I in ('findstr Status: rundrt.log') do set test44=%%I
  247. call :SUB1 %test44% 44
  248. sleep 50
  249. tracelog.exe -stop>rundrt.log
  250. for /F "tokens=3" %%I in ('findstr Status: rundrt.log') do set test45=%%I
  251. call :SUB1 %test45% 45
  252. @echo Kernel Logger with some flags masked.
  253. tracelog.exe -start -f krnl10.log>rundrt.log
  254. for /F "tokens=3" %%I in ('findstr Status: rundrt.log') do set test46=%%I
  255. call :SUB1 %test46% 46
  256. tracelog.exe -q>rundrt.log
  257. for /F "tokens=3" %%I in ('findstr Status: rundrt.log') do set test47=%%I
  258. call :SUB1 %test47% 47
  259. sleep 5
  260. tracelog.exe -stop>rundrt.log
  261. for /F "tokens=3" %%I in ('findstr Status: rundrt.log') do set test48=%%I
  262. call :SUB1 %test48% 48
  263. @echo Kernel Logger with Flush Timer and Aging Decay with buffer variation
  264. tracelog.exe -start -f krnl11.log -fio -pf -b 1 -min 2 -max 1000 -ft 1 -age 1>rundrt.log
  265. for /F "tokens=3" %%I in ('findstr Status: rundrt.log') do set test49=%%I
  266. call :SUB1 %test49% 49
  267. tracelog.exe -q>rundrt.log
  268. for /F "tokens=3" %%I in ('findstr Status: rundrt.log') do set test50=%%I
  269. call :SUB1 %test50% 50
  270. sleep 100
  271. tracelog.exe -q>rundrt.log
  272. for /F "tokens=3" %%I in ('findstr Status: rundrt.log') do set test51=%%I
  273. call :SUB1 %test51% 51
  274. tracelog.exe -stop>rundrt.log
  275. for /F "tokens=3" %%I in ('findstr Status: rundrt.log') do set test52=%%I
  276. call :SUB1 %test52% 52
  277. del dp*
  278. goto :EOF
  279. :help
  280. tracelog.exe -h
  281. echo !
  282. echo !
  283. echo Usage: provider [parm1] [parm2] [parm3] [parm4] [parm5] [parm6]
  284. echo param1: Maximum number of events to process
  285. echo param2: Control guid to trace
  286. echo parm3: Sleep time in seconds between each event loop
  287. echo parm4: -UseEventInstanceHeader or TraceEvent
  288. echo parm5: GuidPtr or -UseMofPtrFlag or GuidPtrMofPtr
  289. echo parm6: or SingleReg
  290. echo Note: Parameters must be in sequential order, and cannot skipped.
  291. echo example:
  292. echo provider 80 %Guid1% 1 -UseEventTraceHeader MofPtr
  293. echo !
  294. echo !
  295. echo Usage: tracedmp [options] LogFileName
  296. echo LogFileName Log file name from witch tracedp.exe dumps data
  297. echo -begin time Dump data from begin time
  298. echo -end time Dump data with end time
  299. echo -um Set user mode. If omitted, default is kernel mode
  300. echo -rt logger Set real time mode for logger. If empty, kernel logger
  301. echo -guid name Guid file name. Default is MofData.guid
  302. echo -o name Output file name. Default is DumpFile.csv and Summary.txt
  303. echo example 1:
  304. echo tracedmp -um -o outputfile dp1.evm //dump user mode, log file is dp1.evm
  305. echo example 2:
  306. echo tracedmp -rt //dump kernel mode, real time stream.
  307. echo !
  308. :SUB1
  309. if %1==0L (
  310. @echo TEST %2 SUCCESS >> ST.txt
  311. echo. >>SuccessTests.log
  312. echo. >>SuccessTests.log
  313. @echo TEST %2 SUCCESS >> SuccessTests.log
  314. type rundrt.log >> SuccessTests.log
  315. @echo TEST %2 SUCCESS
  316. echo.
  317. ) else (
  318. @echo TEST %2 FAILED >> FT.txt
  319. echo. >>FailedTests.log
  320. echo. >>FailedTests.log
  321. @echo TEST %2 FAILED >> FailedTests.log
  322. type rundrt.log >> FailedTests.log
  323. @echo TEST %2 FAILED
  324. echo.
  325. )
  326. :EOF