i having issues listing memory , cpu usage of processes in c#. getting runtime error "access denied" when try totalprocessortime
.
also, when use peakworkingset64
, getting unreasonable numbers. example, know steam.exe not taking 135380992 kb.
is there better method of obtaining memory usage? goal display task manager 1024k.
as cpu usage, tried running compiler (vs2010 professional) under administrator privileges , on administrator account got same error. running windows 32 bit if has matter. thanks!
var processes = process.getprocesses(); listbox1.items.clear(); foreach (var process in processes) { listbox2.items.add(process.peakworkingset64 + process.processname + ""); listbox3.items.add(process.totalprocessortime + ""); }
process.peakworkingset64 returns number of bytes not kb, 132203kb or 129mb sound more reasonable?
have tried running application outside of vs, running administrator? might vs hosting process not running under elevated privileges , therefore preventing calling totalprocessortime, have not tested might off track here.
update: did quick test , seems totalprocessortime property attempts open handle process, administrator might not have sufficient privileges processes. suggest @ using windows performancecounter information looking for.
Comments
Post a Comment