コード例 #1
0
        internal /*public*/ static void Open(String AppName)
        {
            try {
                // Don't activate perf counters is ISAPI isn't loaded
                if (!HttpRuntime.IsIsapiLoaded)
                {
                    return;
                }

                // If perf counters has been initialized once already, return
                if ((!_goingAway) && (_numCalls >= 0))
                {
                    return;
                }

                _global = UnsafeNativeMethods.PerfOpenGlobalCounters();

                if (AppName != null)
                {
                    _instance = UnsafeNativeMethods.PerfOpenAppCounters(AppName);
                }

                // Set this guy to zero so that we allow access to the interlocked methods
                _numCalls = 0;
            }
            catch (Exception e) {
                Debug.Trace("Perfcounters", "Exception: " + e.StackTrace);
            }
        }
コード例 #2
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);
            }
        }
コード例 #3
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)
     {
     }
 }