Skip to content

Support TraceLogging formatting hints like TraceLoggingHexUInt32 #2436

Description

@chwarr

It would be nice if PerfView used the display formatting hints that the C++ TraceLogging library lets you write. For example, there are hints to indicate that an integer value should hex formatted on display or that the value is a HRESULT. See the TraceLogging Wrapper Macros docs for the full list.

TraceLoggingWrite(
    g_hMyProvider,
    "MyEvent",
    TraceLoggingUInt32(value1ToLog),
    TraceLoggingHexUInt32(value2ToLog));

In PerfView today, this would be rendered as

value1ToLog="1" value2ToLog="32,769"

If the hints were used, this could be rendered like this:

value1ToLog="1" value2ToLog="0x8001"

For things like flags this can be easier to read at a glance. There are also common values that are represented in hex, like PCI IDs.

As best I can tell, this metadata gets attached to the each event via the EVENT_DATA_DESCRIPTOR struct with a Type of EVENT_DATA_DESCRIPTOR_TYPE_EVENT_METADATA.

In the copy of TraceLoggingProvider.h in the 10.0.26100.0 Windows SDK (\Include\10.0.26100.0\shared\TraceLoggingProvider.h), it looks like there's a description of how this metadata is serialized starting at line 2421 (a comment that starts with "This comment defines the TraceLogging encoding format.")

WPA is able to make use of these hints already. Perhaps there's already parsing code in https://github.com/microsoft/microsoft-performance-toolkit-sdk or a similar code base that could be re-used.

Metadata

Metadata

Assignees

No one assigned
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions