public void Process(CperfParser parser, Func <string> readFunc)
        {
#if DEBUG
            threadsNotFound.Clear();
#endif
            parser.ModuleLoadFinishedCallback   += ModuleLoadFinishedCallback;
            parser.FunctionInfoCallback         += FunctionInfoCallback;
            parser.ThreadCreatedCallback        += ThreadCreatedCallback;
            parser.StackSampleReadCallback      += StackSampleReadCallback;
            parser.AllocationSampleReadCallback += AllocationSampleReadCallback;
            parser.LineReadCallback             += LineReadCallback;

            parser.Parse(readFunc);

            parser.ModuleLoadFinishedCallback   -= ModuleLoadFinishedCallback;
            parser.FunctionInfoCallback         -= FunctionInfoCallback;
            parser.ThreadCreatedCallback        -= ThreadCreatedCallback;
            parser.StackSampleReadCallback      -= StackSampleReadCallback;
            parser.AllocationSampleReadCallback -= AllocationSampleReadCallback;
            parser.LineReadCallback             -= LineReadCallback;
        }
        /// <summary>
        /// Load the data from the memory profiling session file set in the constructor.
        /// </summary>
        /// <param name="progressMonitor">Used to report the profiling session file load progress.</param>
        /// <param name="profilerStartTime">
        /// The profiler start time (according to a clock of a target Tizen system) is returned in this output parameter.
        /// </param>
        public void Load(ProgressMonitor progressMonitor, out DateTime profilerStartTime)
        {
            var parser = new CperfParser();

            Action <string> lineReadCallback = (s => progressMonitor.Tick());

            DateTime          startTimeFromParser = DateTime.MinValue;
            Action <DateTime> startTimeCallback   = (DateTime startTime) =>
            {
                startTimeFromParser = startTime;
            };

            parser.LineReadCallback  += lineReadCallback;
            parser.StartTimeCallback += startTimeCallback;
            parser.GarbageCollectorSampleCallback           += GarbageCollectorSampleCallback;
            parser.GarbageCollectorGenerationSampleCallback += GarbageCollectorGenerationsSampleCallback;
            parser.ManagedMemorySampleCallback  += ManagedMemorySampleCallback;
            parser.ClassNameReadCallback        += ClassNameReadCallback;
            parser.AllocationSampleReadCallback += AllocationSampleReadCallback;

            parser.Parse(_filePath);

            profilerStartTime = startTimeFromParser;

            parser.LineReadCallback  -= lineReadCallback;
            parser.StartTimeCallback -= startTimeCallback;
            parser.GarbageCollectorSampleCallback           -= GarbageCollectorSampleCallback;
            parser.GarbageCollectorGenerationSampleCallback -= GarbageCollectorGenerationsSampleCallback;
            parser.ManagedMemorySampleCallback  -= ManagedMemorySampleCallback;
            parser.ClassNameReadCallback        -= ClassNameReadCallback;
            parser.AllocationSampleReadCallback -= AllocationSampleReadCallback;

            ProcessDataTypeAllocationSamples();

            _tempDataTypeAllocations.Clear();
        }
