我正在使用perfcounter = "% Time in GC"
所以当我跑
时gcPerf.NextSample()
我得到的值为42.12273。
但我不明白这些值的单位是(ms)还是什么?
如果我想要(ms)我可以如何改造它?
这是全局代码
string category = ".NET CLR Memory";
string counter = "% Time in GC";
string instance = Process.GetCurrentProcess().ProcessName;
PerformanceCounter gcPerf;
// make sure the performance counter is available to query
if (PerformanceCounterCategory.Exists(category) &&
PerformanceCounterCategory.CounterExists(counter, category) &&
PerformanceCounterCategory.InstanceExists(instance, category))
{
gcPerf = new PerformanceCounter(category, counter, instance);
}