Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
Many kinds of trace data have built-in support in TraceProcessor, but if you have your other providers that you would like to analyze (including your own custom providers), that data is also available from the trace live while processing occurs.
Note
This part of the API is in preview and under active development. It may change in future releases.
For example, here is a simple way to get the list of providers IDs in a trace.
// Open a trace with TraceProcessor.Create() and call Run...
static void Run(ITraceProcessor trace)
{
HashSet<Guid> providerIds = new HashSet<Guid>();
trace.Use((e) => providerIds.Add(e.ProviderId));
trace.Process();
foreach (Guid providerId in providerIds)
{
Console.WriteLine(providerId);
}
}
The following example shows a simplified custom data source.
// Open a trace with TraceProcessor.Create() and call Run...
static void Run(ITraceProcessor trace)
{
CustomDataSource customDataSource = new CustomDataSource();
trace.Use(customDataSource);
trace.Process();
Console.WriteLine(customDataSource.Count);
}
class CustomDataSource : IFilteredEventConsumer
{
public IReadOnlyList<Guid> ProviderIds { get; } = new Guid[] { new Guid("your provider ID") };
public int Count { get; private set; }
public void Process(EventContext eventContext)
{
++Count;
}
}
Next steps
In this tutorial, you learned how to extend TraceProcessor.
The next step is to learn how to load symbols for traces.
Windows developer