strong-trace
Version:
StrongTrace Node.js Tracer
37 lines (29 loc) • 945 B
JavaScript
;
module.exports = ExecutionTrace
module.exports.toExecutionTrace = toExecutionTrace
var hrtutils = require("./hrtutils")
function toExecutionTrace(trace) {
var ext = new ExecutionTrace()
ext.start = trace.ts
ext.mod = trace.mod
ext.fn = trace.fn
ext.id = trace.id
return ext
}
function ExecutionTrace() {}
ExecutionTrace.prototype.visitIndex = 0
ExecutionTrace.prototype.start = [0, 0]
ExecutionTrace.prototype.mod = ""
ExecutionTrace.prototype.fn = ""
ExecutionTrace.prototype.end = [0, 0]
ExecutionTrace.prototype.fnTime = 0
ExecutionTrace.prototype.childTime = 0
ExecutionTrace.prototype.parent = undefined
ExecutionTrace.prototype.finish = function finish(trace) {
this.end = trace.ts
this.fnTime = hrtutils.hrtToUs(hrtutils.hrDiff(this.start, this.end)) - this.childTime
}
ExecutionTrace.prototype.addChild = function addChild(childTrace) {
this.childTime += childTrace.fnTime
// TODO some linkage
}