[HKEY_LOCAL_MACHINE\Software\Microsoft\.NETCompactFramework\PerfMonitor]
"Counters"=dword:1
就好了
之後Run .NET Program 然後會在根目錄下產生 "AppName".stat 這個檔案
就可以分析了
設定的code
C#
// Call this method with True to
// turn on the peformance counters,
// or with False to turn them off.
private void SetPerfCounters(bool perfOn)
{
// Specify values for setting the registry.
string userRoot = "HKEY_LOCAL_MACHINE";
string subkey = "SOFTWARE\\Microsoft\\.NETCompactFramework\\PerfMonitor";
string keyName = userRoot + "\\" + subkey;
int PCset;
if(perfOn == true)
PCset = 1;
else
PCset = 0;
// Set the the registry value.
try
{
Registry.SetValue(keyName, "Counters", PCset);
if(perfOn == true)
MessageBox.Show("Performance Counters On");
else
MessageBox.Show("Performance Counters Off");
}
catch(System.Exception ex)
{
MessageBox.Show(ex.Message);
}
}