Пример #1
0
        private void context_BeginRequestExecute(object sender, EventArgs e)
        {
            if (PageMonitorSettings.GetConfig().Enabled)
            {
                PageMonitorElement pme = PageMonitorSettings.GetConfig().Pages.GetMatchedElement();

                if (pme != null)
                {
                    MonitorData md = PerformanceMonitorHelper.StartMonitor(PageMonitorModule.MonitorDataKey);

                    md.EnableLogging   = pme.EnableLogging;
                    md.EnablePFCounter = pme.EnablePFCounter;
                    md.MonitorName     = pme.Name;

                    if (string.IsNullOrEmpty(pme.CounterInstanceName))
                    {
                        md.InstanceName = pme.Name;
                    }
                    else
                    {
                        md.InstanceName = pme.CounterInstanceName;
                    }

                    PerformanceMonitorHelper.DefaultMonitorName = PageMonitorModule.MonitorDataKey;

                    if (pme.EnableLogging)
                    {
                        md.LogWriter.WriteLine("请求{0}的开始时间: {1:yyyy-MM-dd HH:mm:ss.fff}", md.MonitorName, SNTPClient.AdjustedTime);
                    }
                }
            }
        }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public static PageMonitorSettings GetConfig()
        {
            PageMonitorSettings config = (PageMonitorSettings)ConfigurationBroker.GetSection("pageMonitorSettings");

            if (config == null)
            {
                config = new PageMonitorSettings();
            }

            return(config);
        }