Fix dstat graph processing
This commit fixes dstat graph processing to draw a graph properly. There are two problem mainly. 1. Reading header process is not correct It looks the dstat output format was changed to remove a row of the header in the past. However, stackviz was not changed at that time. So, this commit fixes to deal with it properly. 2. The year in its logs process is not correct. With the original process which sets 1900+year after utcParse() call, it looks one hour difference occurs somehow. So, this commit sets the year to the date string directly. Change-Id: I52c321f4bd13475f3be2f1a9fbcd86a6ddd4e4be
This commit is contained in:
parent
cf87b63aec
commit
9d4255e69e
@ -38,7 +38,7 @@ var parseDstat = function(data, year) {
|
||||
// assume UTC - may not necessarily be the case?
|
||||
// dstat doesn't include the year in its logs, so we'll need to copy it
|
||||
// from the subunit logs
|
||||
var dateFormat = timeFormat.utcParse('%d-%m %H:%M:%S');
|
||||
var dateFormat = timeFormat.utcParse('%Y-%d-%m %H:%M:%S');
|
||||
|
||||
var parsed = dsv.csvParseRows(data, function(row, i) {
|
||||
if (i === 0) {
|
||||
@ -47,13 +47,13 @@ var parseDstat = function(data, year) {
|
||||
!row[0].endsWith('CSV output')) {
|
||||
throw new Error('Invalid Dstat CSV');
|
||||
}
|
||||
} else if (i <= 4) { // header rows - ignore
|
||||
} else if (i <= 3) { // header rows - ignore
|
||||
return null;
|
||||
} else if (i === 5) { // primary
|
||||
} else if (i === 4) { // primary
|
||||
primaryNames = row;
|
||||
fillArrayRight(primaryNames);
|
||||
return null;
|
||||
} else if (i === 6) { // secondary
|
||||
} else if (i === 5) { // secondary
|
||||
secondaryNames = row;
|
||||
|
||||
names = mergeNames(primaryNames, secondaryNames);
|
||||
@ -66,8 +66,7 @@ var parseDstat = function(data, year) {
|
||||
var value = row[col];
|
||||
if (value && name) {
|
||||
if (name === 'system_time') {
|
||||
value = dateFormat(value);
|
||||
value.setFullYear(1900 + year);
|
||||
value = dateFormat((1900 + year) + '-' + value);
|
||||
} else {
|
||||
value = parseFloat(value);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user