2 // System.Diagnostics.PerformanceCounter.cs
5 // Jonathan Pryor (jonpryor@vt.edu)
11 using System.ComponentModel;
12 using System.Diagnostics;
14 namespace System.Diagnostics {
16 // must be safe for multithreaded operations
17 public class PerformanceCounter : Component, ISupportInitialize {
19 private string categoryName;
20 private string counterName;
21 private string instanceName;
22 private string machineName;
23 private bool readOnly;
25 [MonoTODO("Find the actual value")]
26 public static int DefaultFileMappingSize = 0x80000;
28 // set catname, countname, instname to "", machname to "."
29 public PerformanceCounter ()
31 categoryName = counterName = instanceName = "";
35 // throws: InvalidOperationException (if catName or countName
36 // is ""); ArgumentNullException if either is null
37 // sets instName to "", machname to "."
38 public PerformanceCounter (String categoryName,
40 : this (categoryName, counterName, false)
44 public PerformanceCounter (string categoryName,
47 : this (categoryName, counterName, "", readOnly)
51 public PerformanceCounter (string categoryName,
54 : this (categoryName, counterName, instanceName, false)
58 public PerformanceCounter (string categoryName,
64 CategoryName = categoryName;
65 CounterName = counterName;
67 if (categoryName == "" || counterName == "")
68 throw new InvalidOperationException ();
70 InstanceName = instanceName;
71 this.instanceName = instanceName;
72 this.machineName = ".";
73 this.readOnly = readOnly;
76 public PerformanceCounter (string categoryName,
80 : this (categoryName, counterName, instanceName, false)
82 this.machineName = machineName;
85 // may throw ArgumentNullException
86 public string CategoryName {
87 get {return categoryName;}
90 throw new ArgumentNullException ("categoryName");
95 // // may throw InvalidOperationException
97 // public string CounterHelp {
101 // may throw ArgumentNullException
102 public string CounterName {
103 get {return counterName;}
106 throw new ArgumentNullException ("counterName");
111 // // may throw InvalidOperationException
113 // public PerformanceCounterType CounterType {
117 public string InstanceName {
118 get {return instanceName;}
119 set {instanceName = value;}
122 // // may throw ArgumentException if machine name format is wrong
123 // [MonoTODO("What's the machine name format?")]
124 // public string MachineName {
125 // get {return machineName;}
126 // set {machineName = value;}
129 // // may throw InvalidOperationException, Win32Exception
131 // public long RawValue {
134 // throw new NotImplementedException ();
138 // public bool ReadOnly {
139 // get {return readOnly;}
140 // set {readOnly = value;}
144 public void BeginInit ()
146 throw new NotImplementedException ();
150 // public void Close ()
152 // throw new NotImplementedException ();
156 // public static void CloseSharedResources ()
158 // throw new NotImplementedException ();
161 // // may throw InvalidOperationException, Win32Exception
163 // public long Decrement ()
165 // throw new NotImplementedException ();
169 // protected override void Dispose (bool disposing)
171 // throw new NotImplementedException ();
175 public void EndInit ()
177 throw new NotImplementedException ();
180 // // may throw InvalidOperationException, Win32Exception
182 // public long Increment ()
184 // throw new NotImplementedException ();
187 // // may throw InvalidOperationException, Win32Exception
189 // public long IncrementBy (long value)
191 // throw new NotImplementedException ();
194 // // may throw InvalidOperationException, Win32Exception
196 // public CounterSample NextSample ()
198 // throw new NotImplementedException ();
201 // // may throw InvalidOperationException, Win32Exception
203 // public float NextValue ()
205 // throw new NotImplementedException ();
208 // // may throw InvalidOperationException, Win32Exception
210 // public void RemoveInstance ()
212 // throw new NotImplementedException ();