[ 
https://issues.apache.org/jira/browse/YARN-3304?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14385263#comment-14385263
 ] 

Junping Du commented on YARN-3304:
----------------------------------

There is an small issue for getCumulativeCpuTime() in v5 patch:
if p.getDtime() ==0, below code will return UNAVAILABLE, but it should return 0.
{code}
 public long getCumulativeCpuTime() {
    if (JIFFY_LENGTH_IN_MILLIS < 0) {
      return UNAVAILABLE;
    }
    long incJiffies = 0;
    for (ProcessInfo p : processTree.values()) {
      if (p != null) {
        incJiffies += p.getDtime();
      }
    }
    if (incJiffies > 0 && cpuTime == UNAVAILABLE) {
        cpuTime = 0L;
    }
    cpuTime += incJiffies * JIFFY_LENGTH_IN_MILLIS;
    return cpuTime;
  }
{code}
I will fix this and name (suggested by Vinod) and MR in v6 patch.

> ResourceCalculatorProcessTree#getCpuUsagePercent default return value is 
> inconsistent with other getters
> --------------------------------------------------------------------------------------------------------
>
>                 Key: YARN-3304
>                 URL: https://issues.apache.org/jira/browse/YARN-3304
>             Project: Hadoop YARN
>          Issue Type: Bug
>          Components: nodemanager
>            Reporter: Junping Du
>            Assignee: Junping Du
>            Priority: Blocker
>         Attachments: YARN-3304-v2.patch, YARN-3304-v3.patch, 
> YARN-3304-v4-boolean-way.patch, YARN-3304-v4-negative-way-MR.patch, 
> YARN-3304-v4-negtive-value-way.patch, YARN-3304.patch, yarn-3304-5.patch
>
>
> Per discussions in YARN-3296, getCpuUsagePercent() will return -1 for 
> unavailable case while other resource metrics are return 0 in the same case 
> which sounds inconsistent.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to