Performance improvements, better readme and complete python bindings
🧪 Test / test (push) Failing after 28m30s
🧪 Test / test (push) Failing after 28m30s
This commit is contained in:
@@ -47,7 +47,8 @@ static std::pair<std::string,std::string> parse_edge_name(const std::string& nam
|
||||
static std::string to_json(const std::vector<NodeSnapshot>& nodes,
|
||||
const std::vector<ChannelSnapshot>& channels,
|
||||
const std::vector<ResourceSnapshot>& resources = {},
|
||||
double elapsed_s = 0.0) {
|
||||
double elapsed_s = 0.0,
|
||||
const std::vector<PoolSnapshot>& pools = {}) {
|
||||
std::ostringstream o;
|
||||
o << std::fixed;
|
||||
o.precision(2);
|
||||
@@ -97,6 +98,20 @@ static std::string to_json(const std::vector<NodeSnapshot>& nodes,
|
||||
<< ",\"held\":" << (r.held ? "true" : "false")
|
||||
<< "}";
|
||||
}
|
||||
o << "],\"pools\":[";
|
||||
for (std::size_t i = 0; i < pools.size(); ++i) {
|
||||
const auto& p = pools[i];
|
||||
if (i) o << ',';
|
||||
double in_rate = elapsed_s > 0.0 ? p.tasks_submitted / elapsed_s : 0.0;
|
||||
double out_rate = elapsed_s > 0.0 ? p.tasks_completed / elapsed_s : 0.0;
|
||||
o << "{\"name\":\"" << escape_json(p.name) << "\""
|
||||
<< ",\"thread_count\":" << p.thread_count
|
||||
<< ",\"queue_depth\":" << p.queue_depth
|
||||
<< ",\"active_count\":" << p.active_count
|
||||
<< ",\"in_rate\":" << in_rate
|
||||
<< ",\"out_rate\":" << out_rate
|
||||
<< "}";
|
||||
}
|
||||
o << "]}";
|
||||
return o.str();
|
||||
}
|
||||
@@ -164,7 +179,7 @@ const defs = svg.append('defs');
|
||||
const g = svg.append('g');
|
||||
svg.call(d3.zoom().on('zoom', e => g.attr('transform', e.transform)));
|
||||
|
||||
let sim, linkSel, nodeSel, labelSel, edgeLabelSel;
|
||||
let sim, linkSel, nodeSel, labelSel, edgeLabelSel, edgeLabelBwSel;
|
||||
let nodes = [], links = [];
|
||||
|
||||
function edgeColor(fill_pct) {
|
||||
@@ -211,6 +226,10 @@ function init(data) {
|
||||
.attr('class', 'link-label')
|
||||
.text(d => `${d.fill_pct.toFixed(0)}%`);
|
||||
|
||||
edgeLabelBwSel = g.append('g').selectAll('text').data(links).join('text')
|
||||
.attr('class', 'link-label')
|
||||
.text(d => `${d.bw_mbs.toFixed(1)} MB/s`);
|
||||
|
||||
// Nodes
|
||||
const nodeG = g.append('g').selectAll('g').data(nodes).join('g')
|
||||
.attr('class', 'node')
|
||||
@@ -296,6 +315,7 @@ function update(data) {
|
||||
linkSel.attr('stroke', d => edgeColor(d.fill_pct))
|
||||
.attr('marker-end', d => edgeArrow(d.fill_pct));
|
||||
edgeLabelSel.text(d => `${d.fill_pct.toFixed(0)}%`);
|
||||
edgeLabelBwSel.text(d => `${d.bw_mbs.toFixed(1)} MB/s`);
|
||||
}
|
||||
|
||||
function ticked() {
|
||||
@@ -322,6 +342,10 @@ function ticked() {
|
||||
.attr('x', d => (d.source.x + d.target.x)/2)
|
||||
.attr('y', d => (d.source.y + d.target.y)/2 - 6);
|
||||
|
||||
edgeLabelBwSel
|
||||
.attr('x', d => (d.source.x + d.target.x)/2)
|
||||
.attr('y', d => (d.source.y + d.target.y)/2 + 8);
|
||||
|
||||
nodeSel.attr('transform', d => `translate(${d.x},${d.y})`);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user