Пример #3
0
        /// <summary>
        /// Load the data from the profiling session file set in the constructor.
        /// </summary>
        /// <param name="progressMonitor">Used to report the profiling session file load progress.</param>
        /// <param name="sysInfoStartTime">
        /// The system information start time (used to correct the times of profiling events)
        /// </param>
        /// <param name="profilerStartTime">
        /// The profiler start time (according to a clock of a target Tizen system) is returned in this output parameter.
        /// </param>
        public void Load(ProgressMonitor progressMonitor, DateTime sysInfoStartTime, out DateTime profilerStartTime)
        {
            _globalTimeMilliseconds           = 0;
            _profilingEventsDeltaMilliseconds = 0;

            var parser = new CperfParser();

            Action <string> lineReadCallback = (s => progressMonitor.Tick());

            DateTime          startTimeFromParser = DateTime.MinValue;
            Action <DateTime> startTimeCallback   = (DateTime startTime) =>
            {
                startTimeFromParser = startTime;
                if ((startTime.Kind == DateTimeKind.Utc) && (sysInfoStartTime != DateTime.MinValue) && (startTime > sysInfoStartTime))
                {
                    _profilingEventsDeltaMilliseconds = (ulong)Math.Round((startTime - sysInfoStartTime).TotalMilliseconds);
                }
            };

            parser.LineReadCallback  += lineReadCallback;
            parser.StartTimeCallback += startTimeCallback;
            parser.ApplicationDomainCreationFinishedCallback += ApplicationDomainCreationFinishedCallback;
            parser.AssemblyLoadFinishedCallback            += AssemblyLoadFinishedCallback;
            parser.ModuleAttachedToAssemblyCallback        += ModuleAttachedToAssemblyCallback;
            parser.ModuleLoadFinishedCallback              += ModuleLoadFinishedCallback;
            parser.ClassLoadFinishedCallback               += ClassLoadFinishedCallback;
            parser.ClassNameReadCallback                   += ClassNameReadCallback;
            parser.FunctionNameReadCallback                += FunctionNameReadCallback;
            parser.FunctionInfoCallback                    += FunctionInfoCallback;
            parser.JitCompilationStartedCallback           += JitCompilationStartedCallback;
            parser.JitCompilationFinishedCallback          += JitCompilationFinishedCallback;
            parser.JitCachedFunctionSearchStartedCallback  += JitCachedFunctionSearchStartedCallback;
            parser.JitCachedFunctionSearchFinishedCallback += JitCachedFunctionSearchFinishedCallback;
            parser.GarbageCollectionStartedCallback        += GarbageCollectionStartedCallback;
            parser.GarbageCollectionFinishedCallback       += GarbageCollectionFinishedCallback;
            parser.SourceLineReadCallback                  += SourceLineReadCallback;
            parser.SourceFileReadCallback                  += SourceFileReadCallback;
            parser.CpuReadCallback                  += CpuReadCallback;
            parser.ProfilerTpsReadCallback          += ProfilerTpsReadCallback;
            parser.ProfilerTrsReadCallback          += ProfilerTrsReadCallback;
            parser.ThreadAssignedToOsThreadCallback += ThreadAssignedToOsThreadCallback;
            parser.ThreadTimesReadCallback          += ThreadTimesReadCallback;
            parser.ThreadCreatedCallback            += ThreadCreatedCallback;
            parser.ThreadDestroyedCallback          += ThreadDestroyedCallback;
            parser.StackSampleReadCallback          += StackSampleReadCallback;
            parser.AllocationSampleReadCallback     += AllocationSampleReadCallback;

            parser.Parse(_filePath);

            profilerStartTime = startTimeFromParser;

            parser.LineReadCallback  -= lineReadCallback;
            parser.StartTimeCallback -= startTimeCallback;
            parser.ApplicationDomainCreationFinishedCallback -= ApplicationDomainCreationFinishedCallback;
            parser.AssemblyLoadFinishedCallback            -= AssemblyLoadFinishedCallback;
            parser.ModuleAttachedToAssemblyCallback        -= ModuleAttachedToAssemblyCallback;
            parser.ModuleLoadFinishedCallback              -= ModuleLoadFinishedCallback;
            parser.ClassLoadFinishedCallback               -= ClassLoadFinishedCallback;
            parser.ClassNameReadCallback                   -= ClassNameReadCallback;
            parser.FunctionNameReadCallback                -= FunctionNameReadCallback;
            parser.FunctionInfoCallback                    -= FunctionInfoCallback;
            parser.JitCompilationStartedCallback           -= JitCompilationStartedCallback;
            parser.JitCompilationFinishedCallback          -= JitCompilationFinishedCallback;
            parser.JitCachedFunctionSearchStartedCallback  -= JitCachedFunctionSearchStartedCallback;
            parser.JitCachedFunctionSearchFinishedCallback -= JitCachedFunctionSearchFinishedCallback;
            parser.GarbageCollectionStartedCallback        -= GarbageCollectionStartedCallback;
            parser.GarbageCollectionFinishedCallback       -= GarbageCollectionFinishedCallback;
            parser.SourceLineReadCallback                  -= SourceLineReadCallback;
            parser.SourceFileReadCallback                  -= SourceFileReadCallback;
            parser.CpuReadCallback                  -= CpuReadCallback;
            parser.ProfilerTpsReadCallback          -= ProfilerTpsReadCallback;
            parser.ProfilerTrsReadCallback          -= ProfilerTrsReadCallback;
            parser.ThreadAssignedToOsThreadCallback -= ThreadAssignedToOsThreadCallback;
            parser.ThreadTimesReadCallback          -= ThreadTimesReadCallback;
            parser.ThreadCreatedCallback            -= ThreadCreatedCallback;
            parser.ThreadDestroyedCallback          -= ThreadDestroyedCallback;
            parser.StackSampleReadCallback          -= StackSampleReadCallback;
            parser.AllocationSampleReadCallback     -= AllocationSampleReadCallback;
        }