IAnalyzer class
The C++ Build Insights SDK is compatible with Visual Studio 2017 and later. To see the documentation for these versions, set the Visual Studio Version selector control for this article to Visual Studio 2017 or later. It's found at the top of the table of contents on this page.
The IAnalyzer
class provides an interface for analyzing an Event Tracing for Windows (ETW) trace. It's used with the MakeDynamicAnalyzerGroup, MakeDynamicReloggerGroup, MakeStaticAnalyzerGroup, and MakeStaticReloggerGroup functions. Use IAnalyzer
as a base class to create your own analyzer that can be part of an analyzer or relogger group.
Syntax
class IAnalyzer : public IRelogger
{
public:
virtual AnalysisControl OnStartActivity(const EventStack& eventStack);
virtual AnalysisControl OnStopActivity(const EventStack& eventStack)
virtual AnalysisControl OnSimpleEvent(const EventStack& eventStack);
virtual AnalysisControl OnBeginAnalysis();
virtual AnalysisControl OnEndAnalysis();
virtual AnalysisControl OnBeginAnalysisPass();
virtual AnalysisControl OnEndAnalysisPass();
AnalysisControl OnStartActivity(const EventStack& eventStack,
const void* relogSession) final;
AnalysisControl OnStopActivity(const EventStack& eventStack,
const void* relogSession) final;
AnalysisControl OnSimpleEvent(const EventStack& eventStack,
const void* relogSession) final;
AnalysisControl OnBeginRelogging() final;
AnalysisControl OnEndRelogging() final;
AnalysisControl OnBeginReloggingPass() final;
AnalysisControl OnEndReloggingPass() final;
virtual ~IAnalyzer();
};
Remarks
Classes that derive from IAnalyzer
can be used as both analyzers and reloggers. When used as reloggers, the relogger-specific functions redirect to their analyzer equivalent. The reverse isn't true: a class that derives from IRelogger
can't be used as an analyzer. Using an analyzer in a relogger group is a common pattern. When placed in an early position of a relogger group, an analyzer can pre-compute information and make it available for reloggers in later positions.
The default return value for all functions that aren't overridden is AnalysisControl::CONTINUE
. For more information, see AnalysisControl.
Members
In addition to the OnTraceInfo member from the IRelogger
interface, the IAnalyzer
class contains the following members:
Destructor
Functions
OnBeginAnalysis
OnBeginAnalysisPass
OnBeginRelogging
OnBeginReloggingPass
OnEndAnalysis
OnEndAnalysisPass
OnEndRelogging
OnEndReloggingPass
OnSimpleEvent
OnStartActivity
OnStopActivity
~IAnalyzer
Destroys the IAnalyzer class.
virtual ~IAnalyzer();
OnBeginAnalysis
For analyzers part of an analyzer group, this function is called before the first analysis pass begins. For analyzers part of a relogger group, this function is called before the relogging pass begins. For analyzers part of both the analyzer and relogger group of the same relogging session, this function is called twice before the first analysis pass begins.
virtual AnalysisControl OnBeginAnalysis();
Return Value
An AnalysisControl code that describes what should happen next.
OnBeginAnalysisPass
For analyzers part of an analyzer group, this function is called at the beginning of every analysis pass. For analyzers part of a relogger group, this function is called at the beginning of the relogger pass. For analyzers part of both the analyzer and relogger group of the same relogging session, this function is called at the beginning of every analysis pass, and at the beginning of the relogger pass.
virtual AnalysisControl OnBeginAnalysisPass();
Return Value
An AnalysisControl code that describes what should happen next.
OnBeginRelogging
AnalysisControl OnBeginRelogging() final;
This function can't be overridden. It's called by the C++ Build Insights SDK when an analyzer is part of a relogger group. This function redirects the call to OnBeginAnalysis.
Return Value
The result of the OnBeginAnalysis call.
OnBeginReloggingPass
This function can't be overridden. It's called by the C++ Build Insights SDK when an analyzer is part of a relogger group. This function redirects the call to OnBeginAnalysisPass.
AnalysisControl OnBeginReloggingPass() final;
Return Value
The result of the OnBeginAnalysisPass call.
OnEndAnalysis
For analyzers that are part of an analyzer group, this function is called after the last analysis pass has ended. For analyzers that are part of a relogger group, this function is called after the relogging pass has ended. For analyzers that are part of both the analyzer and relogger group of the same relogging session, this function is called twice:
- after all analysis passes have ended and before the relogging pass begins, and
- after the relogging pass has ended.
virtual AnalysisControl OnEndAnalysis();
Return Value
An AnalysisControl code that describes what should happen next.
OnEndAnalysisPass
For analyzers part of an analyzer group, this function is called at the end of every analysis pass. For analyzers part of a relogger group, this function is called at the end of the relogger pass. For analyzers part of both the analyzer and relogger group of the same relogging session, this function is called at the end of every analysis pass, and at the end of the relogger pass.
virtual AnalysisControl OnEndAnalysisPass();
Return Value
An AnalysisControl code that describes what should happen next.
OnEndRelogging
This function can't be overridden. It's called by the C++ Build Insights SDK when an analyzer is part of a relogger group. This function redirects the call to OnEndAnalysis.
AnalysisControl OnEndRelogging() final;
Return Value
The result of the OnEndAnalysis call.
OnEndReloggingPass
This function can't be overridden. It's called by the C++ Build Insights SDK when an analyzer is part of a relogger group. This function redirects the call to OnEndAnalysisPass.
AnalysisControl OnEndReloggingPass() final;
Return Value
The result of the OnEndAnalysisPass call.
OnSimpleEvent
This function is called when a simple event is being processed. The second version of this function can't be overridden. It's called by the C++ Build Insights SDK when an analyzer is part of a relogger group. All calls to version 2 are redirected to version 1.
Version 1
virtual AnalysisControl OnSimpleEvent(const EventStack& eventStack);
Version 2
AnalysisControl OnSimpleEvent(const EventStack& eventStack,
const void* relogSession) final;
Parameters
eventStack
The event stack for this simple event. For more information on event stacks, see Events.
relogSession
This parameter is unused.
Return Value
An AnalysisControl code that describes what should happen next.
OnStartActivity
This function is called when an activity start event is being processed. The second version of this function can't be overridden. It's called by the C++ Build Insights SDK when an analyzer is part of a relogger group. All calls to version 2 are redirected to version 1.
Version 1
virtual AnalysisControl OnStartActivity(const EventStack& eventStack);
Version 2
AnalysisControl OnStartActivity(const EventStack& eventStack,
const void* relogSession) final;
Parameters
eventStack
The event stack for this activity start event. For more information on event stacks, see Events.
relogSession
This parameter is unused.
Return Value
An AnalysisControl code that describes what should happen next.
OnStopActivity
This function is called when an activity stop event is being processed. The second version of this function can't be overridden. It's called by the C++ Build Insights SDK when an analyzer is part of a relogger group. All calls to version 2 are redirected to version 1.
Version 1
virtual AnalysisControl OnStopActivity(const EventStack& eventStack);
Version 2
AnalysisControl OnStopActivity(const EventStack& eventStack,
const void* relogSession) final;
Parameters
eventStack
The event stack for this activity stop event. For more information on event stacks, see Events.
relogSession
This parameter is unused.
Return Value
An AnalysisControl code that describes what should happen next.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for