//public static void Main() //{ // ArrayList samplesList = new ArrayList(); // SetupCategory(); // CreateCounters(); // CollectSamples(samplesList); //} private static bool SetupCategory() { if (!PerformanceCounterCategory.Exists("ElapsedTimeSampleCategory")) { CounterCreationDataCollection CCDC = new CounterCreationDataCollection(); // Add the counter. CounterCreationData ETimeData = new CounterCreationData(); ETimeData.CounterType = PerformanceCounterType.ElapsedTime; ETimeData.CounterName = "ElapsedTimeSample"; CCDC.Add(ETimeData); // Create the category. PerformanceCounterCategory.Create("ElapsedTimeSampleCategory", "Demonstrates usage of the ElapsedTime performance counter type.", CCDC); return (true); } else { Console.WriteLine("Category exists - ElapsedTimeSampleCategory"); return (false); } }
static void Main(string[] args) { if (args.Length <= 1) { System.Console.WriteLine("Please enter CounterGroup and Counters"); System.Console.WriteLine("Usage: executable <CounterGroup> <Counter1> <CounterN>"); return; } if (args.Length == 2) { if (args[0].Equals("delete")) { if (PerformanceCounterCategory.Exists(args[1])) { PerformanceCounterCategory.Delete(args[1]); Console.Out.WriteLine("Deleting perfGroup: " + args[1]); } return; } } CounterCreationDataCollection col = new CounterCreationDataCollection(); String metrics_name = args[0]; for (int i = 1; i < args.Length; i++) { Console.Out.WriteLine("Adding counters: " + args[i]); CounterCreationData counter = new CounterCreationData(); counter.CounterName = args[i]; counter.CounterHelp = args[i]; counter.CounterType = PerformanceCounterType.NumberOfItems32; col.Add(counter); } if (PerformanceCounterCategory.Exists(metrics_name)) { PerformanceCounterCategory.Delete(metrics_name); Console.Out.WriteLine("Deleting perfGroup:" + metrics_name); } PerformanceCounterCategory category = PerformanceCounterCategory.Create(metrics_name, "Perf Category Description ", col); Console.Out.WriteLine("Creating perfGroup:" + metrics_name); }
public void AddCounterToCollection(CounterCreationDataCollection counterData) { CounterCreationData counterCreationData = new CounterCreationData( _counterName, _counterHelp, _pcType); counterData.Add(counterCreationData); }
private static bool SetupCategory() { if (!PerformanceCounterCategory.Exists("AverageCounter64SampleCategory")) { CounterCreationDataCollection counterDataCollection = new CounterCreationDataCollection(); // Add the counter. CounterCreationData averageCount64 = new CounterCreationData(); averageCount64.CounterType = PerformanceCounterType.AverageCount64; averageCount64.CounterName = "AverageCounter64Sample"; counterDataCollection.Add(averageCount64); // Add the base counter. CounterCreationData averageCount64Base = new CounterCreationData(); averageCount64Base.CounterType = PerformanceCounterType.AverageBase; averageCount64Base.CounterName = "AverageCounter64SampleBase"; counterDataCollection.Add(averageCount64Base); // Create the category. PerformanceCounterCategory.Create("AverageCounter64SampleCategory", "Demonstrates usage of the AverageCounter64 performance counter type.", PerformanceCounterCategoryType.SingleInstance, counterDataCollection); return (true); } else { Console.WriteLine("Category exists - AverageCounter64SampleCategory"); return (false); } }
public static void InstallCounters() { if (!PerformanceCounterCategory.Exists("DialogueMaster Babel")) { CounterCreationDataCollection ccdJanusTables = new CounterCreationDataCollection(); // tables CounterCreationData cd = new CounterCreationData(); cd.CounterType = PerformanceCounterType.NumberOfItems64; cd.CounterName = "Tables created"; cd.CounterHelp = "Total number of NGram-Tables created"; ccdJanusTables.Add(cd); cd = new CounterCreationData(); cd.CounterType = PerformanceCounterType.RateOfCountsPerSecond64; cd.CounterName = "Tables created / sec"; cd.CounterHelp = "Number of NGram-Tables created per second"; ccdJanusTables.Add(cd); cd = new CounterCreationData(); cd.CounterType = PerformanceCounterType.RawFraction; cd.CounterName = "Avg. table creation time"; cd.CounterHelp = "Average time it takes to create a table"; ccdJanusTables.Add(cd); cd = new CounterCreationData(); cd.CounterType = PerformanceCounterType.RawBase; cd.CounterName = "base for avg. table creation time"; cd.CounterHelp = "base for Average time it takes to create a table"; ccdJanusTables.Add(cd); // Comparison cd = new CounterCreationData(); cd.CounterType = PerformanceCounterType.NumberOfItems64; cd.CounterName = "Comparisons"; cd.CounterHelp = "Total number of comparisons"; ccdJanusTables.Add(cd); cd = new CounterCreationData(); cd.CounterType = PerformanceCounterType.RateOfCountsPerSecond64; cd.CounterName = "Comparisons / sec"; cd.CounterHelp = "Number of comparisons created per second"; ccdJanusTables.Add(cd); cd = new CounterCreationData(); cd.CounterType = PerformanceCounterType.RawFraction; cd.CounterName = "Avg. comparison time"; cd.CounterHelp = "Average time it takes to compare two tables"; ccdJanusTables.Add(cd); cd = new CounterCreationData(); cd.CounterType = PerformanceCounterType.RawBase; cd.CounterName = "base for Avg. comparison time"; cd.CounterHelp = "base for Average time it takes to compare two tables"; ccdJanusTables.Add(cd); // Classifications cd = new CounterCreationData(); cd.CounterType = PerformanceCounterType.NumberOfItems64; cd.CounterName = "Classifications"; cd.CounterHelp = "Total number of classifications"; ccdJanusTables.Add(cd); cd = new CounterCreationData(); cd.CounterType = PerformanceCounterType.RateOfCountsPerSecond64; cd.CounterName = "Classifications / sec"; cd.CounterHelp = "Number of classifications created per second"; ccdJanusTables.Add(cd); cd = new CounterCreationData(); cd.CounterType = PerformanceCounterType.RawFraction; cd.CounterName = "Avg. classification time"; cd.CounterHelp = "Average time it takes to classify a text"; ccdJanusTables.Add(cd); cd = new CounterCreationData(); cd.CounterType = PerformanceCounterType.RawBase; cd.CounterName = "base for Avg. classification time"; cd.CounterHelp = "base for Average time it takes to classify a text"; ccdJanusTables.Add(cd); PerformanceCounterCategory.Create("DialogueMaster Babel", "DialogueMaster Janus language detection engine", PerformanceCounterCategoryType.SingleInstance, ccdJanusTables); } }
public CounterCreationDataCollection(CounterCreationData[] value) {}
public void Insert(int index, CounterCreationData value) {}
public void CopyTo(CounterCreationData[] array, int index) {}
public static void CounterCreationData_SetCounterType_Invalud() { CounterCreationData ccd = new CounterCreationData("Simple", "Simple Help", PerformanceCounterType.RawBase); Assert.Throws <InvalidEnumArgumentException>(() => ccd.CounterType = (PerformanceCounterType)int.MaxValue); }
/// <summary> /// Занести данные о необходимых счётчиках Windows в коллекцию /// </summary> /// <param name="col">Коллекция</param> public override void FillCounterCreationData(CounterCreationDataCollection col) { CounterCreationData data = new CounterCreationData(this.Name, this.Description, CounterHelper.ConvertCounterType(this.Type, Info.Prefer64BitCounters)); col.Add(data); }
/// <summary> /// Занести данные о необходимых счётчиках Windows в коллекцию /// </summary> /// <param name="col">Коллекция</param> void IWinCounterInitialization.CounterFillCreationData(CounterCreationDataCollection col) { CounterCreationData data = new CounterCreationData(this.Name, this.Description, CounterHelper.ConvertCounterType(this.Type, _info.Prefer64BitCounters)); col.Add(data); }
private static void SetupCategory() { // Create category if: // 1) It not exists. // 2) New counter was added. - this situation occurs when category is already set on the machine, but it lacks the newly added counter, so it have to be recreated. if (PerformanceCounterCategory.Exists(CassandraCountersCategory)) { if ( PerformanceCounterCategory.CounterExists(CqlQueryBeatsName, CassandraCountersCategory) && PerformanceCounterCategory.CounterExists(CqlQueryCountPerSecName, CassandraCountersCategory) && //Add here every counter that will be used in driver, to check if currently existing category contains it. PerformanceCounterCategory.CounterExists(QueryTimeRollingAvrgName, CassandraCountersCategory)) { Logger.Info(string.Format("Performance counters category '{0}' already exists and contains all requiered counters.", CassandraCountersCategory)); return; } try { PerformanceCounterCategory.Delete(CassandraCountersCategory); Logger.Info("Successfully deleted performance counters category: " + CassandraCountersCategory); } catch (UnauthorizedAccessException ex) { Logger.Error( string.Format("Cannot delete performance counters category '{0}' due to insufficient administrative rights.", CassandraCountersCategory), ex); throw; } } var ccdc = new CounterCreationDataCollection(); var cqlQueryCountPerSecData = new CounterCreationData { CounterName = CqlQueryCountPerSecName, CounterHelp = "Number of Cql queries that were executed per second.", CounterType = PerformanceCounterType.RateOfCountsPerSecond64 }; ccdc.Add(cqlQueryCountPerSecData); var cqlQueryBeatsData = new CounterCreationData { CounterName = CqlQueryBeatsName, CounterHelp = "Counter that measures average Cql query execution time(in nanoseconds) between consecutive samples.", CounterType = PerformanceCounterType.AverageTimer32 }; var cqlQueryBeatsBaseData = new CounterCreationData { CounterName = CqlQueryBeatsNameBase, CounterHelp = "", CounterType = PerformanceCounterType.AverageBase }; ccdc.Add(cqlQueryBeatsData); ccdc.Add(cqlQueryBeatsBaseData); var queryTimeRollingAvrgData = new CounterCreationData { CounterName = QueryTimeRollingAvrgName, CounterHelp = "Counter that measures rolling arithmetic average of queries execution time in nanoseconds. By default, step is set to 30 previous samples.", CounterType = PerformanceCounterType.RawFraction }; var queryTimeRollingAvrgDataBaseData = new CounterCreationData { CounterName = QueryTimeRollingAvrgNameBase, CounterHelp = "", CounterType = PerformanceCounterType.RawBase }; ccdc.Add(queryTimeRollingAvrgData); ccdc.Add(queryTimeRollingAvrgDataBaseData); try { PerformanceCounterCategory.Create( CassandraCountersCategory, "Performance counters for DataStax Cassandra C# driver", PerformanceCounterCategoryType.SingleInstance, ccdc); Logger.Info("Successfully created performance counters category: " + CassandraCountersCategory); } catch (SecurityException ex) { Logger.Error("Cannot create performance counters category due to insufficient administrative rights.", ex); throw; } }
static void Main(string[] args) { #region Create //PerformanceCounterCategory.Delete("TplSample"); if (!PerformanceCounterCategory.Exists("TplSample")) { CounterCreationDataCollection counters = new CounterCreationDataCollection(); // 1. counter for counting totals: PerformanceCounterType.NumberOfItems32 CounterCreationData totalOps = new CounterCreationData(); totalOps.CounterName = "TplSemaphoreCounter"; totalOps.CounterType = PerformanceCounterType.NumberOfItems32; counters.Add(totalOps); // create new category with the counters above PerformanceCounterCategory.Create("TplSample", "Tpl course counter", PerformanceCounterCategoryType.SingleInstance, counters); } PerformanceCounter pc = new PerformanceCounter("TplSample", "TplSemaphoreCounter", false); #endregion // Create Console.WriteLine("Open Perfmon and listen to the TempCounter, \r\nthan press any key to continue"); Console.ReadKey(); const int ITERATIONS = 100; int maxCount = 0; using (var semaphore = new SemaphoreSlim(10, 10)) using (var countdown = new CountdownEvent(ITERATIONS)) { object sync = new object(); int count = 0; for (int i = 0; i < ITERATIONS; i++) { new Thread(() => { semaphore.Wait(); Interlocked.Increment(ref count); Console.Write("."); pc.Increment(); Thread.Sleep(300); lock (sync) { if (maxCount < count) { maxCount = count; } } Interlocked.Decrement(ref count); pc.Decrement(); semaphore.Release(); countdown.Signal(); }).Start(); // create new threads for every iteration } countdown.Wait(); }// semaphore.Close(); Console.WriteLine("\r\nDone {0}", maxCount); Console.ReadKey(); }
private void InitializePerfCounter() { lock(this) { _operational = true; try { if (_perfCounter != null) { _perfCounter.Close(); _perfCounter = null; } if (_categoryName == null || _counterName == null) { throw new Exception("Missing category name or counter name for target: " + Name); } if (!PerformanceCounterCategory.Exists(CategoryName) || !PerformanceCounterCategory.CounterExists(CounterName, CategoryName)) { List<PerfCounterTarget> targets = new List<PerfCounterTarget>(); bool doCreate = false; foreach(PerfCounterTarget t in _perfCounterTargets) { if (t.CategoryName == CategoryName) { targets.Add(t); if (t.AutoCreate) doCreate = true; } } if (doCreate) { if (PerformanceCounterCategory.Exists(CategoryName)) { //delete the whole category and rebuild from scratch PerformanceCounterCategory.Delete(CategoryName); } CounterCreationDataCollection ccds = new CounterCreationDataCollection(); foreach(PerfCounterTarget t in targets) { CounterCreationData ccd = new CounterCreationData(); ccd.CounterName = t._counterName; ccd.CounterType = t._counterType; ccds.Add(ccd); } #if DOTNET_2_0 PerformanceCounterCategory.Create(CategoryName, "Category created by NLog", (InstanceName != null) ? PerformanceCounterCategoryType.MultiInstance : PerformanceCounterCategoryType.SingleInstance, ccds); #else PerformanceCounterCategory.Create(CategoryName,"Category created by NLog",ccds); #endif } else { throw new Exception(string.Format("Counter does not exist: {0}|{1}", CounterName, CategoryName)); } } _perfCounter = new PerformanceCounter(CategoryName, CounterName, InstanceName, false); _operational = true; } catch(Exception ex) { _operational = false; _perfCounter = null; if (LogManager.ThrowExceptions) throw ex; } } }
public void AddRange(CounterCreationData[] value) {}
public bool Contains(CounterCreationData value) {}
/// <summary> /// Creates all the performance counters. If they already exists, they are destroyed and recreated. /// </summary> public void SetupPerformanceCounters() { Mutex globalLock = null; try { this.IsPerformanceCountersReady = false; // Utilizzo un lock globale di sistema, per non eseguire il setup contemporaneo tra 2 processi diversi globalLock = new Mutex(false, MUTEX_NAME); // Aspetto fino a che il lock non viene rilasciato, assegno un timeout di 30 secondi per sicurezza. if (!globalLock.WaitOne(TimeSpan.FromSeconds(30))) { log.WarnFormat("Cannot setup the performance counter: timeout acquiring the lock on '{0}' mutex lock. Setup aborted.", MUTEX_NAME); // Imposto il manager come se avesse installato correttamente i counter, perchè se entro in questo timeout, vuol dire che un'altra applicazione li sta installando. this.IsPerformanceCountersReady = true; return; } // Se la categoria non esiste, if (PerformanceCounterCategory.Exists(PERFCOUNTER_CATEGORY_KEY)) { PerformanceCounterCategory.Delete(PERFCOUNTER_CATEGORY_KEY); CounterCreationDataCollection counterCreationDataCollection = new CounterCreationDataCollection(); //Avarage Counter CounterCreationData perfCouterCustom1Counter = new CounterCreationData(); perfCouterCustom1Counter.CounterType = PerformanceCounterType.NumberOfItems64; perfCouterCustom1Counter.CounterName = PERCOUNTER_CUSTOM1; perfCouterCustom1Counter.CounterHelp = "help about counter... bla bla bla"; counterCreationDataCollection.Add(perfCouterCustom1Counter); PerformanceCounterCategory.Create( PERFCOUNTER_CATEGORY_KEY, "Contains the counters.", PerformanceCounterCategoryType.SingleInstance, counterCreationDataCollection); } this.IsPerformanceCountersReady = true; } catch (Exception ex) { log.Error(ex.Message, ex); } finally { try { if (globalLock != null) { globalLock.ReleaseMutex(); globalLock.Dispose(); } } catch (Exception ex) { log.Error("Error while trying to ReleaseMutex on the global lock.", ex); } } }
public int IndexOf(CounterCreationData value) {}
/// <summary> /// Creates an instance of the defined performance counter. /// </summary> /// <param name="counter"></param> /// <returns></returns> private static PerformanceCounter GetCounterInstance(CounterCreationData counter) { return(new PerformanceCounter(CategoryName, counter.CounterName, false)); }
public virtual void Remove(CounterCreationData value) {}
/// <summary> /// 性能计数器初始化 /// <para>性能计数器按照服务器名作为不同实例的划分</para> /// </summary> /// <param name="serverName"></param> public SystemCounter(string serverName) { //if (PerformanceCounterCategory.Exists(CATEGORY)) //{ // //return; // //FIXED:每次都要创建效率很低啊,而且还需要管理员权限 // //PerformanceCounterCategory.Delete(CATEGORY); //} InstanceName = serverName + Guid.NewGuid().ToString("N"); //FIXED:为了防止计数器冲突,加入GUID确保其唯一 if (!PerformanceCounterCategory.Exists(CATEGORY)) { var counters = new CounterCreationDataCollection(); #region Bytes and Files Counters var bytesSentPerSec = new CounterCreationData { CounterName = "Bytes Sent/sec", CounterHelp = "The rate at which data bytes are being sent by the FTP service.", CounterType = PerformanceCounterType.RateOfCountsPerSecond32 }; counters.Add(bytesSentPerSec); var bytesReceivedPerSec = new CounterCreationData { CounterName = "Bytes Received/sec", CounterHelp = "The rate at which data bytes are being received by the FTP service.", CounterType = PerformanceCounterType.RateOfCountsPerSecond32 }; counters.Add(bytesReceivedPerSec); var bytesTotalPerSec = new CounterCreationData { CounterName = "Bytes Total/sec", CounterHelp = "The sum of Bytes Sent/sec and Bytes Received/sec.", CounterType = PerformanceCounterType.RateOfCountsPerSecond32 }; counters.Add(bytesTotalPerSec); var totalFilesSent = new CounterCreationData { CounterName = "Total Files Sent", CounterHelp = "The total number of files that have been sent by the FTP service since the service started.", CounterType = PerformanceCounterType.NumberOfItems32 }; counters.Add(totalFilesSent); var totalFilesReceived = new CounterCreationData { CounterName = "Total Files Received", CounterHelp = "The total number of files that have been received by the FTP service since the service started.", CounterType = PerformanceCounterType.NumberOfItems32 }; counters.Add(totalFilesReceived); var totalFilesTransferred = new CounterCreationData { CounterName = "Total Files Transferred", CounterHelp = "The sum of Total Files Sent and Total Files Received. This is the total number of files transferred by the FTP service since the service started.", CounterType = PerformanceCounterType.NumberOfItems32 }; counters.Add(totalFilesTransferred); #endregion #region Users Counters var currentAnonymousUsers = new CounterCreationData { CounterName = "Current Anonymous Users", CounterHelp = "The number of users who currently have an anonymous connection that was made by using the FTP service.", CounterType = PerformanceCounterType.NumberOfItems32 }; counters.Add(currentAnonymousUsers); var currentNonAnonymousUsers = new CounterCreationData { CounterName = "Current NonAnonymous Users", CounterHelp = "The number of users who currently have a nonanonymous connection that was made by using the FTP service.", CounterType = PerformanceCounterType.NumberOfItems32 }; counters.Add(currentNonAnonymousUsers); var totalAnonymousUsers = new CounterCreationData { CounterName = "Total Anonymous Users", CounterHelp = "The number of users who have established an anonymous connection with the FTP service since the service started.", CounterType = PerformanceCounterType.NumberOfItems32 }; counters.Add(totalAnonymousUsers); var totalNonAnonymousUsers = new CounterCreationData { CounterName = "Total NonAnonymous Users", CounterHelp = "The number of users who have established nonanonymous connections with the FTP service since the service started.", CounterType = PerformanceCounterType.NumberOfItems32 }; counters.Add(totalNonAnonymousUsers); var maximumAnonymousUsers = new CounterCreationData { CounterName = "Maximum Anonymous Users", CounterHelp = "The maximum number of users who have established concurrent anonymous connections using the FTP service since the service started.", CounterType = PerformanceCounterType.NumberOfItems32 }; counters.Add(maximumAnonymousUsers); var maximumNonAnonymousUsers = new CounterCreationData { CounterName = "Maximum NonAnonymous Users", CounterHelp = "The maximum number of users who have established concurrent nonanonymous connections using the FTP service since the service started.", CounterType = PerformanceCounterType.NumberOfItems32 }; counters.Add(maximumNonAnonymousUsers); #endregion #region Connections, Attempts, and Uptime Counters var currentConnections = new CounterCreationData { CounterName = "Current Connections", CounterHelp = "The current number of connections that have been established with the FTP service.", CounterType = PerformanceCounterType.NumberOfItems32 }; counters.Add(currentConnections); var maximumConnections = new CounterCreationData { CounterName = "Maximum Connections", CounterHelp = "The maximum number of simultaneous connections that have been established with the FTP service.", CounterType = PerformanceCounterType.NumberOfItems32 }; counters.Add(maximumConnections); var totalConnectionAttempts = new CounterCreationData { CounterName = "Total Connection Attempts", CounterHelp = "The number of connections that have been attempted by using the FTP service since the service started.", CounterType = PerformanceCounterType.NumberOfItems32 }; counters.Add(totalConnectionAttempts); var totalLogonAttempts = new CounterCreationData { CounterName = "Total Logon Attempts", CounterHelp = "The number of logons that have been attempted by using the FTP service since the service started.", CounterType = PerformanceCounterType.NumberOfItems32 }; counters.Add(totalLogonAttempts); var ftpServiceUptime = new CounterCreationData { CounterName = "FTP Service Uptime", CounterHelp = "The amount of time, in seconds, that the FTP service has been running.", CounterType = PerformanceCounterType.NumberOfItems32 }; counters.Add(ftpServiceUptime); #endregion #region Command Counters var commandsExecuted = new CounterCreationData { CounterName = "Commands Executed", CounterHelp = "The total number of commands that have been executed with the FTP service.", CounterType = PerformanceCounterType.NumberOfItems32 }; counters.Add(commandsExecuted); var commandsExecutedPerSec = new CounterCreationData { CounterName = "Commands Executed/sec", CounterHelp = "The rate at which commands are being executed with the FTP service.", CounterType = PerformanceCounterType.RateOfCountsPerSecond32 }; counters.Add(commandsExecutedPerSec); #endregion PerformanceCounterCategory.Create(CATEGORY, "UniFTP", PerformanceCounterCategoryType.MultiInstance, counters); } //string instanceName = string.Concat("Port: ", port); string instanceName = InstanceName; _bytesSentPerSec = new PerformanceCounter(CATEGORY, "Bytes Sent/sec", instanceName, false); _bytesReceivedPerSec = new PerformanceCounter(CATEGORY, "Bytes Received/sec", instanceName, false); _bytesTotalPerSec = new PerformanceCounter(CATEGORY, "Bytes Total/sec", instanceName, false); _totalFilesSent = new PerformanceCounter(CATEGORY, "Total Files Sent", instanceName, false); _totalFilesReceived = new PerformanceCounter(CATEGORY, "Total Files Received", instanceName, false); _totalFilesTransferred = new PerformanceCounter(CATEGORY, "Total Files Transferred", instanceName, false); _currentAnonymousUsers = new PerformanceCounter(CATEGORY, "Current Anonymous Users", instanceName, false); _currentNonAnonymousUsers = new PerformanceCounter(CATEGORY, "Current NonAnonymous Users", instanceName, false); _totalAnonymousUsers = new PerformanceCounter(CATEGORY, "Total Anonymous Users", instanceName, false); _totalNonAnonymousUsers = new PerformanceCounter(CATEGORY, "Total NonAnonymous Users", instanceName, false); _maximumAnonymousUsers = new PerformanceCounter(CATEGORY, "Maximum Anonymous Users", instanceName, false); _maximumNonAnonymousUsers = new PerformanceCounter(CATEGORY, "Maximum NonAnonymous Users", instanceName, false); _currentConnections = new PerformanceCounter(CATEGORY, "Current Connections", instanceName, false); _maximumConnections = new PerformanceCounter(CATEGORY, "Maximum Connections", instanceName, false); _totalConnectionAttempts = new PerformanceCounter(CATEGORY, "Total Connection Attempts", instanceName, false); _totalLogonAttempts = new PerformanceCounter(CATEGORY, "Total Logon Attempts", instanceName, false); _ftpServiceUptime = new PerformanceCounter(CATEGORY, "FTP Service Uptime", instanceName, false); _commandsExecuted = new PerformanceCounter(CATEGORY, "Commands Executed", instanceName, false); _commandsExecutedPerSec = new PerformanceCounter(CATEGORY, "Commands Executed/sec", instanceName, false); //_totalFilesSent.RawValue = 0; //_totalFilesReceived.RawValue = 0; //_totalFilesTransferred.RawValue = 0; //_currentAnonymousUsers.RawValue = 0; //_currentNonAnonymousUsers.RawValue = 0; //_totalAnonymousUsers.RawValue = 0; //_totalNonAnonymousUsers.RawValue = 0; //_maximumAnonymousUsers.RawValue = 0; //_maximumNonAnonymousUsers.RawValue = 0; //_currentConnections.RawValue = 0; //_maximumConnections.RawValue = 0; //_totalConnectionAttempts.RawValue = 0; //_totalLogonAttempts.RawValue = 0; //_ftpServiceUptime.RawValue = 0; //_commandsExecutedPerSec.RawValue = 0; //_commandsExecuted.RawValue = 0; Enabled = true; }
// Methods public int Add(CounterCreationData value) {}
public void AddCounterToCollection(CounterCreationDataCollection counterData) { CounterCreationData data = new CounterCreationData(this._counterName, this._counterHelp, this._pcType); counterData.Add(data); }