locked
TaskObject GetCounters().TotalCpuTime Returning "0" Value RRS feed

  • Question

  • TaskObject GetCounters().TotalCpuTime Returning "0" for the below code. While TotalUserTime,TotalKernelTime Properties are returning Correct Values.Job object is Returning correct Total Cpu TIme.

    1)We would like to know Returning "0" value is Expected behaviour? or any coding mistake we are doing.

    Task Id Task Execution Time Total CPU Time Total User Time Total Kernel Time Total Memory
    1 1420 0 280 93 29048
    2 1047 0 312 109 29032
    3 1043 0 358 62 29032
    4 1000 0 312 124 29044
    5 1497 0 280 109 29036
    6 1467 0 327 46 29028


    Job Execution Time Total CPU Time Total User Time Total Kernel Time Total Memory
    1764 2412 1869 543 174220


    private void WriteTaskDatatoReport(ISchedulerJob jobid)

    {

    FileStream fileMerge = new FileStream(jobid.Name + "_log.txt", FileMode.OpenOrCreate, FileAccess.Write);

    StreamWriter sw = new StreamWriter(fileMerge);

    foreach (var item in job.GetTaskList(null, null))

    {

    var j = (Microsoft.Hpc.Scheduler.SchedulerTask)item;

    var t = jobid.OpenTask(j.TaskId);

    ArrayList a = new ArrayList();

    Dictionary<string, string> x = new Dictionary<string, string>();

    x.Add("Job Id", jobid.Name);

    x.Add("Task Id", t.TaskId.JobTaskId.ToString());

    x.Add("Task Execution Time", (t.EndTime - t.CreateTime).TotalMilliseconds.ToString());

    x.Add("Total CPU Time", t.GetCounters().TotalCpuTime.ToString());

    x.Add("Total User Time", t.GetCounters().TotalUserTime.ToString());

    x.Add("Total Kernel Time", t.GetCounters().TotalKernelTime.ToString());

    x.Add("Total Memory", t.GetCounters().TotalMemory.ToString());

    ReportService.Reports.WriteToReport("TaskDetail", x);

    }

    fileMerge.Close();

    }

    Tuesday, July 15, 2008 4:43 AM

Answers

  • Sorry for the delayed response.  It turns out that this is a known issue that has since been fixed (in a yet unreleased beta).  If you still see it occurring when we release our next beta, please let us know.

    Thanks,
    Josh
    -Josh
    Monday, July 28, 2008 8:36 PM
    Moderator

All replies

  • Did you call Refresh() on the task?
    -Josh
    Tuesday, July 15, 2008 7:31 AM
    Moderator
  • Yes i called the Refresh Method on Task object then also TaskObject GetCounters().TotalCpuTime is retuning "0"
    TotalUserTime,TotalKernelTime Properties Working as Expected..
    Tuesday, July 15, 2008 11:59 AM
  • Sorry for the delayed response.  It turns out that this is a known issue that has since been fixed (in a yet unreleased beta).  If you still see it occurring when we release our next beta, please let us know.

    Thanks,
    Josh
    -Josh
    Monday, July 28, 2008 8:36 PM
    Moderator