concurix-traceaggregator
Advanced tools
Comparing version 1.1.0 to 1.2.0
{ | ||
"name": "concurix-traceaggregator", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Aggregation of trace data for the concurix tracer", | ||
@@ -30,4 +30,4 @@ "main": "traceaggregator.js", | ||
"dependencies": { | ||
"concurix-waterfall": "^1.0.1", | ||
"stats-incremental": "^1.0.0" | ||
"concurix-waterfall": "^1.1.0", | ||
"stats-incremental": "^1.1.0" | ||
}, | ||
@@ -34,0 +34,0 @@ "devDependencies": { |
@@ -105,3 +105,4 @@ "use strict"; | ||
// TBD how are we going to track errors like this? Send to cx? | ||
console.log("Concurix stack id mismatch") | ||
// TBD how to raise these errors without infinite stack recursion? | ||
//console.log("Concurix stack id mismatch") | ||
return | ||
@@ -160,3 +161,4 @@ } | ||
if (enterCount !== exitCount) { | ||
console.log("Concurix Stack Accounting Error: %s !=== %s", enterCount, exitCount) | ||
// TBD how to raise these errors without infinite stack recursion? | ||
//console.log("Concurix Stack Accounting Error: %s !=== %s", enterCount, exitCount) | ||
// The accounting got messed up somehow. We'll need to track down this issue, | ||
@@ -208,8 +210,2 @@ // but for now, just log it and throw data away. | ||
function nextTransaction() { | ||
// get a transaction to process | ||
// no more? | ||
cleanupExtras() | ||
} | ||
TraceAggregator.prototype.navigateTransaction = function (id, destIndex) { | ||
@@ -226,10 +222,12 @@ var origin = this.origins[id] | ||
var complete = false | ||
var target = null | ||
var path = [] | ||
var links = Object.keys(startSeg.outgoing) | ||
for (var i = 0; i < links.length; i++) { | ||
// follow non-transaction links first | ||
var target = this.targets[links[i]] | ||
target = this.targets[links[i]] | ||
if (target == null) { | ||
continue | ||
} | ||
var path = this.followThread([origin], target, links[i], id, {}) | ||
path = this.followThread([origin], target, links[i], id, {}) | ||
if (path.length > 0) { | ||
@@ -243,2 +241,20 @@ // complete all the wait link segments | ||
} | ||
var txs = Object.keys(startSeg.outgoingTxs) | ||
for (var j = 0; j < txs.length; j++) { | ||
if (txs[j] === id) { | ||
continue | ||
} | ||
target = this.targets[txs[j]] | ||
if (target == null) { | ||
continue | ||
} | ||
path = this.followThread([origin], target, txs[j], id, {}) | ||
if (path.length > 0) { | ||
// complete all the wait link segments | ||
// TBD track share count on segments? | ||
// difficulty: how to update already agg'd ones? | ||
return this.finishTransactionThread(path, id) | ||
} | ||
} | ||
this.finishTransactionThread([origin, id, destIndex], id) | ||
@@ -249,2 +265,4 @@ } | ||
seenCache[segId] = true | ||
var target = null | ||
var path = [] | ||
var segment = this.cache[segId] | ||
@@ -257,5 +275,6 @@ // Is this segment the end of transactionId? | ||
} | ||
// Try non-transaction links first | ||
var outgoing = Object.keys(segment.outgoing) | ||
for (var i = 0; i < outgoing.length; i++) { | ||
var target = this.targets[outgoing[i]] | ||
target = this.targets[outgoing[i]] | ||
if (seenCache[target]) { | ||
@@ -265,3 +284,3 @@ // Don't get stuck in a loop | ||
} | ||
var path = this.followThread([], target, outgoing[i], transactionId, seenCache) | ||
path = this.followThread([], target, outgoing[i], transactionId, seenCache) | ||
if (path.length) { | ||
@@ -272,2 +291,16 @@ // unwind | ||
} | ||
// Try transactions next | ||
var outgoingTxs = Object.keys(segment.outgoingTxs) | ||
for (var j = 0; j < outgoingTxs.length; j++) { | ||
target = this.targets[outgoingTxs[j]] | ||
if (seenCache[target]) { | ||
// Don't get stuck in a loop | ||
continue | ||
} | ||
path = this.followThread([], target, outgoingTxs[j], transactionId, seenCache) | ||
if (path.length) { | ||
// unwind | ||
return thread.concat(linkId, segId, path) | ||
} | ||
} | ||
// We didn't make it to transactionId; too bad so sad | ||
@@ -277,6 +310,2 @@ return [] | ||
function cleanupExtras() { | ||
// throw all untouched segments into their own simple wfs | ||
} | ||
TraceAggregator.prototype.finishTransactionThread = function (path, transactionId) { | ||
@@ -286,13 +315,28 @@ // finalize the stack | ||
var waterfall = new Waterfall(firstBlock.tZero) | ||
for (var i = 0; i < path.length; i += 2) { | ||
var self = this | ||
var addLink = function (srcId, tgtId, linkId) { | ||
var srcSeg = self.cache[srcId] | ||
var src = (srcSeg.outgoing[linkId] != null) ? srcSeg.outgoing[linkId] : srcSeg.outgoingTxs[linkId] | ||
var tgt = self.cache[tgtId].incoming[linkId] | ||
waterfall.addLink(src, tgt) | ||
} | ||
var i = 0 | ||
for (i = 0; i < path.length; i += 2) { | ||
// Add the segments | ||
waterfall.addSegment(this.cache[path[i]]) | ||
this.seen[path[i]]++ | ||
} | ||
for (i = 1; i < path.length; i += 2) { | ||
// Add the links | ||
if (path[i] === transactionId) { | ||
continue | ||
} | ||
addLink(path[i - 1], path[i + 1], path[i]) | ||
} | ||
if (transactionId != null) { | ||
// manually finish transaction link segment | ||
var src = this.cache[path[0]].outgoingTxs[transactionId] | ||
var tgt = this.cache[path[path.length - 1]].incoming[transactionId] | ||
waterfall.addLink(src, tgt) | ||
addLink(path[0], path[path.length - 1], transactionId) | ||
} | ||
waterfall.finishLinks() | ||
@@ -299,0 +343,0 @@ // send to aggregation |
13293
395
Updatedconcurix-waterfall@^1.1.0
Updatedstats-incremental@^1.1.0