-
Notifications
You must be signed in to change notification settings - Fork 1
/
parser.js
34 lines (34 loc) · 1.05 KB
/
parser.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
define([], function() {
'use strict';
return {
getDataFromAttribute: function(attribute) {
var re = /((?:[^:\r\n,+\-\(\)\\\/])*), ([0-9\.]+), ([0-9\.]+), ([0-9\.]+), ([0-9\.]+), ([0-9\.]+)/gi;
var result = re.exec(attribute);
var log_data = {};
while(result != null) {
var alias = result[1];
if (!log_data[alias]) {
log_data[alias] = {
name : alias,
data : [],
annotations: []
};
}
var enq = parseFloat(result[2]) * 1000.0;
var deq = parseFloat(result[3]) * 1000.0;
var comp = parseFloat(result[4]) * 1000.0;
var wait_time = parseFloat(result[3]) - parseFloat(result[2]);
var exec_time = parseFloat(result[5]) - wait_time;
var deadline = parseFloat(result[6]);
log_data[alias].data.push([enq, 0]);
log_data[alias].data.push([enq, wait_time]);
log_data[alias].data.push([deq, wait_time]);
log_data[alias].data.push([deq, exec_time]);
log_data[alias].data.push([comp, exec_time]);
log_data[alias].data.push([comp, 0]);
result = re.exec(attribute);
}
return log_data;
}
};
});