How to get the total net proccess time (of all the cores) for a specific job using C# API

Answered How to get the total net proccess time (of all the cores) for a specific job using C# API

  • 2011. október 24. 11:37
     
     

    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

Az összes válasz

  • 2011. október 27. 22:05
     
     
    ISchedulerJobCounters.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
  • 2011. október 30. 14:27
     
     

    Hi Daryl,

    I would appreciate if I can get an example.

    Thanks,

    Ben

  • 2011. november 1. 23:45
     
     Válasz

    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;
                }

    • Válasznak javasolta: DarylMsft 2011. november 1. 23:46
    • Megjelölte válaszként: Ben.Alterzon 2011. november 3. 12:48
    •