Source code of Windows XP (NT5)
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.

789 lines
22 KiB

  1. /*++
  2. Copyright (c) 1995 Microsoft Corporation
  3. Module Name:
  4. reducer.c
  5. Abstract:
  6. Trace Reducer Tool
  7. Author:
  8. 08-Apr-1998 mraghu
  9. Revision History:
  10. --*/
  11. #ifdef __cplusplus
  12. extern "C"{
  13. #endif
  14. #define _UNICODE
  15. #define UNICODE
  16. #include <stdlib.h>
  17. #include <stdio.h>
  18. #include <windows.h>
  19. #include <shellapi.h>
  20. #include <tchar.h>
  21. #include "pdhp.h"
  22. #define MAXSTR 1024
  23. #define MAXLOGFILES 16
  24. #define MAX_BUFFER_SIZE 1048576
  25. #if DBG
  26. ULONG ETAAPITestFlag = 1;
  27. VOID
  28. TestETAApis(
  29. PTRACE_BASIC_INFO TraceBasicInfo
  30. );
  31. #endif
  32. void ReducerUsage()
  33. {
  34. printf("Usage: reducer [Options] <EtlFile1 EtlFile2 ...> | [-h | -help | -?]\n");
  35. printf("\t-out <filename> Output file name. Default is Workload.txt\n");
  36. printf("\t-h \n");
  37. printf("\t-help \n");
  38. printf("\t-? Display usage information\n");
  39. // printf("\t-start <time-stamp> Start Time\n");
  40. // printf("\t-end <time-stamp> End Time\n");
  41. // printf("\t <time-stamp> can be found in tracedmp result\n");
  42. // printf("\n");
  43. // printf("\t-base Original reducer report (default report)\n");
  44. // printf("\t-file Hot File Report\n");
  45. // printf("\t-pf page fault report\n");
  46. // printf("\t -summary processes summary of faults per process (default PF report).\n");
  47. // printf("\t modules summary of faults per module.\n");
  48. // printf("\t -process <image name> rundown for specific process.\n");
  49. // printf("\t all\n");
  50. // printf("\t -module <module name> rundown for specific modules.\n");
  51. // printf("\t all\n");
  52. // printf("\t -sort ALL sort by all fault total.\n");
  53. // printf("\t HPF sort by HPF fault total.\n");
  54. // printf("\t TF sort by TF fault total.\n");
  55. // printf("\t DZF sort by DZF fault total.\n");
  56. // printf("\t COW sort by COW fault total.\n");
  57. // printf("\n");
  58. // printf("\tNote: (1) Cannot generate HotFile Report and PageFault Report\n");
  59. // printf("\t at the same time\n");
  60. // printf("\t0x%08X,%d,\n", STATUS_SEVERITY_WARNING, RtlNtStatusToDosError(STATUS_SEVERITY_WARNING));
  61. }
  62. ULONGLONG
  63. ParseTimeString(TCHAR * strTime)
  64. {
  65. #if 0
  66. CHAR lstrTime[25];
  67. PCHAR strYear, strMonth, strDate,
  68. strHour, strMinute, strSecond, strMilliSecond;
  69. LARGE_INTEGER largeTime;
  70. FILETIME localTime, stdTime;
  71. SYSTEMTIME sysTime;
  72. if (strTime == NULL)
  73. return (ULONGLONG) 0;
  74. strcpy(lstrTime, strTime);
  75. strMonth = lstrTime;
  76. for (strDate = strMonth;
  77. *strDate && *strDate >= '0' && *strDate <= '9';
  78. strDate ++);
  79. *strDate = '\0';
  80. strDate ++;
  81. for (strYear = strDate;
  82. *strYear && *strYear >= '0' && *strYear <= '9';
  83. strYear ++);
  84. *strYear = '\0';
  85. strYear ++;
  86. for (strHour = strYear;
  87. *strHour && *strHour >= '0' && *strHour <= '9';
  88. strHour ++);
  89. *strHour = '\0';
  90. strHour ++;
  91. for (strMinute = strHour;
  92. *strMinute && *strMinute >= '0' && *strMinute <= '9';
  93. strMinute ++);
  94. *strMinute = '\0';
  95. strMinute ++;
  96. for (strSecond = strMinute;
  97. *strSecond && *strSecond >= '0' && *strSecond <= '9';
  98. strSecond ++);
  99. *strSecond = '\0';
  100. strSecond ++;
  101. for (strMilliSecond = strSecond;
  102. *strMilliSecond && *strMilliSecond >= '0' && *strMilliSecond <= '9';
  103. strMilliSecond ++);
  104. *strMilliSecond = '\0';
  105. strMilliSecond ++;
  106. sysTime.wYear = atoi(strYear);
  107. sysTime.wMonth = atoi(strMonth);
  108. sysTime.wDay = atoi(strDate);
  109. sysTime.wHour = atoi(strHour);
  110. sysTime.wMinute = atoi(strMinute);
  111. sysTime.wSecond = atoi(strSecond);
  112. sysTime.wMilliseconds = atoi(strMilliSecond);
  113. SystemTimeToFileTime(&sysTime, &localTime);
  114. LocalFileTimeToFileTime(&localTime, &stdTime);
  115. largeTime.HighPart = stdTime.dwHighDateTime;
  116. largeTime.LowPart = stdTime.dwLowDateTime;
  117. return (ULONGLONG) largeTime.QuadPart;
  118. #else
  119. ULONGLONG TimeStamp = 0;
  120. ULONG i = 0;
  121. for (i = 0; strTime[i] != '\0'; i ++)
  122. {
  123. TimeStamp = TimeStamp * 10 + (strTime[i] - '0');
  124. }
  125. return TimeStamp;
  126. #endif
  127. }
  128. VOID
  129. ProcessTrace(
  130. IN ULONG LogFileCount,
  131. IN LPCTSTR * LogFileName,
  132. IN ULONGLONG StartTime,
  133. IN ULONGLONG EndTime,
  134. IN ULONGLONG DSStartTime,
  135. IN ULONGLONG DSEndTime,
  136. IN ULONG MoreFlags,
  137. IN PVOID pUserContext,
  138. IN LPCTSTR pOutFileName
  139. )
  140. {
  141. // Call TraceLib and process it.
  142. //
  143. TRACE_BASIC_INFO TraceBasicInfo;
  144. memset(&TraceBasicInfo, 0, sizeof(TRACE_BASIC_INFO));
  145. TraceBasicInfo.Flags = TRACE_REDUCE | MoreFlags;
  146. TraceBasicInfo.LogFileName = LogFileName;
  147. TraceBasicInfo.LogFileCount = LogFileCount;
  148. TraceBasicInfo.pUserContext = pUserContext;
  149. TraceBasicInfo.StartTime = StartTime;
  150. TraceBasicInfo.EndTime = EndTime;
  151. TraceBasicInfo.DSStartTime = DSStartTime;
  152. TraceBasicInfo.DSEndTime = DSEndTime;
  153. TraceBasicInfo.ProcFileName = pOutFileName;
  154. InitTraceContext(&TraceBasicInfo);
  155. #if DBG
  156. if (ETAAPITestFlag) {
  157. TestETAApis( & TraceBasicInfo );
  158. }
  159. #endif
  160. DeinitTraceContext(&TraceBasicInfo);
  161. }
  162. int __cdecl main(int argc ,char * argv[])
  163. {
  164. WCHAR TraceLogFile[MAXSTR];
  165. WCHAR PerfLogFile[MAXSTR];
  166. BOOLEAN bTrace = FALSE;
  167. LPTSTR EvmFile[MAXLOGFILES];
  168. ULONGLONG StartTime = 0, EndTime = 0;
  169. ULONG i;
  170. ULONG LogFileCount = 0;
  171. LPTSTR *targv;
  172. #ifdef UNICODE
  173. LPTSTR *cmdargv;
  174. #endif
  175. ULONG flagsMore = 0;
  176. PVOID pUserContext = NULL;
  177. CPD_USER_CONTEXT_MM UserContextMM;
  178. #ifdef UNICODE
  179. if ((cmdargv = CommandLineToArgvW(
  180. GetCommandLineW(), // pointer to a command-line string
  181. &argc // receives the argument count
  182. )) == NULL)
  183. {
  184. return(GetLastError());
  185. };
  186. targv = cmdargv ;
  187. #else
  188. targv = argv;
  189. #endif
  190. UserContextMM.reportNow = REPORT_SUMMARY_PROCESS;
  191. UserContextMM.sortNow = REPORT_SORT_ALL;
  192. UserContextMM.strImgName = NULL;
  193. memset(&TraceLogFile, 0, sizeof(WCHAR) * MAXSTR);
  194. while (--argc > 0)
  195. {
  196. ++targv;
  197. if (**targv == '-' || **targv == '/')
  198. {
  199. ** targv = '-';
  200. if (!_tcsicmp(targv[0], _T("-out")))
  201. {
  202. if (argc > 1)
  203. {
  204. TCHAR TempStr[MAXSTR];
  205. _tcscpy(TempStr, targv[1]);
  206. ++targv; --argc;
  207. _tfullpath(TraceLogFile, TempStr, MAXSTR);
  208. printf("Setting output file to: '%ws'\n", TraceLogFile);
  209. bTrace = TRUE;
  210. }
  211. }
  212. else if (!_tcsicmp(targv[0], _T("-start")))
  213. {
  214. if (argc > 1)
  215. {
  216. flagsMore |= TRACE_DS_ONLY | TRACE_LOG_REPORT_BASIC;
  217. StartTime = ParseTimeString(targv[1]);
  218. argc --; targv ++;
  219. }
  220. }
  221. else if (!_tcsicmp(targv[0], _T("-end")))
  222. {
  223. if (argc > 1)
  224. {
  225. flagsMore |= TRACE_DS_ONLY | TRACE_LOG_REPORT_BASIC;
  226. EndTime = ParseTimeString(targv[1]);
  227. argc --; targv ++;
  228. }
  229. }
  230. else if (!_tcsicmp(targv[0], _T("-base")))
  231. {
  232. flagsMore |= TRACE_LOG_REPORT_BASIC;
  233. }
  234. else if (!_tcsicmp(targv[0], _T("-spooler")))
  235. {
  236. flagsMore |= TRACE_LOG_REPORT_BASIC;
  237. flagsMore |= TRACE_SPOOLER;
  238. }
  239. else if (!_tcsicmp(targv[0], _T("-total")))
  240. {
  241. flagsMore |= TRACE_LOG_REPORT_TOTALS;
  242. }
  243. else if (!_tcsicmp(targv[0], _T("-file")))
  244. {
  245. flagsMore |= TRACE_LOG_REPORT_FILE;
  246. /* if (argc > 1 && targv[1][0] >= '0' && targv[1][0] <= '9')
  247. {
  248. pUserContext = UlongToPtr(atoi(targv[1]));
  249. argc --; targv ++;
  250. }
  251. else
  252. {
  253. pUserContext = UlongToPtr(DEFAULT_FILE_REPORT_SIZE);
  254. }
  255. */
  256. }
  257. else if (!_tcsicmp(targv[0], _T("-hpf")))
  258. {
  259. flagsMore |= TRACE_LOG_REPORT_HARDFAULT;
  260. }
  261. else if (!_tcsicmp(targv[0], _T("-pf")))
  262. {
  263. flagsMore |= TRACE_LOG_REPORT_MEMORY;
  264. pUserContext = (PVOID) & UserContextMM;
  265. }
  266. else if (!_tcsicmp(targv[0], _T("-summary")))
  267. {
  268. if (argc > 1)
  269. {
  270. flagsMore |= TRACE_LOG_REPORT_MEMORY;
  271. pUserContext = (PVOID) & UserContextMM;
  272. if (!_tcsicmp(targv[1], _T("processes")))
  273. {
  274. argc --; targv ++;
  275. UserContextMM.reportNow = REPORT_SUMMARY_PROCESS;
  276. }
  277. else if (!_tcsicmp(targv[1], _T("modules")))
  278. {
  279. argc --; targv ++;
  280. UserContextMM.reportNow = REPORT_SUMMARY_MODULE;
  281. }
  282. }
  283. }
  284. else if (!_tcsicmp(targv[0], _T("-process")))
  285. {
  286. flagsMore |= TRACE_LOG_REPORT_MEMORY;
  287. pUserContext = (PVOID) & UserContextMM;
  288. UserContextMM.reportNow = REPORT_LIST_PROCESS;
  289. if ((argc > 1) && (targv[1][0] != '-' || targv[1][0] != '/'))
  290. {
  291. if (_tcsicmp(targv[1], _T("all")))
  292. {
  293. UserContextMM.strImgName =
  294. malloc(sizeof(TCHAR) * (_tcslen(targv[1]) + 1));
  295. if (UserContextMM.strImgName)
  296. {
  297. _tcscpy(UserContextMM.strImgName, targv[1]);
  298. }
  299. }
  300. argc --; targv ++;
  301. }
  302. }
  303. else if (!_tcsicmp(targv[0], _T("-module")))
  304. {
  305. flagsMore |= TRACE_LOG_REPORT_MEMORY;
  306. pUserContext = (PVOID) & UserContextMM;
  307. UserContextMM.reportNow = REPORT_LIST_MODULE;
  308. if ((argc > 1) && (targv[1][0] != '-' || targv[1][0] != '/'))
  309. {
  310. if (_tcsicmp(targv[1], _T("all")))
  311. {
  312. UserContextMM.strImgName =
  313. malloc(sizeof(TCHAR) * (_tcslen(targv[1]) + 1));
  314. if (UserContextMM.strImgName)
  315. {
  316. _tcscpy(UserContextMM.strImgName, targv[1]);
  317. }
  318. }
  319. argc --; targv ++;
  320. }
  321. }
  322. else if (!_tcsicmp(targv[0], _T("-sort")))
  323. {
  324. flagsMore |= TRACE_LOG_REPORT_MEMORY;
  325. pUserContext = (PVOID) & UserContextMM;
  326. if ((argc > 1) && (targv[1][0] != '-' || targv[1][0] != '/'))
  327. {
  328. if (!_tcsicmp(targv[1], _T("hpf")))
  329. {
  330. UserContextMM.sortNow = REPORT_SORT_HPF;
  331. }
  332. else if (!_tcsicmp(targv[1], _T("tf")))
  333. {
  334. UserContextMM.sortNow = REPORT_SORT_TF;
  335. }
  336. else if (!_tcsicmp(targv[1], _T("dzf")))
  337. {
  338. UserContextMM.sortNow = REPORT_SORT_DZF;
  339. }
  340. else if (!_tcsicmp(targv[1], _T("cow")))
  341. {
  342. UserContextMM.sortNow = REPORT_SORT_COW;
  343. }
  344. else
  345. {
  346. UserContextMM.sortNow = REPORT_SORT_ALL;
  347. }
  348. argc --; targv ++;
  349. }
  350. }
  351. else
  352. {
  353. goto Usage;
  354. }
  355. }
  356. else
  357. {
  358. LPTSTR pLogFile;
  359. pLogFile = malloc(sizeof(TCHAR) * MAXSTR);
  360. RtlZeroMemory((char *) pLogFile, sizeof(TCHAR) * MAXSTR);
  361. EvmFile[LogFileCount] = pLogFile;
  362. _tcscpy(EvmFile[LogFileCount ++], targv[0]);
  363. bTrace = TRUE;
  364. printf("LogFile %ws\n", (char *) EvmFile[LogFileCount - 1]);
  365. }
  366. }
  367. if (LogFileCount == 0)
  368. {
  369. goto Usage;
  370. }
  371. if (flagsMore == 0)
  372. {
  373. flagsMore |= TRACE_LOG_REPORT_BASIC;
  374. }
  375. if ( (flagsMore & TRACE_LOG_REPORT_MEMORY)
  376. && (flagsMore & TRACE_LOG_REPORT_FILE))
  377. {
  378. printf("Error: cannot generate HotFile report and PageFault report at the same time.\n");
  379. goto Cleanup;
  380. }
  381. if (bTrace)
  382. {
  383. ProcessTrace(LogFileCount, EvmFile, (ULONGLONG) 0, (ULONGLONG) 0,
  384. StartTime, EndTime, flagsMore, pUserContext, TraceLogFile);
  385. }
  386. for (i=0; i < LogFileCount; i++)
  387. {
  388. free((char*)EvmFile[i]);
  389. }
  390. if (UserContextMM.strImgName)
  391. {
  392. free(UserContextMM.strImgName);
  393. }
  394. Cleanup:
  395. #ifdef UNICODE
  396. GlobalFree(cmdargv);
  397. #endif
  398. return 0;
  399. Usage:
  400. ReducerUsage();
  401. goto Cleanup;
  402. }
  403. #if DBG
  404. VOID
  405. PrintHeader(
  406. FILE* f,
  407. TRACEINFOCLASS CurrentClass,
  408. TRACEINFOCLASS RootClass,
  409. BOOLEAN bDrillDown,
  410. LPCWSTR InstanceName
  411. )
  412. {
  413. if (bDrillDown) {
  414. fprintf(f, "-------------------------------------------\n");
  415. fprintf(f, "RootClass: %d Instance %ws\n", RootClass, InstanceName);
  416. fprintf(f, "-------------------------------------------\n");
  417. }
  418. switch(CurrentClass) {
  419. case TraceProcessInformation:
  420. fprintf(f, "Trace Process Information\n");
  421. fprintf(f, "------------------------\n");
  422. fprintf(f, "\nPID Name Image UCpu KCpu ReadIO WriteIO\n\n");
  423. break;
  424. case TraceDiskInformation:
  425. fprintf(f, "Trace Disk Information\n");
  426. fprintf(f, "----------------------\n");
  427. fprintf(f, "\nDiskId Name ReadIO WriteIO\n\n");
  428. break;
  429. case TraceThreadInformation:
  430. fprintf(f, "Trace Thread Information\n");
  431. fprintf(f, "------------------------\n");
  432. fprintf(f, "\nTID PID UCpu KCpu ReadIO WriteIO \n\n");
  433. break;
  434. case TraceFileInformation:
  435. fprintf(f, "Trace File Information\n");
  436. fprintf(f, "------------------------\n");
  437. fprintf(f, "\nFileName ReadIO WriteIO \n\n");
  438. break;
  439. }
  440. }
  441. VOID
  442. PrintProcessInfo(
  443. FILE* f,
  444. PTRACE_PROCESS_INFO pProcessInfo
  445. )
  446. {
  447. fprintf(f, "%4d %-10ws %-10ws %5d %5d %5d %5d\n",
  448. pProcessInfo->PID,
  449. pProcessInfo->UserName,
  450. pProcessInfo->ImageName,
  451. pProcessInfo->UserCPU,
  452. pProcessInfo->KernelCPU,
  453. pProcessInfo->ReadCount,
  454. pProcessInfo->WriteCount);
  455. }
  456. VOID
  457. PrintThreadInfo(
  458. FILE* f,
  459. PTRACE_THREAD_INFO pThreadInfo
  460. )
  461. {
  462. fprintf(f, "%4x \n", pThreadInfo->ThreadId);
  463. }
  464. VOID
  465. PrintDiskInfo(
  466. FILE* f,
  467. PTRACE_DISK_INFO pDiskInfo
  468. )
  469. {
  470. fprintf(f, "%d %-10ws %5d %5d \n",
  471. pDiskInfo->DiskNumber,
  472. pDiskInfo->DiskName,
  473. pDiskInfo->ReadCount,
  474. pDiskInfo->WriteCount);
  475. }
  476. VOID
  477. PrintFileInfo(
  478. FILE* f,
  479. PTRACE_FILE_INFO pFileInfo
  480. )
  481. {
  482. fprintf(f, "%ws %5d %5d\n",
  483. pFileInfo->FileName,
  484. pFileInfo->ReadCount,
  485. pFileInfo->WriteCount
  486. );
  487. }
  488. VOID
  489. TestETAApis(
  490. PTRACE_BASIC_INFO TraceBasicInfo
  491. )
  492. {
  493. ULONG Status;
  494. ULONG OutLength;
  495. PTRACE_PROCESS_INFO pProcessInfo;
  496. PTRACE_DISK_INFO pDiskInfo;
  497. PTRACE_FILE_INFO pFileInfo;
  498. PTRACE_THREAD_INFO pThreadInfo;
  499. char* LargeBuffer1;
  500. ULONG CurrentBufferSize;
  501. BOOLEAN Done, FinshPrinting, bDrillDown;
  502. TRACEINFOCLASS CurrentClass, RootClass;
  503. ULONG TotalOffset;
  504. FILE* f;
  505. int i = 0;
  506. LPWSTR InstanceName;
  507. WCHAR Name[MAXSTR+1];
  508. InstanceName = (LPWSTR)&Name;
  509. LargeBuffer1 = VirtualAlloc(NULL,
  510. MAX_BUFFER_SIZE,
  511. MEM_RESERVE,
  512. PAGE_READWRITE);
  513. if (LargeBuffer1 == NULL) {
  514. return;
  515. }
  516. CurrentBufferSize = 10*8192;
  517. if (VirtualAlloc(LargeBuffer1,
  518. 81920,
  519. MEM_COMMIT,
  520. PAGE_READWRITE) == NULL) {
  521. return;
  522. }
  523. f = _wfopen(L"TraceAPI.rpt", L"w");
  524. if (f == NULL) {
  525. VirtualFree(LargeBuffer1, 0, MEM_RELEASE);
  526. return;
  527. }
  528. CurrentClass = TraceProcessInformation;
  529. RootClass = TraceProcessInformation;
  530. Done = FALSE;
  531. bDrillDown = FALSE;
  532. while (!Done) {
  533. Retry1:
  534. if (!bDrillDown) {
  535. Status = TraceQueryAllInstances(
  536. CurrentClass,
  537. LargeBuffer1,
  538. CurrentBufferSize,
  539. &OutLength);
  540. }
  541. else {
  542. Status = TraceDrillDown(
  543. RootClass,
  544. InstanceName,
  545. CurrentClass,
  546. LargeBuffer1,
  547. CurrentBufferSize,
  548. &OutLength
  549. );
  550. }
  551. if (Status == ERROR_MORE_DATA) {
  552. CurrentBufferSize += OutLength;
  553. if (VirtualAlloc(LargeBuffer1,
  554. CurrentBufferSize,
  555. MEM_COMMIT,
  556. PAGE_READWRITE) == NULL) {
  557. return;
  558. }
  559. goto Retry1;
  560. }
  561. if (Status != ERROR_SUCCESS) {
  562. Done = TRUE;
  563. break;
  564. }
  565. //
  566. // Print Header
  567. //
  568. PrintHeader(f, CurrentClass, RootClass, bDrillDown, InstanceName);
  569. //
  570. // Walk the Process List and Print report.
  571. //
  572. TotalOffset = 0;
  573. pProcessInfo = (TRACE_PROCESS_INFO *) LargeBuffer1;
  574. pThreadInfo = (TRACE_THREAD_INFO *) LargeBuffer1;
  575. pFileInfo = (TRACE_FILE_INFO *) LargeBuffer1;
  576. pDiskInfo = (TRACE_DISK_INFO *) LargeBuffer1;
  577. FinshPrinting = FALSE;
  578. while (!FinshPrinting) {
  579. switch(CurrentClass) {
  580. case TraceProcessInformation:
  581. PrintProcessInfo(f, pProcessInfo);
  582. if (pProcessInfo->NextEntryOffset == 0) {
  583. FinshPrinting = TRUE;
  584. break;
  585. }
  586. TotalOffset += pProcessInfo->NextEntryOffset;
  587. pProcessInfo = (TRACE_PROCESS_INFO *)
  588. &LargeBuffer1[TotalOffset];
  589. break;
  590. case TraceDiskInformation:
  591. PrintDiskInfo(f, pDiskInfo);
  592. if (pDiskInfo->NextEntryOffset == 0) {
  593. FinshPrinting = TRUE;
  594. break;
  595. }
  596. TotalOffset += pDiskInfo->NextEntryOffset;
  597. pDiskInfo = (TRACE_DISK_INFO *)
  598. &LargeBuffer1[TotalOffset];
  599. default:
  600. FinshPrinting = TRUE;
  601. break;
  602. }
  603. if (TotalOffset == 0)
  604. break;
  605. }
  606. if (!bDrillDown) {
  607. switch(CurrentClass) {
  608. case TraceProcessInformation:
  609. CurrentClass = TraceDiskInformation;
  610. break;
  611. case TraceThreadInformation:
  612. CurrentClass = TraceDiskInformation;
  613. break;
  614. case TraceDiskInformation:
  615. RootClass = TraceProcessInformation;
  616. CurrentClass = TraceProcessInformation;
  617. bDrillDown = TRUE;
  618. break;
  619. case TraceFileInformation:
  620. Done = TRUE;
  621. break;
  622. default:
  623. Done = TRUE;
  624. break;
  625. }
  626. }
  627. if (bDrillDown) {
  628. switch(RootClass) {
  629. case TraceProcessInformation:
  630. wcscpy(InstanceName, L"\\\\NTDEV\\mraghu");
  631. if (CurrentClass == TraceProcessInformation) {
  632. CurrentClass = TraceFileInformation;
  633. }
  634. else if (CurrentClass == TraceFileInformation) {
  635. CurrentClass = TraceDiskInformation;
  636. }
  637. else {
  638. RootClass = TraceDiskInformation;
  639. CurrentClass = TraceProcessInformation;
  640. wcscpy (InstanceName, L"Disk1");
  641. }
  642. break;
  643. case TraceDiskInformation:
  644. if (CurrentClass == TraceProcessInformation) {
  645. CurrentClass = TraceFileInformation;
  646. wcscpy (InstanceName, L"Disk1");
  647. }
  648. else {
  649. Done = TRUE;
  650. }
  651. break;
  652. case TraceFileInformation:
  653. default:
  654. Done = TRUE;
  655. break;
  656. }
  657. }
  658. }
  659. fclose (f);
  660. VirtualFree(LargeBuffer1, 0, MEM_RELEASE);
  661. }
  662. #endif
  663. #ifdef __cplusplus
  664. }
  665. #endif