/// <summary>
        /// Stops the profiling session.
        /// </summary>
        /// <param name="buildAggregatedCallTree">true if the aggregated call is to be built.</param>
        public void Stop(bool buildAggregatedCallTree = true)
        {
            if (etwEventDynamicProcessor != null)
            {
                etwEventDynamicProcessor.Dispose();
                etwEventDynamicProcessor = null;
            }

            eventAggregator.FinishAggregation(buildAggregatedCallTree);
        }