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.

81 lines
3.1 KiB

  1. Sample batch files for generating and viewing wmi event tracing logs
  2. For information on WMI event tracing, goto http://coreos/tech/tracing/
  3. dolog.cmd Enables a real-time log called "mylog" for the guids in
  4. wlbs.ctl
  5. dofmt.cmd Monitors the above log in real time
  6. wlbs.ctl Lists the provider guids to log
  7. Note: the underlying utilities, tracelog.exe and tracefmt.exe, and tracepdb.exe
  8. are available
  9. under the idw directory (eg \\winbuilds\release\main\usa\latest.idw\x86fre\bin\idw).
  10. The sources for these utilities are under nt\sdktools\trace
  11. You need to copy trace*.*, which includes a supporting dll.
  12. I've created two trace GUIDs, one for regular (for configuration related info
  13. and errors) and one for packets (for packets, including heartbeats).
  14. We can add/modify this list as required, but I think this should suffice.
  15. I've defined macros TRACE_CRIT (for critical, including most errors),
  16. TRACE_INFO, TRACE_VERB and TRACE_ALL (max verbosity), as well as TRACE_HB
  17. (for heartbeat) and TRACE_TCPCTRL (for tcp control packets).
  18. The Guids are defined in \net\inc\wlbsparm.h. The macros are defined
  19. in the tracewpp.ini file under each component directory.
  20. I've added one or two trace statements to each instrumented component
  21. you can now add more trace statements we should trace all key entry points,
  22. errors, etc. I've deliberately not mapped existing debugprintfs to trace
  23. statements as I want these trace statements to be enabled in retail builds
  24. so we should take the time to decide what we want to trace.
  25. Real output by console app tracefmt.exe:
  26. [0]0000.0000::04/02/2001-06:17:21.537 [driver]Recv HB from host 0
  27. << this is a trace of an actual heart beat message from the specified
  28. << host. I'll add more info to this msg later.
  29. [0]0000.0000::04/02/2001-06:17:22.537 [driver]Recv HB from host 0
  30. [0]0670.06C4::04/02/2001-06:17:22.944 [api]->WlbsInit(product=<null>,version=51,reserved=00000000)
  31. [0]0670.06C4::04/02/2001-06:17:23.131 [api]<-WlbsInit returns 1010
  32. [0]0000.0000::04/02/2001-06:17:23.537 [driver]Recv HB from host 0
  33. [0]0000.0000::04/02/2001-06:17:24.537 [driver]Recv HB from host 0
  34. The above output has nicely merged the output from the driver and a user-mode
  35. dll [api].
  36. The wmi event tracing support added by means of the WPP macros are some
  37. of the most bizarre and brilliant use of pre-processing I've ever seen!
  38. You can see the final result for each source file by defining adding
  39. USER_C_FLAGS=$(USER_C_FLAGS) -P to your sources file, resulting the
  40. preprocessed files being created with an .i extension. It's amazing to see how
  41. multiple trace flags spanning multiple GUIDs are handled.
  42. NOTE: For tracing to nlb stuff in NETCFGX.DLL you need to specially build
  43. NETCFGX.DLL
  44. Do the following
  45. cd net\config\netcfg\dll
  46. sd edit sources
  47. add the following line to the end of the sources file:
  48. RUN_WPP= -dll
  49. build netcfgx.dll
  50. There's been problems with tracefmt recognizing the auto-generated tmf files.
  51. Until that's resolved, use tracepdb to generate these files from the
  52. pdb files.