How to get information about process in C#? -
how information process (cpu, memory, disk & network usage) in c# application?
p.s. system.diagnostics.process , system.diagnostics.performancecounter doesn't provide information disk , network usage. don't use it.
system.text.stringbuilder sb = new system.text.stringbuilder(); var currentprocess = system.diagnostics.process.getcurrentprocess(); sb.appendline("process information"); sb.appendline("-------------------"); sb.appendline("cpu time"); sb.appendline(string.format("\ttotal {0}", currentprocess.totalprocessortime)); sb.appendline(string.format("\tuser {0}", currentprocess.userprocessortime)); sb.appendline(string.format("\tprivileged {0}", currentprocess.privilegedprocessortime)); sb.appendline("memory usage"); sb.appendline(string.format("\tcurrent {0:n0} b", currentprocess.workingset64)); sb.appendline(string.format("\tpeak {0:n0} b", currentprocess.peakworkingset64)); sb.appendline(string.format("active threads {0:n0}", currentprocess.threads.count));
etc.
Comments
Post a Comment