// The app name should either be a valid app name or be 'null' to get the state service
        // counters initialized
        private static void OpenCounter(string appName) {
            try {
                // Don't activate perf counters if webengine.dll isn't loaded
                if (! HttpRuntime.IsEngineLoaded) 
                    return;

                // Open the global counters
                if (_global == IntPtr.Zero) {
                    _global = UnsafeNativeMethods.PerfOpenGlobalCounters();
                }

                // If appName is null, then we want the state counters
                if (appName == null) {
                    if (_stateService == IntPtr.Zero) {
                        _stateService = UnsafeNativeMethods.PerfOpenStateCounters();
                    }
                }
                else {
                    if (appName != null) {
                        _instance = UnsafeNativeMethods.PerfOpenAppCounters(appName);
                    }
                }
            }
            catch (Exception e) {
                Debug.Trace("Perfcounters", "Exception: " + e.StackTrace);
            }
        }
Пример #2
0
 private static void OpenCounter(string appName)
 {
     try
     {
         if (HttpRuntime.IsEngineLoaded)
         {
             if (_global == IntPtr.Zero)
             {
                 _global = UnsafeNativeMethods.PerfOpenGlobalCounters();
             }
             if (appName == null)
             {
                 if (_stateService == IntPtr.Zero)
                 {
                     _stateService = UnsafeNativeMethods.PerfOpenStateCounters();
                 }
             }
             else if (appName != null)
             {
                 _instance = UnsafeNativeMethods.PerfOpenAppCounters(appName);
             }
         }
     }
     catch (Exception)
     {
     }
 }
Пример #3
0
        // The app name should either be a valid app name or be 'null' to get the state service
        // counters initialized
        private static void OpenCounter(string appName)
        {
            try {
                // Don't activate perf counters if webengine.dll isn't loaded
                if (!HttpRuntime.IsEngineLoaded)
                {
                    return;
                }

                // Open the global counters
                if (_global == IntPtr.Zero)
                {
                    _global = UnsafeNativeMethods.PerfOpenGlobalCounters();
                }

                // If appName is null, then we want the state counters
                if (appName == null)
                {
                    if (_stateService == IntPtr.Zero)
                    {
                        _stateService = UnsafeNativeMethods.PerfOpenStateCounters();
                    }
                }
                else
                {
                    if (appName != null)
                    {
                        _instance = UnsafeNativeMethods.PerfOpenAppCounters(appName);
                    }
                }
            }
            catch (Exception e) {
                Debug.Trace("Perfcounters", "Exception: " + e.StackTrace);
            }
        }
 private static void OpenCounter(string appName)
 {
     try
     {
         if (HttpRuntime.IsEngineLoaded)
         {
             if (_global == IntPtr.Zero)
             {
                 _global = UnsafeNativeMethods.PerfOpenGlobalCounters();
             }
             if (appName == null)
             {
                 if (_stateService == IntPtr.Zero)
                 {
                     _stateService = UnsafeNativeMethods.PerfOpenStateCounters();
                 }
             }
             else if (appName != null)
             {
                 _instance = UnsafeNativeMethods.PerfOpenAppCounters(appName);
             }
         }
     }
     catch (Exception)
     {
     }
 }