Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 4 additions & 20 deletions js-packages/profiler-lib/src/cytograph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import cytoscape, { type EdgeCollection, type EdgeDefinition, type ElementsDefinition, type EventObject, type NodeDefinition, type NodeSingular, type StylesheetJson } from 'cytoscape';
import dblclick from 'cytoscape-dblclick';
import { assert, Graph, OMap, Option, type EncodableAsString, NumericRange, Edge } from './util.js';
import { CircuitProfile, NodeAndMetric, PropertyValue, MissingValue, type NodeId } from './profile.js';
import { CircuitProfile, NodeAndMetric, PropertyValue, type NodeId } from './profile.js';
import { CircuitSelection } from './selection.js';
import elk from 'cytoscape-elk';
import { Sources } from './dataflow.js';
Expand Down Expand Up @@ -677,9 +677,9 @@ export class CytographRendering {
/** Compute the attributes for all cytograph nodes based on the circuit profile and current selection. */
computeAttributes(profile: CircuitProfile, selection: MetadataSelection) {
let workers = selection.workersVisible.getSelectedElements(profile.getWorkerNames());
let columnNames = [...workers.map(w => w.toString())];
columnNames.push("Min");
columnNames.push("Max");
// One column per visible worker. Aggregates such as min/max are not produced here:
// consumers that want them compute them from the per-worker values themselves.
let columnNames = workers.map(w => w.toString());
for (const node of this.currentGraph!.nodes) {
let profileNode = profile.getNode(node.getId()).unwrap();
let data = new Map<string, Array<SerializedMeasurement>>();
Expand All @@ -690,25 +690,9 @@ export class CytographRendering {
let metrics = profileNode.getMeasurements(metric);
let selected = selection.workersVisible.getSelectedElements(metrics);
let measurements: Array<SerializedMeasurement> = [];
let min: PropertyValue = MissingValue.INSTANCE;
let max: PropertyValue = MissingValue.INSTANCE;
for (const m of selected) {
measurements.push(CytographRendering.toMeasurement(m, range));
}
// Compute min and max over all metrics, including the ones not selected
for (const m of metrics) {
if (min instanceof MissingValue ||
(m.getNumericValue().isSome() && min.getNumericValue().unwrap() > m.getNumericValue().unwrap())) {
min = m;
}
if (max instanceof MissingValue ||
(m.getNumericValue().isSome() && max.getNumericValue().unwrap() < m.getNumericValue().unwrap())) {
max = m;
}
}

measurements.push(CytographRendering.toMeasurement(min, range));
measurements.push(CytographRendering.toMeasurement(max, range));
data.set(metric, measurements);
}
// additional key-value per node attributes
Expand Down
Loading