I'm trying to monitor the performance information for openoffice using the performance counter class in C#. I'm encountering a wierd issue where although my program can monitor other applications information just fine, it cannot monitor open office's performance data properly using the same procedure. Essentially, I create a process and have a performance counter get the Processor time from that process using it's filename. OpenOffice, I have noticed, has two processes under the task manager; one is soffice.bin and one is soffice.exe. The bin file takes up way more memory than the exe file, so I tried to monitor that after the exe file gave me no usable performance data(Performance conter kept returning a value of 0). However, the bin file has the same issue - I can't get any usable performance data, no matter what I do to the application.
Can anyone tell me why I'm not getting any good readings for openoffice's performance? Am I using the wrong process name, or is it something more subtle?
// create a process
p = new Process();
p.StartInfo.UseShellExecute = true;
p.StartInfo.CreateNoWindow = true;
p.StartInfo.FileName = fileName;
p.Start();
// for open office, I found that the BIN file takes up more memory in the task manager
String name = "C:\\Program Files (x86)\\OpenOffice.org 3\\program\\soffice.bin";
// So I make a performance counter to monitor that.
pc = new System.Diagnostics.PerformanceCounter("Process",
"% Processor Time",
name,
true);