Perf Counter Settings

Perf Counter Settings

Controls featured in this example:

  • Sitecore Web Control

Classes featured in this example:

  • Sitecore.Configuration.Settings.Counters
  • Sitecore.Context
  • Sitecore.Data.Items.Item

Perf Counter Settings C# Web Control Code

Sitecore.Data.Items.Item item = Sitecore.Context.Item;
if (item == null) return;

output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Style, "font-weight:bold; width:100%; clear:both");
output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Div);
output.Write("C# Web Control Real-time Output");
output.RenderEndTag();

output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Style, "font-size:x-small; width:100%; clear:both");
output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Div);
output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Style, "font-weight:bold");
output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.P);
//using : for colon and ? for question mark and   for space
output.Write("{0}: {1}", "Item", item.DisplayName);
output.RenderEndTag(); //P

string countersEnabled = Sitecore.Configuration.Settings.Counters.Enabled.ToString();
string instanceName = Sitecore.Configuration.Settings.Counters.InstanceName;
string resetOnStartup = Sitecore.Configuration.Settings.Counters.ResetOnStartup.ToString();

//using : for colon and   for space
output.Write("{0}&#63;&#160;{1}", "Counters Enabled", "<b>" + countersEnabled + "</b><br/>");
output.Write("{0}&#58;&#160;{1}", "Instance Name", "<b>" + instanceName + "</b><br/>");
output.Write("{0}&#63;&#160;{1}", "Rese


Perf Counter Settings C# Web Control Output

Counters Enabled? False
Instance Name: TIC-DEV-TIC66
Reset On Startup? True