public void SqlConnectionTestOperation1() { using (_perfLabs.Step(Profiler.MVCMiniProfiler, "SqlConnectionTestOperation1")) { Thread.Sleep(Constants.bigTime);//simulate some work before db operation dynamic cnn = PerfLabsProfiledADOWrapper.PerfLabsDbConnection(new SqlConnection(Constants.demoDBConnectionString)); cnn.Open(); var cmd = cnn.CreateCommand(); cmd.CommandText = Constants.bigQuery; cmd.ExecuteNonQuery(); Thread.Sleep(Constants.bigTime);//simulate some work after db operation cnn.Close(); } }
public void CSharpTestOperation1() { using (_perfLabs.Step(Profiler.PerfLabsStopWatch, "CSharpTestOperation1")) { Thread.Sleep(Constants.smallTime);//simulate doing work } }
public static void ProfileMultipleTimes(String operationName, Action operation, Int32 numOfInvocations, Profiler profilingMethod) { for (Int32 i = 0; i < numOfInvocations; i++) { perfLabs.StartProfilers(); using (perfLabs.Step(profilingMethod, operationName)) { operation.Invoke(); } if (profilingMethod == Profiler.MVCMiniProfiler) { perfLabs.SaveToDataBase(); } perfLabs.StopProfilers(); } perfLabs.StartProfilers(); }