code_junkie

ASP.NET/C# - Custom PerformanceCounters only show up in 32-bit perfmon on 64-bit system

Nov 13th, 2011
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. internal static void Increment(String instanceName, DistributedCacheCounterInstanceType counterInstanceType)
  2. {
  3. var permission = new PerformanceCounterPermission(PerformanceCounterPermissionAccess.Write, Environment.MachineName, "CounterName");
  4. permission.Assert();
  5.  
  6. var counter = new PerformanceCounter("CategoryName", "CounterName", instanceName, false);
  7. counter.RawValue++; // Use RawValue++ instead of Increment() to avoid locking
  8. counter.Close();
  9. }
Add Comment
Please, Sign In to add comment