Skip to content

Commit c5af872

Browse files
Alexander TiminGerrit Code Review
Alexander Timin
authored and
Gerrit Code Review
committed
Merge "Show flows in a table instead of a tree." into main
2 parents e4330cd + 8b49d69 commit c5af872

File tree

2 files changed

+65
-39
lines changed

2 files changed

+65
-39
lines changed
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
a6600fd33a8d32fb5feb04803bf2532caea7b4844affa407edadd4f467783654
1+
5ad6cc48d5e9147ad52d017a71409a6f8c0f0dc246d98fec4637f1153585841d

ui/src/frontend/thread_slice_details_tab.ts

+64-38
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import m from 'mithril';
1616

1717
import {Icons} from '../base/semantic_icons';
18-
import {duration, Time, TimeSpan} from '../base/time';
18+
import {Time, TimeSpan} from '../base/time';
1919
import {exists} from '../base/utils';
2020
import {raf} from '../core/raf_scheduler';
2121
import {Engine} from '../trace_processor/engine';
@@ -25,11 +25,11 @@ import {DetailsShell} from '../widgets/details_shell';
2525
import {GridLayout, GridLayoutColumn} from '../widgets/grid_layout';
2626
import {MenuItem, PopupMenu2} from '../widgets/menu';
2727
import {Section} from '../widgets/section';
28-
import {Tree, TreeNode} from '../widgets/tree';
28+
import {Tree} from '../widgets/tree';
2929

3030
import {BottomTab, NewBottomTabArgs} from './bottom_tab';
3131
import {addDebugSliceTrack} from './debug_tracks/debug_tracks';
32-
import {FlowPoint, globals} from './globals';
32+
import {Flow, FlowPoint, globals} from './globals';
3333
import {addQueryResultsTab} from './query_result_tab';
3434
import {hasArgs, renderArguments} from './slice_args';
3535
import {renderDetails} from './slice_details';
@@ -43,6 +43,7 @@ import {DurationWidget} from './widgets/duration';
4343
import {addSqlTableTab} from './sql_table_tab';
4444
import {SqlTables} from './widgets/sql/table/well_known_sql_tables';
4545
import {SliceRef} from './widgets/slice';
46+
import {BasicTable} from '../widgets/basic_table';
4647

4748
interface ContextMenuItem {
4849
name: string;
@@ -363,12 +364,35 @@ export class ThreadSliceDetailsTab extends BottomTab<ThreadSliceDetailsTabConfig
363364
return m(
364365
Section,
365366
{title: 'Preceding Flows'},
366-
m(
367-
Tree,
368-
inFlows.map(({begin, dur}) =>
369-
this.renderFlow(begin, dur, !isRunTask),
370-
),
371-
),
367+
m(BasicTable, {
368+
columns: [
369+
{
370+
title: 'Slice',
371+
render: (flow: Flow) =>
372+
m(SliceRef, {
373+
id: asSliceSqlId(flow.begin.sliceId),
374+
name:
375+
flow.begin.sliceChromeCustomName ?? flow.begin.sliceName,
376+
ts: flow.begin.sliceStartTs,
377+
dur: flow.begin.sliceEndTs - flow.begin.sliceStartTs,
378+
sqlTrackId: flow.begin.trackId,
379+
}),
380+
},
381+
{
382+
title: 'Delay',
383+
render: (flow: Flow) =>
384+
m(DurationWidget, {
385+
dur: flow.end.sliceStartTs - flow.begin.sliceEndTs,
386+
}),
387+
},
388+
{
389+
title: 'Thread',
390+
render: (flow: Flow) =>
391+
this.getThreadNameForFlow(flow.begin, !isRunTask),
392+
},
393+
],
394+
data: inFlows,
395+
}),
372396
);
373397
} else {
374398
return null;
@@ -387,45 +411,47 @@ export class ThreadSliceDetailsTab extends BottomTab<ThreadSliceDetailsTabConfig
387411
return m(
388412
Section,
389413
{title: 'Following Flows'},
390-
m(
391-
Tree,
392-
outFlows.map(({end, dur}) => this.renderFlow(end, dur, !isPostTask)),
393-
),
414+
m(BasicTable, {
415+
columns: [
416+
{
417+
title: 'Slice',
418+
render: (flow: Flow) =>
419+
m(SliceRef, {
420+
id: asSliceSqlId(flow.end.sliceId),
421+
name: flow.end.sliceChromeCustomName ?? flow.end.sliceName,
422+
ts: flow.end.sliceStartTs,
423+
dur: flow.end.sliceEndTs - flow.end.sliceStartTs,
424+
sqlTrackId: flow.end.trackId,
425+
}),
426+
},
427+
{
428+
title: 'Delay',
429+
render: (flow: Flow) =>
430+
m(DurationWidget, {
431+
dur: flow.end.sliceEndTs - flow.end.sliceStartTs,
432+
}),
433+
},
434+
{
435+
title: 'Thread',
436+
render: (flow: Flow) =>
437+
this.getThreadNameForFlow(flow.end, !isPostTask),
438+
},
439+
],
440+
data: outFlows,
441+
}),
394442
);
395443
} else {
396444
return null;
397445
}
398446
}
399447

400-
private renderFlow(
448+
private getThreadNameForFlow(
401449
flow: FlowPoint,
402-
dur: duration,
403450
includeProcessName: boolean,
404-
): m.Children {
405-
const description =
406-
flow.sliceChromeCustomName === undefined
407-
? flow.sliceName
408-
: flow.sliceChromeCustomName;
409-
const threadName = includeProcessName
451+
): string {
452+
return includeProcessName
410453
? `${flow.threadName} (${flow.processName})`
411454
: flow.threadName;
412-
413-
return m(
414-
TreeNode,
415-
{left: 'Flow'},
416-
m(TreeNode, {
417-
left: 'Slice',
418-
right: m(SliceRef, {
419-
id: asSliceSqlId(flow.sliceId),
420-
name: description,
421-
ts: flow.sliceStartTs,
422-
dur: flow.sliceEndTs - flow.sliceStartTs,
423-
sqlTrackId: flow.trackId,
424-
}),
425-
}),
426-
m(TreeNode, {left: 'Delay', right: m(DurationWidget, {dur})}),
427-
m(TreeNode, {left: 'Thread', right: threadName}),
428-
);
429455
}
430456

431457
private renderContextButton(sliceInfo: SliceDetails): m.Children {

0 commit comments

Comments
 (0)