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); }
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); }