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

  • Montag, 24. Oktober 2011 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

Alle Antworten

  • Donnerstag, 27. Oktober 2011 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
  • Sonntag, 30. Oktober 2011 14:27
     
     

    Hi Daryl,

    I would appreciate if I can get an example.

    Thanks,

    Ben

  • Dienstag, 1. November 2011 23:45
     
     Beantwortet

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

    • Als Antwort vorgeschlagen DarylMsft Dienstag, 1. November 2011 23:46
    • Als Antwort markiert Ben.Alterzon Donnerstag, 3. November 2011 12:48
    •