Using system;
Using system. diagnostics;
Namespace myconsole
{
Class Program
{
Static void main (string [] ARGs)
{
String filepath = "E: \ render \ bin \ render.exe ";
String argument = "\\\\ 192.168.12.166 \ ceshi_project \ scenes \ Ceshi. MB ";
Try
{
PROCESS p = process. Start (filepath, argument );
P. priorityclass = processpriorityclass. belownormal;
// Obtain the CPU usage
Performancecounter cpuusage = new performancecounter ("processor", "% processor time", "_ total ");
// Obtain the CPU usage of a process
Performancecounter renderusage = new performancecounter ("process", "% processor time", p. processname );
Do
{
Console. writeline ("---------------------");
Console. writeline ("total usage: {0: P1}", cpuusage. nextvalue ()/100 );
Console. writeline ("{1} usage: {0: P1}", renderusage. nextvalue ()/100, P. processname );
System. Threading. thread. Sleep (1000 );
}
While (true );
}
Catch (exception ex)
{
Console. writeline (ex. tostring ());
Console. Read ();
}
}
}
}