Log("Starting to compile...\n");
Process p = new Process();
p.StartInfo.FileName = CompilationCommand;
p.StartInfo.Arguments = SourceFileName;
p.Start();
Log("Compiling finished in " + (p.StartTime - p.ExitTime).Seconds + " seconds\n");
This code doesn’t work. How can I find out how much time was spent on compiling a C++ source file with g++ compiler?
You can use the WaitForExit function in process to wait for the process to exit along with the Stopwatch class to measure the time it took. This would result in you having a thread waiting for the process to exit.