/// <summary> /// Provides an automated wrapper for timing an operation and logging a message to a given PerformanceLog /// </summary> /// <param name="message">The message to log.</param> /// <param name="log">The <typeparamref name="PerformanceLog"/> the message should be written to.</param> /// <param name="code">The code to be invoked and timed.</param> /// <returns><typeparamref name="PerformanceLog"/> which is the same <typeparamref name="PerformanceLog"/> passed into the method.</returns> public PerformanceLog LogScope(String message, PerformanceLog log, CodeBlock code) { lock (obj) { this.SetMarker(); code.Invoke(); this.ReleaseMarker(); log.LogData(message, this.Duration); } return log; }
public OperationProgressChangedEventArgs(int progressPercentage, object userState, long totalTasksCompleted, long totalTasksToComplete) : base(progressPercentage, userState) { m_totalTasksCompleted = totalTasksCompleted; m_totalTasksToComplete = totalTasksToComplete; PerformanceLog = (PerformanceLog)userState; }
public void Add(PerformanceLog log) { Log.Add(log); }
private void PostProgressChanged(AsyncOperation asyncOp, PerformanceLog perfLog) { long percentageComplete = (m_progress.TotalTasksCompleted / m_progress.TotalTasksToComplete) * 100; asyncOp.Post(reportOperationProgressChanged, new OperationProgressChangedEventArgs((int)percentageComplete, perfLog, m_progress.TotalTasksCompleted, m_progress.TotalTasksToComplete)); }