How to get the total net proccess time (of all the cores) for a specific job using C# API
-
Monday, October 24, 2011 11:37 AM
In my application I need to get the total net proccess time (of all the cores that run the job) for a specific job that the user chooses.
how can i get it using C#?
Thanks ,
Ben
All Replies
-
Thursday, October 27, 2011 10:05 PMISchedulerJobCounters.TotalCpuTime Property might be what you are looking for (http://msdn.microsoft.com/en-us/library/microsoft.hpc.scheduler.ischedulerjobcounters.totalcputime(VS.85).aspx).daryl
-
Sunday, October 30, 2011 2:27 PM
Hi Daryl,
I would appreciate if I can get an example.
Thanks,
Ben
-
Tuesday, November 01, 2011 11:45 PM
Here is a quick fragment that will fetch the total cpu time for a given JobId:
using (IScheduler scheduler = new Scheduler())
{
scheduler.Connect("localhost");int desiredJobId = 3;
IFilterCollection filter = scheduler.CreateFilterCollection();filter.Add(new FilterProperty(FilterOperator.Equal, JobPropertyIds.Id, desiredJobId));
ISchedulerCollection jobs = scheduler.GetJobList(filter, null /* no sort order specified */);
ISchedulerJob job = jobs[0] as ISchedulerJob;
ISchedulerJobCounters counters = job.GetCounters();long totalCpuTime = counters.TotalCpuTime;
}- Proposed As Answer by DarylMsft Tuesday, November 01, 2011 11:46 PM
- Marked As Answer by Ben.Alterzon Thursday, November 03, 2011 12:48 PM