Esempio n. 1
0
        static void ProfileSnippetMarker(object preExecutePayload, ProfilingSnippet snippet, ProfilingSnippetOptions options, bool deepProfile)
        {
            var markerName = snippet.GetValidMarkerName();
            var action     = ProfilingSnippetUtils.GetMarkerEnclosedSnippetAction(preExecutePayload, snippet, options);

            ProfilerHelpers.RecordWithMarkerFilter(markerName, action, true, deepProfile, options.count);
        }
Esempio n. 2
0
        static void BenchmarMarker(object preExecutePayload, ProfilingSnippet snippet, ProfilingSnippetOptions options)
        {
            var markerName = snippet.GetValidMarkerName();
            var action     = ProfilingSnippetUtils.GetMarkerEnclosedSnippetAction(preExecutePayload, snippet, options);
            var result     = ProfilerHelpers.BenchmarkMarker(markerName, action, options.count);

            LogBenchmark($"Benchmark marker {markerName}", result, options);
        }
        public static Action GetMarkerEnclosedSnippetAction(object preExecutePayload, ProfilingSnippet snippet, ProfilingSnippetOptions options)
        {
            var snippetAction = snippet.GetSnippetAction(preExecutePayload, options);

            if (!snippet.isValidMarker)
            {
                // Generate marker:
                var markerName = snippet.GetValidMarkerName();
                return(() =>
                {
                    using (new PerformanceTracker(markerName))
                    {
                        snippetAction();
                    }
                });
            }

            return(snippetAction);
        }