Skip to content
Open
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion ui/src/components/aggregation_adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import {Memo} from '../base/memo';
import {assertExists} from '../base/assert';
import {Button, ButtonGroup} from '../widgets/button';
import {SharedAsyncDisposable} from '../base/shared_disposable';
import type {LONG, NUM} from '../trace_processor/query_result';

export interface AggregationData extends AsyncDisposable {
readonly sqlTable: SharedAsyncDisposable<DisposableSqlEntity>;
Expand Down Expand Up @@ -172,7 +173,7 @@ export function selectTracksAndGetDataset<T extends DatasetSchema>(
* @returns A disposable SQL entity representing the new table.
*/
export async function createIITable<
T extends {ts: bigint; dur: bigint; id: number},
T extends {ts: typeof LONG; dur: typeof LONG; id: typeof NUM},
>(
engine: Engine,
dataset: Dataset<T>,
Expand Down
9 changes: 7 additions & 2 deletions ui/src/components/distribution_panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ import {AsyncMemo} from '../base/async_memo';
import {Icons} from '../base/semantic_icons';
import type {Trace} from '../public/trace';
import type {Dataset, DatasetSchema} from '../trace_processor/dataset';
import {NUM, type Row, type SqlValue} from '../trace_processor/query_result';
import {
NUM,
type SpecType,
type Row,
type SqlValue,
} from '../trace_processor/query_result';
import {sqlValueToSqliteString} from '../trace_processor/sql_utils';
import {
createPerfettoTable,
Expand Down Expand Up @@ -617,7 +622,7 @@ function requiredSchema(
},
columns: ReadonlyArray<string>,
): DatasetSchema {
const schema: Record<string, SqlValue> = {};
const schema: SpecType = {};
for (const col of new Set([
...columns,
...(inputs.filter === undefined ? [] : [inputs.filter.col]),
Expand Down
49 changes: 18 additions & 31 deletions ui/src/components/tracks/counter_track.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import m from 'mithril';
import {valueIfAllEqual} from '../../base/array_utils';
import {assertUnreachable} from '../../base/assert';
import {searchSegment} from '../../base/binary_search';
import {deferChunkedTask} from '../../base/chunked_task';
import {HSLColor} from '../../base/color';
import type {Point2D} from '../../base/geom';
import {formatNumber} from '../../base/number_format';
Expand Down Expand Up @@ -45,7 +44,6 @@ import {
import {MenuItem} from '../../widgets/menu';
import {checkerboardExcept} from '../checkerboard';
import {BufferedBounds} from './buffered_bounds';
import {CHUNKED_TASK_BACKGROUND_PRIORITY} from './feature_flags';
import {RangeSharer} from './range_sharer';

export type ChartHeightSize = 1 | 2 | 4 | 8 | 16 | 32;
Expand Down Expand Up @@ -910,46 +908,35 @@ export class CounterTrack implements TrackRenderer {

if (signal.isCancelled) throw TASK_CANCELLED;

const priority = CHUNKED_TASK_BACKGROUND_PRIORITY.get()
? 'background'
: undefined;
const task = await deferChunkedTask({priority});

const it = queryRes.iter({
const cols = queryRes.decodeColumns({
tsRel: NUM,
minDisplayValue: NUM,
maxDisplayValue: NUM,
lastDisplayValue: NUM,
});
const tsRelCol = cols.tsRel;
const minCol = cols.minDisplayValue;
const maxCol = cols.maxDisplayValue;
const lastCol = cols.lastDisplayValue;

const numRows = queryRes.numRows();
const timestampsRel = new Float32Array(numRows);
const timestampsRelNext = new Float32Array(numRows);
const minDisplayValues = new Float32Array(numRows);
const maxDisplayValues = new Float32Array(numRows);
const lastDisplayValues = new Float32Array(numRows);
const timestampsRel = new Float32Array(tsRelCol);
const minDisplayValues = new Float32Array(minCol);
const maxDisplayValues = new Float32Array(maxCol);
const lastDisplayValues = new Float32Array(lastCol);

let min = 0;
let max = 0;

for (let row = 0; it.valid(); it.next(), row++) {
if (signal.isCancelled) throw TASK_CANCELLED;
if (row % 50 === 0 && task.shouldYield()) {
await task.yield();
}

timestampsRel[row] = it.tsRel;
minDisplayValues[row] = it.minDisplayValue;
maxDisplayValues[row] = it.maxDisplayValue;
lastDisplayValues[row] = it.lastDisplayValue;
min = Math.min(min, it.minDisplayValue);
max = Math.max(max, it.maxDisplayValue);

if (row > 0) {
// Fill in the next
timestampsRelNext[row - 1] = it.tsRel;
}
for (let row = 0; row < numRows; row++) {
min = Math.min(min, minCol[row]);
max = Math.max(max, maxCol[row]);
}

// timestampsRelNext[i] = timestampsRel[i+1], last element = end - start.
const timestampsRelNext = new Float32Array(numRows);
if (numRows > 1) {
timestampsRelNext.set(timestampsRel.subarray(1));
}
if (numRows > 0) {
timestampsRelNext[numRows - 1] = Number(end - start);
}
Expand Down
Loading
Loading