WEB开发网
开发学院操作系统Windows Vista 使用 ETW 改善调试和性能优化 阅读

使用 ETW 改善调试和性能优化

 2008-11-17 17:39:25 来源:WEB开发网   
核心提示: #include <myevents.h> // Header generated from manifest.// Contains MyProviderId and event descriptors.REGHANDLE MyProvRegHandle;ULONG MyIn

#include <myevents.h>  // Header generated from manifest.
            // Contains MyProviderId and event descriptors.
REGHANDLE MyProvRegHandle;
ULONG MyInteger;
PWCHAR MyString;
ULONG MyStringLength;
EVENT_DATA_DESCRIPTOR DataDescriptor[2];
...
// Register the ETW provider.
Status = EventRegister(&MyProviderId,   // ProviderId (GUID)
            NULL,        // Optional Callback
            NULL,        // OPtioanl Callback Context
            &MyProvRegHandle); // Registration Handle
...
// Construct DataDescriptor and write an event with
// MyInteger and MyString.
EventDataDescCreate(&DataDescriptor[0],  // DataDescriptor
          &MyInteger,      // Pointer to the data
          sizeof(ULONG));    // Size of data
EventDataDescCreate(&DataDescriptor[1], &MyString, MyStringLength);
Status = EventWrite(MyProvRegHandle,    // Registration Handle
          MyEventDescriptor1,  // EventDescriptor
          2,           // DataDescriptor array size
          DataDescriptor);    // DataDescriptor array
...
// Write another event with no user data.
if (EventEnabled(MyProvRegHandle, MyEventDescriptor2)) {
  // Do extra work if enabled and write event.
  ...
  Status = EventWrite(MyProvRegHandle, MyEventDescriptor2, 0, NULL);
}
...
// Unregister the ETW provider.
Status = EventUnregister(MyProvRegHandle); 

上一页  4 5 6 7 8 9 10  下一页

Tags:使用 ETW 改善

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接