Fix focus panel chart selection for pcp-dstat
Headers slightly changed in pcp-dstat output, and the chart we need to get is called "total usage:idl". Look for this field, or fall back to the old one to support both output formats. Change-Id: Ib9aaf3c18da63cf5acd44ccf6eaff1c5fa68ac12
This commit is contained in:
parent
67a68ab1cf
commit
009f8942fd
@ -437,7 +437,18 @@ function displayFocusGraph(graphs, dmin, dmax) {
|
|||||||
if ($('#focus').children().length > 0) {
|
if ($('#focus').children().length > 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
data = getValues(graphs, "total cpu usage", "idl")
|
|
||||||
|
/* original dstat has "total cpu usage" with fields "usr", "idl" ...
|
||||||
|
* pcp dstat has "total usage" with fields "total usage:usr", "total usage:sys" ...
|
||||||
|
*/
|
||||||
|
if (getExists(graphs, "total usage", "total usage:idl")) {
|
||||||
|
data = getValues(graphs, "total usage", "total usage:idl")
|
||||||
|
} else if (getExists(graphs, "total cpu usage", "idl")) {
|
||||||
|
data = getValues(graphs, "total cpu usage", "idl")
|
||||||
|
} else {
|
||||||
|
alert("Failed to parse: idle CPU stats not found")
|
||||||
|
}
|
||||||
|
|
||||||
if (data) { // Rollback to the first element if not found
|
if (data) { // Rollback to the first element if not found
|
||||||
data = data.map(function(idl) { return {x: idl.x, y: (100 - parseFloat(idl.y)) };});
|
data = data.map(function(idl) { return {x: idl.x, y: (100 - parseFloat(idl.y)) };});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user