Scroll

Server Event: Track report execution time

The amount of time it takes to execute reports can be tracked by using server events in combination with a stored value.

Note. For large-scale tracking, it is recommended to set up Monitoring instead.

This event uses two server events: The first sets a timer when report execution starts, and the second stops the timer when execution ends, then logs the value.

Execution Start

Global Event: OnReportExecuteStart

Code

DateTime startTimeNow = DateTime.Now;

sessionInfo.SetStoredValue("startTime", startTimeNow);

return null; // continue execution

Execution End

Global Event: OnReportExecuteEnd

Code

DateTime endTimeNow = DateTime.Now;

string totalTime = endTimeNow.Subtract((DateTime)(sessionInfo.GetStoredValue("startTime"))).TotalMinutes.ToString();

string reportName = sessionInfo.Report.Name;

StreamWriter executionLog = new StreamWriter(@"C:\Exago\ExecutionLog.txt", true);

executionLog.WriteLine("Report Name: " + reportName + "\n" + "Total Time to completion:" + totalTime + " minutes");

executionLog.Close();

return null;

Hidden Article Information

Article Author
Exago Development
created 2017-05-22 21:30:51 UTC
updated 2017-06-19 16:46:15 UTC

Labels
track report execution, SAE, server event, events, example, time, timer,
Have more questions? Submit a request