@scope-profiler/plotly 0.1.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/index.d.ts CHANGED
@@ -1,12 +1,383 @@
1
- export interface Figure { data: object[]; layout: object }
2
- export interface PlotlyLike { newPlot(element: Element | string, data: object[], layout: object, config?: object): unknown }
3
- export interface BuildOptions { colors?: Record<string, string>; filterRegion?: (region: string, row: object) => boolean; layout?: object; metric?: string; xField?: string; ideal?: boolean; rootLabel?: string }
4
- export function buildGanttFigure(payload: object, options?: BuildOptions): Figure;
5
- export function buildFlameFigure(payload: object, options?: BuildOptions): Figure;
6
- export function buildDurationsFigure(payload: object, options?: BuildOptions): Figure;
7
- export function buildSpeedupFigure(payload: object, options?: BuildOptions): Figure;
8
- export function buildDurationTimeseriesFigure(payload: object, options?: BuildOptions): Figure;
9
- export function buildHistogramFigure(payload: object, options?: BuildOptions): Figure;
10
- export function buildRankHeatmapFigure(payload: object, options?: BuildOptions & { valueKey?: string; colorscale?: string }): Figure;
11
- export function buildImbalanceFigure(payload: object, options?: BuildOptions): Figure;
12
- export function renderFigure(plotly: PlotlyLike, element: Element | string, figure: Figure, config?: object): unknown;
1
+ export interface PointIdentity {
2
+ region: string | null;
3
+ file: string | null;
4
+ rank: number | null;
5
+ call_id: string | number | null;
6
+ source?: string;
7
+ }
8
+ export interface Diagnostic {
9
+ code: string;
10
+ message: string;
11
+ region?: string;
12
+ source?: string;
13
+ target?: string;
14
+ }
15
+ export interface Figure {
16
+ data: object[];
17
+ layout: object;
18
+ diagnostics?: Diagnostic[];
19
+ }
20
+ export interface PlotlyLike {
21
+ newPlot(
22
+ element: Element | string,
23
+ data: object[],
24
+ layout: object,
25
+ config?: object,
26
+ ): unknown;
27
+ react?(
28
+ element: Element | string,
29
+ data: object[],
30
+ layout: object,
31
+ config?: object,
32
+ ): unknown;
33
+ purge?(element: Element | string): unknown;
34
+ }
35
+ export type ThemeName = "auto" | "light" | "dark";
36
+ export interface ThemeTokens {
37
+ text?: string;
38
+ muted?: string;
39
+ grid?: string;
40
+ hoverBg?: string;
41
+ neutral?: string;
42
+ }
43
+ export interface ResolvedTheme extends ThemeTokens {
44
+ grid: string;
45
+ neutral: string;
46
+ }
47
+ export interface RegionRow {
48
+ region: string;
49
+ file?: string;
50
+ rank?: number;
51
+ }
52
+ export interface Interval extends RegionRow {
53
+ start_seconds: number;
54
+ end_seconds: number;
55
+ call_id?: number | string;
56
+ }
57
+ export type FlameCall = RegionRow & {
58
+ call_id: number | string;
59
+ parent_call_id?: number | string | null;
60
+ start_seconds: number;
61
+ } & (
62
+ | { end_seconds: number; inclusive_duration_seconds?: number }
63
+ | { end_seconds?: number; inclusive_duration_seconds: number }
64
+ );
65
+ export interface DurationBar extends RegionRow {
66
+ metric: string;
67
+ value_seconds: number;
68
+ segment?: string;
69
+ }
70
+ export interface TimeseriesPoint extends RegionRow {
71
+ time_seconds: number;
72
+ mean_duration_seconds: number;
73
+ min_duration_seconds?: number;
74
+ max_duration_seconds?: number;
75
+ call_index?: number;
76
+ }
77
+ export interface HistogramBin extends RegionRow {
78
+ bin_low_seconds: number;
79
+ bin_high_seconds: number;
80
+ bin_center_seconds: number;
81
+ count: number;
82
+ }
83
+ export interface DensityPoint extends RegionRow {
84
+ bin_start_seconds: number;
85
+ bin_end_seconds: number;
86
+ occupied_seconds: number;
87
+ }
88
+ export interface ImbalancePoint extends RegionRow {
89
+ rank: number;
90
+ value_seconds: number;
91
+ mean_over_ranks_seconds: number;
92
+ }
93
+ export interface HeatmapPoint extends RegionRow {
94
+ [metric: string]: string | number | undefined;
95
+ }
96
+ export interface ScalingPoint extends RegionRow {
97
+ num_ranks?: number;
98
+ speedup?: number;
99
+ normalized_runtime?: number;
100
+ efficiency?: number;
101
+ [field: string]: string | number | undefined;
102
+ }
103
+ export interface LikwidBar extends RegionRow {
104
+ series: string;
105
+ value: number;
106
+ }
107
+ export interface RoofPoint extends RegionRow {
108
+ arithmetic_intensity_flops_per_byte: number;
109
+ performance_gflops: number;
110
+ bandwidth_gbs?: number;
111
+ }
112
+ export interface RoofCeiling {
113
+ arithmetic_intensity_flops_per_byte: number;
114
+ performance_gflops: number;
115
+ }
116
+ export interface CallgraphNode {
117
+ name: string;
118
+ depth: number;
119
+ total_duration?: number;
120
+ [metric: string]: string | number | undefined;
121
+ }
122
+ export interface CallgraphCall {
123
+ name: string;
124
+ depth: number;
125
+ call_id: number | string;
126
+ parent_id: number | string | null;
127
+ file?: string;
128
+ rank?: number;
129
+ }
130
+ export interface CallgraphEdge {
131
+ parent: string;
132
+ child: string;
133
+ value?: number;
134
+ total_duration?: number;
135
+ [metric: string]: string | number | undefined;
136
+ }
137
+ export interface RegionStatistics {
138
+ count?: number;
139
+ total_duration_seconds?: number;
140
+ average_duration_seconds?: number;
141
+ min_duration_seconds?: number;
142
+ max_duration_seconds?: number;
143
+ std_duration_seconds?: number;
144
+ first_duration_seconds?: number;
145
+ last_duration_seconds?: number;
146
+ per_rank?: Record<string, RegionStatistics>;
147
+ }
148
+ export interface SummaryFile {
149
+ label?: string;
150
+ region_statistics: Record<string, RegionStatistics>;
151
+ }
152
+ export interface PayloadBase {
153
+ format?: "scope-profiler-plot-data";
154
+ format_version?: number;
155
+ colors?: Record<string, string>;
156
+ }
157
+ export interface GanttPayload extends PayloadBase {
158
+ plot?: "gantt";
159
+ intervals: Interval[];
160
+ }
161
+ export interface FlamePayload extends PayloadBase {
162
+ plot?: "flame" | "flame_chart" | "flame_graph";
163
+ calls: FlameCall[];
164
+ }
165
+ export interface DurationsPayload extends PayloadBase {
166
+ plot?: "durations";
167
+ bars: DurationBar[];
168
+ metrics?: string[];
169
+ options?: { metric?: string };
170
+ }
171
+ export interface TimeseriesPayload extends PayloadBase {
172
+ plot?: "timeseries";
173
+ points: TimeseriesPoint[];
174
+ }
175
+ export interface HistogramPayload extends PayloadBase {
176
+ plot?: "histogram";
177
+ bins: HistogramBin[];
178
+ }
179
+ export interface DensityPayload extends PayloadBase {
180
+ plot?: "density";
181
+ points: DensityPoint[];
182
+ }
183
+ export interface ImbalancePayload extends PayloadBase {
184
+ plot?: "imbalance";
185
+ points: ImbalancePoint[];
186
+ metric?: string;
187
+ }
188
+ export interface HeatmapPayload extends PayloadBase {
189
+ plot?: "rank_heatmap";
190
+ points: HeatmapPoint[];
191
+ }
192
+ export type ScalingKind =
193
+ "speedup" | "weak_scaling" | "scaling_efficiency" | "weak_scaling_efficiency";
194
+ export interface ScalingPayload extends PayloadBase {
195
+ plot?: ScalingKind;
196
+ points: ScalingPoint[];
197
+ options?: { x_field?: string; x_label?: string; baseline?: number };
198
+ }
199
+ export interface LikwidPayload extends PayloadBase {
200
+ plot?: "likwid";
201
+ bars: LikwidBar[];
202
+ metric?: string;
203
+ }
204
+ export interface RooflinePayload extends PayloadBase {
205
+ plot?: "roofline";
206
+ points: RoofPoint[];
207
+ roofline?: RoofCeiling[];
208
+ empirical_ceilings?: boolean;
209
+ }
210
+ export interface SummaryPayload extends PayloadBase {
211
+ plot?: "region_statistics";
212
+ files: SummaryFile[];
213
+ }
214
+ export type CallgraphPayload = PayloadBase & { plot?: "callgraph" } & (
215
+ | { regions: CallgraphNode[]; edges: CallgraphEdge[] }
216
+ | { calls: CallgraphCall[] }
217
+ );
218
+ export interface PayloadByKind {
219
+ gantt: GanttPayload;
220
+ flame: FlamePayload;
221
+ flame_chart: FlamePayload;
222
+ flame_graph: FlamePayload;
223
+ durations: DurationsPayload;
224
+ timeseries: TimeseriesPayload;
225
+ histogram: HistogramPayload;
226
+ density: DensityPayload;
227
+ imbalance: ImbalancePayload;
228
+ rank_heatmap: HeatmapPayload;
229
+ speedup: ScalingPayload;
230
+ weak_scaling: ScalingPayload;
231
+ scaling_efficiency: ScalingPayload;
232
+ weak_scaling_efficiency: ScalingPayload;
233
+ likwid: LikwidPayload;
234
+ roofline: RooflinePayload;
235
+ region_statistics: SummaryPayload;
236
+ callgraph: CallgraphPayload;
237
+ }
238
+ export type PlotKind = keyof PayloadByKind;
239
+ /** Explicit documents narrow on their plot discriminator. */
240
+ export type PlotData = {
241
+ [K in PlotKind]: PayloadByKind[K] & { plot: K };
242
+ }[PlotKind];
243
+ export type LegacyPlotData = PayloadByKind[PlotKind];
244
+ export interface SummaryOptions {
245
+ topN?: number;
246
+ files?: (string | number)[];
247
+ orientation?: "h" | "v";
248
+ commonRegionsOnly?: boolean;
249
+ }
250
+ export interface BuildOptions extends SummaryOptions {
251
+ colors?: Readonly<Record<string, string>>;
252
+ filterRegion?: (region: string, row: object) => boolean;
253
+ /** Nested objects merge; arrays replace. Set uirevision to preserve zoom. */
254
+ layout?: object;
255
+ metric?: string;
256
+ xField?: string;
257
+ yField?: string;
258
+ ideal?: boolean;
259
+ rootLabel?: string;
260
+ plot?: PlotKind;
261
+ theme?: ThemeName | ThemeTokens;
262
+ laneBy?: "rank" | "region";
263
+ valueKey?: string;
264
+ colorscale?: string;
265
+ logScale?: boolean;
266
+ variability?: "none" | "band" | "error";
267
+ comparison?: "side-by-side" | "absolute" | "percent";
268
+ sortBy?: "regression" | "name";
269
+ }
270
+ export function setTheme(theme?: ThemeName | ThemeTokens): void;
271
+ export function resolveTheme(theme?: ThemeName | ThemeTokens): ResolvedTheme;
272
+ export function createColorRegistry(
273
+ names?: Iterable<string>,
274
+ supplied?: Record<string, string>,
275
+ ): Readonly<Record<string, string>>;
276
+ export function createFigureBuilder(
277
+ defaults?: BuildOptions,
278
+ ): (payload: LegacyPlotData, options?: BuildOptions) => Figure;
279
+ export function getPointIdentity(
280
+ point: { customdata?: { identity?: PointIdentity } } | null | undefined,
281
+ ): PointIdentity | null;
282
+ export function buildGanttFigure(
283
+ payload: GanttPayload,
284
+ options?: BuildOptions,
285
+ ): Figure;
286
+ export function buildFlameFigure(
287
+ payload: FlamePayload,
288
+ options?: BuildOptions,
289
+ ): Figure;
290
+ export function buildDurationsFigure(
291
+ payload: DurationsPayload,
292
+ options?: BuildOptions,
293
+ ): Figure;
294
+ export function buildSpeedupFigure(
295
+ payload: ScalingPayload,
296
+ options?: BuildOptions,
297
+ ): Figure;
298
+ export function buildWeakScalingFigure(
299
+ payload: ScalingPayload,
300
+ options?: BuildOptions,
301
+ ): Figure;
302
+ export function buildScalingEfficiencyFigure(
303
+ payload: ScalingPayload,
304
+ options?: BuildOptions,
305
+ ): Figure;
306
+ export function buildWeakScalingEfficiencyFigure(
307
+ payload: ScalingPayload,
308
+ options?: BuildOptions,
309
+ ): Figure;
310
+ export function buildDurationTimeseriesFigure(
311
+ payload: TimeseriesPayload,
312
+ options?: BuildOptions,
313
+ ): Figure;
314
+ export function buildHistogramFigure(
315
+ payload: HistogramPayload,
316
+ options?: BuildOptions,
317
+ ): Figure;
318
+ export function buildRankHeatmapFigure(
319
+ payload: HeatmapPayload,
320
+ options?: BuildOptions,
321
+ ): Figure;
322
+ export function buildDensityFigure(
323
+ payload: DensityPayload,
324
+ options?: BuildOptions,
325
+ ): Figure;
326
+ export function buildImbalanceFigure(
327
+ payload: ImbalancePayload,
328
+ options?: BuildOptions,
329
+ ): Figure;
330
+ export const SUMMARY_METRICS: Readonly<Record<string, string>>;
331
+ export function buildRegionSummaryFigure(
332
+ payload: SummaryPayload,
333
+ options?: BuildOptions,
334
+ ): Figure;
335
+ export function buildComparisonFigure(
336
+ payload: SummaryPayload,
337
+ options?: BuildOptions,
338
+ ): Figure;
339
+ export function buildCallgraphFigure(
340
+ payload: CallgraphPayload,
341
+ options?: BuildOptions,
342
+ ): Figure;
343
+ export function buildLikwidFigure(
344
+ payload: LikwidPayload,
345
+ options?: BuildOptions,
346
+ ): Figure;
347
+ export function buildRooflineFigure(
348
+ payload: RooflinePayload,
349
+ options?: BuildOptions,
350
+ ): Figure;
351
+ export const PLOT_DATA_FORMAT: "scope-profiler-plot-data";
352
+ export const SUPPORTED_FORMAT_VERSION: number;
353
+ export const PLOT_BUILDERS: {
354
+ [K in PlotKind]: (
355
+ payload: PayloadByKind[K],
356
+ options?: BuildOptions,
357
+ ) => Figure;
358
+ };
359
+ export function inferPlotKind(payload: unknown): PlotKind | undefined;
360
+ export function validatePlotData(
361
+ payload: unknown,
362
+ options?: BuildOptions,
363
+ ): PlotKind;
364
+ export function buildFigure(
365
+ payload: LegacyPlotData,
366
+ options?: BuildOptions,
367
+ ): Figure;
368
+ export function renderFigure(
369
+ plotly: PlotlyLike,
370
+ element: Element | string,
371
+ figure: Figure,
372
+ config?: object,
373
+ ): unknown;
374
+ export function updateFigure(
375
+ plotly: PlotlyLike,
376
+ element: Element | string,
377
+ figure: Figure,
378
+ config?: object,
379
+ ): unknown;
380
+ export function disposeFigure(
381
+ plotly: Pick<PlotlyLike, "purge">,
382
+ element: Element | string,
383
+ ): unknown;