Retrieving the Performance Statistics Report

  • Updated

Prerequisites: A valid RuleSession
Namespaces: InRule.Runtime
Classes:   FileSystemRuleApplicationReference, RuleSession, Entity, RuleException
See Also: Basic Example Of Calling Rules Engine, Retrieve the Performance Log
References: InRule.Runtime.dll, InRule.Common.dll

The following basic example demonstrates how to capture the Performance Statistics Report at run time.

// Turn on capturing of detailed statistics (if desired)
ruleSession.Settings.LogOptions = EngineLogOptions.DetailStatistics;

// Run rules
ruleSession.ApplyRules();

// Get the XML as a string for the Performance Statistics Report (includes log messages if log options configured to include them)
string reportXml = ruleSession.LastRuleExecutionLog.GetXml();

// Get the HTML as a string for the Performance Statistics Report
string reportHtml = ruleSession.LastRuleExecutionLog.GetHtml();

// write the report to the file system (could also view in a web browser control)
File.WriteAllText(@"c:\work\PerfStatsReport.html", reportHtml);

Was this article helpful?

0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.