ui: Rename queryV2 -> query find ui/src -type f | grep 'ts$' | xargs gsed -i 's/queryV2/query/g' Change-Id: Ie6814e1f4195b9613d2e9f163ed6673c3d15057b
diff --git a/ui/src/common/engine.ts b/ui/src/common/engine.ts index 2d90505..8602089 100644 --- a/ui/src/common/engine.ts +++ b/ui/src/common/engine.ts
@@ -277,7 +277,7 @@ * the rows incrementally. * * Example usage: - * const res = engine.queryV2('SELECT foo, bar FROM table'); + * const res = engine.query('SELECT foo, bar FROM table'); * console.log(res.numRows()); // Will print 0 because we didn't await. * await(res.waitAllRows()); * console.log(res.numRows()); // Will print the total number of rows. @@ -285,10 +285,8 @@ * for (const it = res.iter({foo: NUM, bar:STR}); it.valid(); it.next()) { * console.log(it.foo, it.bar); * } - * TODO(primiano): in next CLs move everything on queryV2, then rename it to - * just query(), and delete the old (columnar, non-streaming) query() method. */ - queryV2(sqlQuery: string): Promise<QueryResult>&QueryResult { + query(sqlQuery: string): Promise<QueryResult>&QueryResult { const rpc = TraceProcessorRpc.create(); rpc.request = TPM.TPM_QUERY_STREAMING; rpc.queryArgs = new QueryArgs(); @@ -319,7 +317,7 @@ async getCpus(): Promise<number[]> { if (!this._cpus) { const cpus = []; - const queryRes = await this.queryV2( + const queryRes = await this.query( 'select distinct(cpu) as cpu from sched order by cpu;'); for (const it = queryRes.iter({cpu: NUM}); it.valid(); it.next()) { cpus.push(it.cpu); @@ -331,7 +329,7 @@ async getNumberOfGpus(): Promise<number> { if (!this._numGpus) { - const result = await this.queryV2(` + const result = await this.query(` select count(distinct(gpu_id)) as gpuCount from gpu_counter_track where name = 'gpufreq'; @@ -344,12 +342,12 @@ // TODO: This should live in code that's more specific to chrome, instead of // in engine. async getNumberOfProcesses(): Promise<number> { - const result = await this.queryV2('select count(*) as cnt from process;'); + const result = await this.query('select count(*) as cnt from process;'); return result.firstRow({cnt: NUM}).cnt; } async getTraceTimeBounds(): Promise<TimeSpan> { - const result = await this.queryV2( + const result = await this.query( `select start_ts as startTs, end_ts as endTs from trace_bounds`); const bounds = result.firstRow({ startTs: NUM, @@ -359,7 +357,7 @@ } async getTracingMetadataTimeBounds(): Promise<TimeSpan> { - const queryRes = await this.queryV2(`select + const queryRes = await this.query(`select name, int_value as intValue from metadata
diff --git a/ui/src/common/queries.ts b/ui/src/common/queries.ts index 55842e3..cd72737 100644 --- a/ui/src/common/queries.ts +++ b/ui/src/common/queries.ts
@@ -31,7 +31,7 @@ export async function runQuery( queryId: string, sqlQuery: string, engine: Engine): Promise<QueryResponse> { const startMs = performance.now(); - const queryRes = engine.queryV2(sqlQuery); + const queryRes = engine.query(sqlQuery); // TODO(primiano): once the controller thread is gone we should pass down // the result objects directly to the frontend, iterate over the result
diff --git a/ui/src/common/query_result.ts b/ui/src/common/query_result.ts index a698a46..e882624 100644 --- a/ui/src/common/query_result.ts +++ b/ui/src/common/query_result.ts
@@ -22,7 +22,7 @@ // The classes in this file are organized as follows: // // QueryResultImpl: -// The object returned by the Engine.queryV2(sql) method. +// The object returned by the Engine.query(sql) method. // This object is a holder of row data. Batches of raw get appended // incrementally as they are received by the remote TraceProcessor instance. // QueryResultImpl also deals with asynchronicity of queries and allows callers @@ -83,7 +83,7 @@ // A RowIterator is a type that has all the fields defined in the query spec // plus the valid() and next() operators. This is to ultimately allow the // clients to do: -// const result = await engine.queryV2("select name, surname, id from people;"); +// const result = await engine.query("select name, surname, id from people;"); // const iter = queryResult.iter({name: STR, surname: STR, id: NUM}); // for (; iter.valid(); iter.next()) // console.log(iter.name, iter.surname); @@ -176,7 +176,7 @@ export interface WritableQueryResult extends QueryResult { // |resBytes| is a proto-encoded trace_processor.QueryResult message. // The overall flow looks as follows: - // - The user calls engine.queryV2('select ...') and gets a QueryResult back. + // - The user calls engine.query('select ...') and gets a QueryResult back. // - The query call posts a message to the worker that runs the SQL engine ( // or sends a HTTP request in case of the RPC+HTTP interface). // - The returned QueryResult object is initially empty.
diff --git a/ui/src/controller/aggregation/aggregation_controller.ts b/ui/src/controller/aggregation/aggregation_controller.ts index f99b5c6..e526f56 100644 --- a/ui/src/controller/aggregation/aggregation_controller.ts +++ b/ui/src/controller/aggregation/aggregation_controller.ts
@@ -118,7 +118,7 @@ sorting = `${pref.sorting.column} ${pref.sorting.direction}`; } const query = `select ${colIds} from ${this.kind} order by ${sorting}`; - const result = await this.args.engine.queryV2(query); + const result = await this.args.engine.query(query); const numRows = result.numRows(); const columns = defs.map(def => this.columnFromColumnDef(def, numRows)); @@ -157,7 +157,7 @@ async getSum(def: ColumnDef): Promise<string> { if (!def.sum) return ''; - const result = await this.args.engine.queryV2( + const result = await this.args.engine.query( `select ifnull(sum(${def.columnId}), 0) as s from ${this.kind}`); let sum = result.firstRow({s: NUM}).s; if (def.kind === 'TIMESTAMP_NS') {
diff --git a/ui/src/controller/aggregation/counter_aggregation_controller.ts b/ui/src/controller/aggregation/counter_aggregation_controller.ts index a24d97b..24d4a94 100644 --- a/ui/src/controller/aggregation/counter_aggregation_controller.ts +++ b/ui/src/controller/aggregation/counter_aggregation_controller.ts
@@ -23,7 +23,7 @@ export class CounterAggregationController extends AggregationController { async createAggregateView(engine: Engine, area: Area) { - await engine.queryV2(`drop view if exists ${this.kind};`); + await engine.query(`drop view if exists ${this.kind};`); const ids = []; for (const trackId of area.tracks) { @@ -67,7 +67,7 @@ on track_id = counter_track.id group by track_id`; - await engine.queryV2(query); + await engine.query(query); return true; }
diff --git a/ui/src/controller/aggregation/cpu_aggregation_controller.ts b/ui/src/controller/aggregation/cpu_aggregation_controller.ts index f2be809..a8b1161 100644 --- a/ui/src/controller/aggregation/cpu_aggregation_controller.ts +++ b/ui/src/controller/aggregation/cpu_aggregation_controller.ts
@@ -24,7 +24,7 @@ export class CpuAggregationController extends AggregationController { async createAggregateView(engine: Engine, area: Area) { - await engine.queryV2(`drop view if exists ${this.kind};`); + await engine.query(`drop view if exists ${this.kind};`); const selectedCpus = []; for (const trackId of area.tracks) { @@ -49,7 +49,7 @@ thread_state.ts + thread_state.dur > ${toNs(area.startSec)} AND thread_state.ts < ${toNs(area.endSec)} group by utid`; - await engine.queryV2(query); + await engine.query(query); return true; }
diff --git a/ui/src/controller/aggregation/cpu_by_process_aggregation_controller.ts b/ui/src/controller/aggregation/cpu_by_process_aggregation_controller.ts index a7f8e0e..baf9efe 100644 --- a/ui/src/controller/aggregation/cpu_by_process_aggregation_controller.ts +++ b/ui/src/controller/aggregation/cpu_by_process_aggregation_controller.ts
@@ -23,7 +23,7 @@ export class CpuByProcessAggregationController extends AggregationController { async createAggregateView(engine: Engine, area: Area) { - await engine.queryV2(`drop view if exists ${this.kind};`); + await engine.query(`drop view if exists ${this.kind};`); const selectedCpus = []; for (const trackId of area.tracks) { @@ -48,7 +48,7 @@ thread_state.ts + thread_state.dur > ${toNs(area.startSec)} AND thread_state.ts < ${toNs(area.endSec)} group by upid`; - await engine.queryV2(query); + await engine.query(query); return true; }
diff --git a/ui/src/controller/aggregation/slice_aggregation_controller.ts b/ui/src/controller/aggregation/slice_aggregation_controller.ts index aba4341..f3b2807 100644 --- a/ui/src/controller/aggregation/slice_aggregation_controller.ts +++ b/ui/src/controller/aggregation/slice_aggregation_controller.ts
@@ -30,7 +30,7 @@ export class SliceAggregationController extends AggregationController { async createAggregateView(engine: Engine, area: Area) { - await engine.queryV2(`drop view if exists ${this.kind};`); + await engine.query(`drop view if exists ${this.kind};`); const selectedTrackIds = []; for (const trackId of area.tracks) { @@ -61,7 +61,7 @@ ts + dur > ${toNs(area.startSec)} AND ts < ${toNs(area.endSec)} group by name`; - await engine.queryV2(query); + await engine.query(query); return true; }
diff --git a/ui/src/controller/aggregation/thread_aggregation_controller.ts b/ui/src/controller/aggregation/thread_aggregation_controller.ts index 51e0444..ff7bd6f 100644 --- a/ui/src/controller/aggregation/thread_aggregation_controller.ts +++ b/ui/src/controller/aggregation/thread_aggregation_controller.ts
@@ -41,7 +41,7 @@ } async createAggregateView(engine: Engine, area: Area) { - await engine.queryV2(`drop view if exists ${this.kind};`); + await engine.query(`drop view if exists ${this.kind};`); this.setThreadStateUtids(area.tracks); if (this.utids === undefined || this.utids.length === 0) return false; @@ -65,7 +65,7 @@ GROUP BY utid, concat_state `; - await engine.queryV2(query); + await engine.query(query); return true; } @@ -81,7 +81,7 @@ toNs(area.startSec)} AND thread_state.ts < ${toNs(area.endSec)} GROUP BY state, io_wait`; - const result = await engine.queryV2(query); + const result = await engine.query(query); const it = result.iter({ state: STR_NULL,
diff --git a/ui/src/controller/cpu_profile_controller.ts b/ui/src/controller/cpu_profile_controller.ts index b048a4d..932fb64 100644 --- a/ui/src/controller/cpu_profile_controller.ts +++ b/ui/src/controller/cpu_profile_controller.ts
@@ -142,7 +142,7 @@ ORDER BY callsites.depth; `; - const callsites = await this.args.engine.queryV2(sampleQuery); + const callsites = await this.args.engine.query(sampleQuery); if (callsites.numRows() === 0) { return undefined;
diff --git a/ui/src/controller/flow_events_controller.ts b/ui/src/controller/flow_events_controller.ts index decd9a9..a5a80cd 100644 --- a/ui/src/controller/flow_events_controller.ts +++ b/ui/src/controller/flow_events_controller.ts
@@ -44,7 +44,7 @@ } queryFlowEvents(query: string, callback: (flows: Flow[]) => void) { - this.args.engine.queryV2(query).then(result => { + this.args.engine.query(query).then(result => { const flows: Flow[] = []; const it = result.iter({ beginSliceId: NUM,
diff --git a/ui/src/controller/heap_profile_controller.ts b/ui/src/controller/heap_profile_controller.ts index f8d11bb..8ec8e34 100644 --- a/ui/src/controller/heap_profile_controller.ts +++ b/ui/src/controller/heap_profile_controller.ts
@@ -58,12 +58,12 @@ // TODO(hjd): This should be LRU. if (this.cache.size > this.cacheSizeLimit) { for (const name of this.cache.values()) { - await this.engine.queryV2(`drop table ${name}`); + await this.engine.query(`drop table ${name}`); } this.cache.clear(); } tableName = `${this.prefix}_${this.tableId++}`; - await this.engine.queryV2( + await this.engine.query( `create temp table if not exists ${tableName} as ${query}`); this.cache.set(query, tableName); } @@ -268,7 +268,7 @@ break; } - const callsites = await this.args.engine.queryV2(` + const callsites = await this.args.engine.query(` SELECT id as hash, IFNULL(DEMANGLE(name), name) as name, @@ -387,7 +387,7 @@ // Collecting data for more information about heap profile, such as: // total memory allocated, memory that is allocated and not freed. - const result = await this.args.engine.queryV2( + const result = await this.args.engine.query( `select pid from process where upid = ${upid}`); const pid = result.firstRow({pid: NUM}).pid; const startTime = fromNs(ts) - globals.state.traceTime.startSec;
diff --git a/ui/src/controller/logs_controller.ts b/ui/src/controller/logs_controller.ts index f6a086f..e87319d 100644 --- a/ui/src/controller/logs_controller.ts +++ b/ui/src/controller/logs_controller.ts
@@ -32,7 +32,7 @@ const vizStartNs = toNsFloor(span.start); const vizEndNs = toNsCeil(span.end); - const countResult = await engine.queryV2(` + const countResult = await engine.query(` select ifnull(min(ts), 0) as minTs, ifnull(max(ts), 0) as maxTs, @@ -45,12 +45,12 @@ const lastRowNs = countRow.maxTs; const total = countRow.countTs; - const minResult = await engine.queryV2(` + const minResult = await engine.query(` select ifnull(max(ts), 0) as maxTs from android_logs where ts < ${ vizStartNs}`); const startNs = minResult.firstRow({maxTs: NUM}).maxTs; - const maxResult = await engine.queryV2(` + const maxResult = await engine.query(` select ifnull(min(ts), 0) as minTs from android_logs where ts > ${ vizEndNs}`); const endNs = maxResult.firstRow({minTs: NUM}).minTs; @@ -76,7 +76,7 @@ const vizEndNs = toNsCeil(span.end); const vizSqlBounds = `ts >= ${vizStartNs} and ts <= ${vizEndNs}`; - const rowsResult = await engine.queryV2(` + const rowsResult = await engine.query(` select ts, prio, @@ -180,7 +180,7 @@ } async hasAnyLogs() { - const result = await this.engine.queryV2(` + const result = await this.engine.query(` select count(*) as cnt from android_logs `); return result.firstRow({cnt: NUM}).cnt > 0;
diff --git a/ui/src/controller/metrics_controller.ts b/ui/src/controller/metrics_controller.ts index 458f650..21ca500 100644 --- a/ui/src/controller/metrics_controller.ts +++ b/ui/src/controller/metrics_controller.ts
@@ -34,7 +34,7 @@ private async getMetricNames() { const metrics = []; - const result = await this.engine.queryV2('select name from trace_metrics'); + const result = await this.engine.query('select name from trace_metrics'); const it = result.iter({name: STR}); for (; it.valid(); it.next()) { metrics.push(it.name);
diff --git a/ui/src/controller/search_controller.ts b/ui/src/controller/search_controller.ts index cca107a..3ec461f 100644 --- a/ui/src/controller/search_controller.ts +++ b/ui/src/controller/search_controller.ts
@@ -60,11 +60,11 @@ } private async setup() { - await this.queryV2(`create virtual table search_summary_window + await this.query(`create virtual table search_summary_window using window;`); - await this.queryV2(`create virtual table search_summary_sched_span using + await this.query(`create virtual table search_summary_sched_span using span_join(sched PARTITIONED cpu, search_summary_window);`); - await this.queryV2(`create virtual table search_summary_slice_span using + await this.query(`create virtual table search_summary_slice_span using span_join(slice PARTITIONED track_id, search_summary_window);`); } @@ -153,13 +153,13 @@ startNs = Math.floor(startNs / quantumNs) * quantumNs; const windowDur = Math.max(endNs - startNs, 1); - await this.queryV2(`update search_summary_window set + await this.query(`update search_summary_window set window_start=${startNs}, window_dur=${windowDur}, quantum=${quantumNs} where rowid = 0;`); - const utidRes = await this.queryV2(`select utid from thread join process + const utidRes = await this.query(`select utid from thread join process using(upid) where thread.name like ${searchLiteral} or process.name like ${searchLiteral}`); @@ -171,7 +171,7 @@ const cpus = await this.engine.getCpus(); const maxCpu = Math.max(...cpus, -1); - const res = await this.queryV2(` + const res = await this.query(` select (quantum_ts * ${quantumNs} + ${startNs})/1e9 as tsStart, ((quantum_ts+1) * ${quantumNs} + ${startNs})/1e9 as tsEnd, @@ -231,7 +231,7 @@ } } - const utidRes = await this.queryV2(`select utid from thread join process + const utidRes = await this.query(`select utid from thread join process using(upid) where thread.name like ${searchLiteral} or process.name like ${searchLiteral}`); @@ -240,7 +240,7 @@ utids.push(it.utid); } - const queryRes = await this.queryV2(` + const queryRes = await this.query(` select id as sliceId, ts, @@ -303,8 +303,8 @@ return searchResults; } - private async queryV2(query: string) { - const result = await this.engine.queryV2(query); + private async query(query: string) { + const result = await this.engine.query(query); return result; } }
diff --git a/ui/src/controller/selection_controller.ts b/ui/src/controller/selection_controller.ts index 132237f..cab23b1 100644 --- a/ui/src/controller/selection_controller.ts +++ b/ui/src/controller/selection_controller.ts
@@ -106,7 +106,7 @@ promisedDescription = Promise.resolve(new Map()); promisedArgs = Promise.resolve(new Map()); } else { - const result = await this.args.engine.queryV2(` + const result = await this.args.engine.query(` SELECT type as leafTable, arg_set_id as argSetId @@ -127,7 +127,7 @@ promisedArgs = this.getArgs(argSetId); } - const promisedDetails = this.args.engine.queryV2(` + const promisedDetails = this.args.engine.query(` SELECT * FROM ${leafTable} WHERE id = ${selectedId}; `); @@ -197,7 +197,7 @@ from describe_slice where slice_id = ${id} `; - const result = await this.args.engine.queryV2(query); + const result = await this.args.engine.query(query); const it = result.iter({description: STR, docLink: STR}); for (; it.valid(); it.next()) { const description = it.description; @@ -217,7 +217,7 @@ FROM args WHERE arg_set_id = ${argId} `; - const result = await this.args.engine.queryV2(query); + const result = await this.args.engine.query(query); const it = result.iter({ name: STR, value: STR, @@ -240,7 +240,7 @@ async getDestTrackId(sliceId: string): Promise<string> { const trackIdQuery = `select track_id as trackId from slice where slice_id = ${sliceId}`; - const result = await this.args.engine.queryV2(trackIdQuery); + const result = await this.args.engine.query(trackIdQuery); const trackIdTp = result.firstRow({trackId: NUM}).trackId; // TODO(hjd): If we had a consistent mapping from TP track_id // UI track id for slice tracks this would be unnecessary. @@ -269,7 +269,7 @@ from thread_state left join sched using(ts) where thread_state.id = ${id} `; - const result = await this.args.engine.queryV2(query); + const result = await this.args.engine.query(query); const selection = globals.state.currentSelection; if (result.numRows() > 0 && selection) { @@ -310,7 +310,7 @@ thread_state.id as threadStateId FROM sched join thread_state using(ts, utid, dur, cpu) WHERE sched.id = ${id}`; - const result = await this.args.engine.queryV2(sqlQuery); + const result = await this.args.engine.query(sqlQuery); // Check selection is still the same on completion of query. const selection = globals.state.currentSelection; if (result.numRows() > 0 && selection) { @@ -352,7 +352,7 @@ } async counterDetails(ts: number, rightTs: number, id: number) { - const counter = await this.args.engine.queryV2( + const counter = await this.args.engine.query( `SELECT value, track_id as trackId FROM counter WHERE id = ${id}`); const row = counter.iter({ value: NUM, @@ -362,7 +362,7 @@ const trackId = row.trackId; // Finding previous value. If there isn't previous one, it will return 0 for // ts and value. - const previous = await this.args.engine.queryV2(`SELECT + const previous = await this.args.engine.query(`SELECT MAX(ts), IFNULL(value, 0) as value FROM counter WHERE ts < ${ts} and track_id = ${trackId}`); @@ -377,9 +377,9 @@ async schedulingDetails(ts: number, utid: number|Long) { let event = 'sched_waking'; - const waking = await this.args.engine.queryV2( + const waking = await this.args.engine.query( `select * from instants where name = 'sched_waking' limit 1`); - const wakeup = await this.args.engine.queryV2( + const wakeup = await this.args.engine.query( `select * from instants where name = 'sched_wakeup' limit 1`); if (waking.numRows() === 0) { if (wakeup.numRows() === 0) return undefined; @@ -390,7 +390,7 @@ // Find the ts of the first sched_wakeup before the current slice. const queryWakeupTs = `select ts from instants where name = '${event}' and ref = ${utid} and ts < ${ts} order by ts desc limit 1`; - const wakeResult = await this.args.engine.queryV2(queryWakeupTs); + const wakeResult = await this.args.engine.query(queryWakeupTs); if (wakeResult.numRows() === 0) { return undefined; } @@ -399,7 +399,7 @@ // Find the previous sched slice for the current utid. const queryPrevSched = `select ts from sched where utid = ${utid} and ts < ${ts} order by ts desc limit 1`; - const prevSchedResult = await this.args.engine.queryV2(queryPrevSched); + const prevSchedResult = await this.args.engine.query(queryPrevSched); // If this is the first sched slice for this utid or if the wakeup found // was after the previous slice then we know the wakeup was for this slice. @@ -412,7 +412,7 @@ const queryWaker = `select utid, cpu from sched where utid = (select utid from raw where name = '${event}' and ts = ${wakeupTs}) and ts < ${wakeupTs} and ts + dur >= ${wakeupTs};`; - const wakerResult = await this.args.engine.queryV2(queryWaker); + const wakerResult = await this.args.engine.query(queryWaker); if (wakerResult.numRows() === 0) { return undefined; }
diff --git a/ui/src/controller/trace_controller.ts b/ui/src/controller/trace_controller.ts index c80d02b..70caac7 100644 --- a/ui/src/controller/trace_controller.ts +++ b/ui/src/controller/trace_controller.ts
@@ -381,7 +381,7 @@ // of the limit 1, and instead delegate the filtering to the iterator. const query = `select '_' as _ from raw where cpu + 1 > 1 or utid + 1 > 1 limit 1`; - const result = await assertExists(this.engine).queryV2(query); + const result = await assertExists(this.engine).query(query); const hasFtrace = result.numRows() > 0; publishHasFtrace(hasFtrace); } @@ -400,7 +400,7 @@ union select distinct(graph_sample_ts) as ts, 'graph' as type, upid from heap_graph_object) order by ts limit 1`; - const profile = await assertExists(this.engine).queryV2(query); + const profile = await assertExists(this.engine).query(query); if (profile.numRows() !== 1) return; const row = profile.firstRow({ts: NUM, type: STR, upid: NUM}); const ts = row.ts; @@ -430,7 +430,7 @@ from (select * from thread order by upid) as thread left join (select * from process order by upid) as process using(upid)`; - const result = await assertExists(this.engine).queryV2(query); + const result = await assertExists(this.engine).query(query); const threads: ThreadDesc[] = []; const it = result.iter({ utid: NUM, @@ -467,7 +467,7 @@ const endNs = toNsCeil(endSec); // Sched overview. - const schedResult = await engine.queryV2( + const schedResult = await engine.query( `select sum(dur)/${stepSec}/1e9 as load, cpu from sched ` + `where ts >= ${startNs} and ts < ${endNs} and utid != 0 ` + 'group by cpu order by cpu'); @@ -489,7 +489,7 @@ // Slices overview. const traceStartNs = toNs(traceTime.start); const stepSecNs = toNs(stepSec); - const sliceResult = await engine.queryV2(`select + const sliceResult = await engine.query(`select bucket, upid, sum(utid_sum) / cast(${stepSecNs} as float) as load @@ -528,7 +528,7 @@ private async cacheCurrentTrace() { const engine = assertExists(this.engine); - const result = await engine.queryV2(`select str_value as uuid from metadata + const result = await engine.query(`select str_value as uuid from metadata where name = 'trace_uuid'`); if (result.numRows() === 0) { throw new Error('metadata.trace_uuid could not be found.'); @@ -545,7 +545,7 @@ this.updateStatus('Creating annotation counter track table'); // Create the helper tables for all the annotations related data. // NULL in min/max means "figure it out per track in the usual way". - await engine.queryV2(` + await engine.query(` CREATE TABLE annotation_counter_track( id INTEGER PRIMARY KEY, name STRING, @@ -556,7 +556,7 @@ ); `); this.updateStatus('Creating annotation slice track table'); - await engine.queryV2(` + await engine.query(` CREATE TABLE annotation_slice_track( id INTEGER PRIMARY KEY, name STRING, @@ -566,7 +566,7 @@ `); this.updateStatus('Creating annotation counter table'); - await engine.queryV2(` + await engine.query(` CREATE TABLE annotation_counter( id BIG INT, track_id INT, @@ -576,7 +576,7 @@ ) WITHOUT ROWID; `); this.updateStatus('Creating annotation slice table'); - await engine.queryV2(` + await engine.query(` CREATE TABLE annotation_slice( id INTEGER PRIMARY KEY, track_id INT, @@ -612,8 +612,7 @@ this.updateStatus(`Inserting data for ${metric} metric`); try { - const result = - await engine.queryV2(`pragma table_info(${metric}_event)`); + const result = await engine.query(`pragma table_info(${metric}_event)`); let hasSliceName = false; let hasDur = false; let hasUpid = false; @@ -630,7 +629,7 @@ const upidColumnSelect = hasUpid ? 'upid' : '0 AS upid'; const upidColumnWhere = hasUpid ? 'upid' : '0'; if (hasSliceName && hasDur) { - await engine.queryV2(` + await engine.query(` INSERT INTO annotation_slice_track(name, __metric_name, upid) SELECT DISTINCT track_name, @@ -639,7 +638,7 @@ FROM ${metric}_event WHERE track_type = 'slice' `); - await engine.queryV2(` + await engine.query(` INSERT INTO annotation_slice(track_id, ts, dur, depth, cat, name) SELECT t.id AS track_id, @@ -656,14 +655,14 @@ } if (hasValue) { - const minMax = await engine.queryV2(` + const minMax = await engine.query(` SELECT IFNULL(MIN(value), 0) as minValue, IFNULL(MAX(value), 0) as maxValue FROM ${metric}_event WHERE ${upidColumnWhere} != 0`); const row = minMax.firstRow({minValue: NUM, maxValue: NUM}); - await engine.queryV2(` + await engine.query(` INSERT INTO annotation_counter_track( name, __metric_name, min_value, max_value, upid) SELECT DISTINCT @@ -675,7 +674,7 @@ FROM ${metric}_event WHERE track_type = 'counter' `); - await engine.queryV2(` + await engine.query(` INSERT INTO annotation_counter(id, track_id, ts, value) SELECT -1 as id,
diff --git a/ui/src/controller/trace_error_controller.ts b/ui/src/controller/trace_error_controller.ts index d921642..6b6f461 100644 --- a/ui/src/controller/trace_error_controller.ts +++ b/ui/src/controller/trace_error_controller.ts
@@ -35,7 +35,7 @@ this.hasRun = true; const engine = this.args.engine; engine - .queryV2( + .query( `SELECT sum(value) as sumValue FROM stats WHERE severity != 'info'`) .then(result => { const errors = result.firstRow({sumValue: NUM}).sumValue;
diff --git a/ui/src/controller/track_controller.ts b/ui/src/controller/track_controller.ts index 5d34102..fd6aae6 100644 --- a/ui/src/controller/track_controller.ts +++ b/ui/src/controller/track_controller.ts
@@ -114,8 +114,8 @@ return resolution >= 0.0008; } - protected async queryV2(query: string) { - const result = await this.engine.queryV2(query); + protected async query(query: string) { + const result = await this.engine.query(query); return result; }
diff --git a/ui/src/controller/track_decider.ts b/ui/src/controller/track_decider.ts index 0ab3f21..1c738ea 100644 --- a/ui/src/controller/track_decider.ts +++ b/ui/src/controller/track_decider.ts
@@ -147,7 +147,7 @@ async addCpuFreqTracks(): Promise<void> { const cpus = await this.engine.getCpus(); - const maxCpuFreqResult = await this.engine.queryV2(` + const maxCpuFreqResult = await this.engine.query(` select ifnull(max(value), 0) as freq from counter c inner join cpu_counter_track t on c.track_id = t.id @@ -160,7 +160,7 @@ // cpu freq data. // TODO(hjd): Find a way to display cpu idle // events even if there are no cpu freq events. - const cpuFreqIdleResult = await this.engine.queryV2(` + const cpuFreqIdleResult = await this.engine.query(` select id as cpuFreqId, ( @@ -201,7 +201,7 @@ } async addGlobalAsyncTracks(): Promise<void> { - const rawGlobalAsyncTracks = await this.engine.queryV2(` + const rawGlobalAsyncTracks = await this.engine.query(` SELECT t.name as name, t.track_ids as trackIds, @@ -245,7 +245,7 @@ async addGpuFreqTracks(): Promise<void> { const numGpus = await this.engine.getNumberOfGpus(); - const maxGpuFreqResult = await this.engine.queryV2(` + const maxGpuFreqResult = await this.engine.query(` select ifnull(max(value), 0) as maximumValue from counter c inner join gpu_counter_track t on c.track_id = t.id @@ -257,7 +257,7 @@ for (let gpu = 0; gpu < numGpus; gpu++) { // Only add a gpu freq track if we have // gpu freq data. - const freqExistsResult = await this.engine.queryV2(` + const freqExistsResult = await this.engine.query(` select id from gpu_counter_track where name = 'gpufreq' and gpu_id = ${gpu} @@ -282,7 +282,7 @@ async addGlobalCounterTracks(): Promise<void> { // Add global or GPU counter tracks that are not bound to any pid/tid. - const globalCounters = await this.engine.queryV2(` + const globalCounters = await this.engine.query(` select name, id from ( select name, id @@ -325,7 +325,7 @@ // it. This might look surprising in the UI, but placeholder tracks are // wasteful as there's no way of collapsing global counter tracks at the // moment. - const result = await this.engine.queryV2(` + const result = await this.engine.query(` select printf("Cpu %u %s", cpu, name) as name, id from perf_counter_track as pct order by perf_session_id asc, pct.name asc, cpu asc @@ -399,7 +399,7 @@ async addLogsTrack(): Promise<void> { const result = - await this.engine.queryV2(`select count(1) as cnt from android_logs`); + await this.engine.query(`select count(1) as cnt from android_logs`); const count = result.firstRow({cnt: NUM}).cnt; if (count > 0) { @@ -415,7 +415,7 @@ } async addAnnotationTracks(): Promise<void> { - const sliceResult = await this.engine.queryV2(` + const sliceResult = await this.engine.query(` SELECT id, name, upid FROM annotation_slice_track`); const sliceIt = sliceResult.iter({ @@ -443,7 +443,7 @@ }); } - const counterResult = await this.engine.queryV2(` + const counterResult = await this.engine.query(` SELECT id, name, @@ -487,7 +487,7 @@ } async addThreadStateTracks(): Promise<void> { - const result = await this.engine.queryV2(` + const result = await this.engine.query(` select utid, tid, @@ -535,7 +535,7 @@ } async addThreadCpuSampleTracks(): Promise<void> { - const result = await this.engine.queryV2(` + const result = await this.engine.query(` select utid, tid, @@ -574,7 +574,7 @@ } async addThreadCounterTracks(): Promise<void> { - const result = await this.engine.queryV2(` + const result = await this.engine.query(` select thread_counter_track.name as trackName, utid, @@ -625,7 +625,7 @@ } async addProcessAsyncSliceTracks(): Promise<void> { - const result = await this.engine.queryV2(` + const result = await this.engine.query(` select process_track.upid as upid, process_track.name as trackName, @@ -660,7 +660,7 @@ const uuid = this.getUuid(0, upid); // TODO(hjd): 1+N queries are bad in the track_decider - const depthResult = await this.engine.queryV2(` + const depthResult = await this.engine.query(` SELECT IFNULL(MAX(layout_depth), 0) as depth FROM experimental_slice_layout('${rawTrackIds}'); `); @@ -684,7 +684,7 @@ } async addActualFramesTracks(): Promise<void> { - const result = await this.engine.queryV2(` + const result = await this.engine.query(` select upid, trackName, @@ -722,7 +722,7 @@ const uuid = this.getUuid(0, upid); // TODO(hjd): 1+N queries are bad in the track_decider - const depthResult = await this.engine.queryV2(` + const depthResult = await this.engine.query(` SELECT IFNULL(MAX(layout_depth), 0) as depth FROM experimental_slice_layout('${rawTrackIds}'); `); @@ -746,7 +746,7 @@ } async addExpectedFramesTracks(): Promise<void> { - const result = await this.engine.queryV2(` + const result = await this.engine.query(` select upid, trackName, @@ -785,7 +785,7 @@ const uuid = this.getUuid(0, upid); // TODO(hjd): 1+N queries are bad in the track_decider - const depthResult = await this.engine.queryV2(` + const depthResult = await this.engine.query(` SELECT IFNULL(MAX(layout_depth), 0) as depth FROM experimental_slice_layout('${rawTrackIds}'); `); @@ -809,7 +809,7 @@ } async addThreadSliceTracks(): Promise<void> { - const result = await this.engine.queryV2(` + const result = await this.engine.query(` select thread_track.utid as utid, thread_track.id as trackId, @@ -869,7 +869,7 @@ } async addProcessCounterTracks(): Promise<void> { - const result = await this.engine.queryV2(` + const result = await this.engine.query(` select process_counter_track.id as trackId, process_counter_track.name as trackName, @@ -919,7 +919,7 @@ } async addProcessHeapProfileTracks(): Promise<void> { - const result = await this.engine.queryV2(` + const result = await this.engine.query(` select distinct(upid) from heap_profile_allocation union select distinct(upid) from heap_graph_object @@ -970,7 +970,7 @@ // total cpu time *for the whole parent process* // upid // utid - const result = await this.engine.queryV2(` + const result = await this.engine.query(` select the_tracks.upid, the_tracks.utid,
diff --git a/ui/src/tracks/actual_frames/controller.ts b/ui/src/tracks/actual_frames/controller.ts index 1105a69..4920c2f 100644 --- a/ui/src/tracks/actual_frames/controller.ts +++ b/ui/src/tracks/actual_frames/controller.ts
@@ -44,7 +44,7 @@ const bucketNs = Math.max(Math.round(resolution * 1e9 * pxSize / 2) * 2, 1); if (this.maxDurNs === 0) { - const maxDurResult = await this.queryV2(` + const maxDurResult = await this.query(` select max(iif(dur = -1, (SELECT end_ts FROM trace_bounds) - ts, dur)) as maxDur @@ -54,7 +54,7 @@ this.maxDurNs = maxDurResult.firstRow({maxDur: NUM_NULL}).maxDur || 0; } - const rawResult = await this.queryV2(` + const rawResult = await this.query(` SELECT (s.ts + ${bucketNs / 2}) / ${bucketNs} * ${bucketNs} as tsq, s.ts as ts,
diff --git a/ui/src/tracks/android_log/controller.ts b/ui/src/tracks/android_log/controller.ts index 3536b7c..b1ca9d2 100644 --- a/ui/src/tracks/android_log/controller.ts +++ b/ui/src/tracks/android_log/controller.ts
@@ -33,7 +33,7 @@ // |resolution| is in s/px the frontend wants. const quantNs = toNsCeil(resolution); - const queryRes = await this.queryV2(` + const queryRes = await this.query(` select cast(ts / ${quantNs} as integer) * ${quantNs} as tsQuant, prio,
diff --git a/ui/src/tracks/async_slices/controller.ts b/ui/src/tracks/async_slices/controller.ts index b30032c..fa81905 100644 --- a/ui/src/tracks/async_slices/controller.ts +++ b/ui/src/tracks/async_slices/controller.ts
@@ -37,7 +37,7 @@ const bucketNs = Math.max(Math.round(resolution * 1e9 * pxSize / 2) * 2, 1); if (this.maxDurNs === 0) { - const maxDurResult = await this.queryV2(` + const maxDurResult = await this.query(` select max(iif(dur = -1, (SELECT end_ts FROM trace_bounds) - ts, dur)) as maxDur from experimental_slice_layout where filter_track_ids = '${this.config.trackIds.join(',')}' @@ -45,7 +45,7 @@ this.maxDurNs = maxDurResult.firstRow({maxDur: NUM_NULL}).maxDur || 0; } - const queryRes = await this.queryV2(` + const queryRes = await this.query(` SELECT (ts + ${bucketNs / 2}) / ${bucketNs} * ${bucketNs} as tsq, ts,
diff --git a/ui/src/tracks/chrome_slices/controller.ts b/ui/src/tracks/chrome_slices/controller.ts index 0d84917..f0b4a63 100644 --- a/ui/src/tracks/chrome_slices/controller.ts +++ b/ui/src/tracks/chrome_slices/controller.ts
@@ -49,7 +49,7 @@ const query = ` SELECT max(iif(dur = -1, (SELECT end_ts FROM trace_bounds) - ts, dur)) AS maxDur FROM ${tableName} WHERE track_id = ${this.config.trackId}`; - const queryRes = await this.queryV2(query); + const queryRes = await this.query(query); this.maxDurNs = queryRes.firstRow({maxDur: NUM_NULL}).maxDur || 0; } @@ -69,7 +69,7 @@ ts >= (${startNs - this.maxDurNs}) AND ts <= ${endNs} GROUP BY depth, tsq`; - const queryRes = await this.queryV2(query); + const queryRes = await this.query(query); const numRows = queryRes.numRows(); const slices: Data = {
diff --git a/ui/src/tracks/counter/controller.ts b/ui/src/tracks/counter/controller.ts index 6a91c28..016a9e7 100644 --- a/ui/src/tracks/counter/controller.ts +++ b/ui/src/tracks/counter/controller.ts
@@ -47,7 +47,7 @@ if (!this.setup) { if (this.config.namespace === undefined) { - await this.queryV2(` + await this.query(` create view ${this.tableName('counter_view')} as select id, @@ -59,7 +59,7 @@ where track_id = ${this.config.trackId}; `); } else { - await this.queryV2(` + await this.query(` create view ${this.tableName('counter_view')} as select id, @@ -72,7 +72,7 @@ `); } - const maxDurResult = await this.queryV2(` + const maxDurResult = await this.query(` select max( iif(dur != -1, dur, (select end_ts from trace_bounds) - ts) @@ -81,7 +81,7 @@ `); this.maxDurNs = maxDurResult.firstRow({maxDur: NUM_NULL}).maxDur || 0; - const queryRes = await this.queryV2(` + const queryRes = await this.query(` select ifnull(max(value), 0) as maxValue, ifnull(min(value), 0) as minValue, @@ -98,7 +98,7 @@ this.setup = true; } - const queryRes = await this.queryV2(` + const queryRes = await this.query(` select (ts + ${bucketNs / 2}) / ${bucketNs} * ${bucketNs} as tsq, min(value) as minValue,
diff --git a/ui/src/tracks/cpu_freq/controller.ts b/ui/src/tracks/cpu_freq/controller.ts index d1dc7d8..d5a29de 100644 --- a/ui/src/tracks/cpu_freq/controller.ts +++ b/ui/src/tracks/cpu_freq/controller.ts
@@ -40,7 +40,7 @@ this.maximumValueSeen = await this.queryMaxFrequency(); this.maxDurNs = await this.queryMaxSourceDur(); - const iter = (await this.queryV2(` + const iter = (await this.query(` select max(ts) as maxTs, dur, count(1) as rowCount from ${this.tableName('freq_idle')} `)).firstRow({maxTs: NUM_NULL, dur: NUM_NULL, rowCount: NUM}); @@ -58,7 +58,7 @@ return; } - await this.queryV2(` + await this.query(` create table ${this.tableName('freq_idle_cached')} as select (ts + ${bucketNs / 2}) / ${bucketNs} * ${bucketNs} as cachedTsq, @@ -129,7 +129,7 @@ const isCached = this.cachedBucketNs <= bucketNs; if (isCached) { - return this.queryV2(` + return this.query(` select cachedTsq / ${bucketNs} * ${bucketNs} as tsq, min(minFreq) as minFreq, @@ -144,14 +144,14 @@ order by tsq `); } - const minTsFreq = await this.queryV2(` + const minTsFreq = await this.query(` select ifnull(max(ts), 0) as minTs from ${this.tableName('freq')} where ts < ${startNs} `); let minTs = minTsFreq.iter({minTs: NUM}).minTs; if (this.config.idleTrackId !== undefined) { - const minTsIdle = await this.queryV2(` + const minTsIdle = await this.query(` select ifnull(max(ts), 0) as minTs from ${this.tableName('idle')} where ts < ${startNs} `); @@ -161,7 +161,7 @@ const geqConstraint = this.config.idleTrackId === undefined ? `ts >= ${minTs}` : `source_geq(ts, ${minTs})`; - return this.queryV2(` + return this.query(` select (ts + ${bucketNs / 2}) / ${bucketNs} * ${bucketNs} as tsq, min(freqValue) as minFreq, @@ -178,7 +178,7 @@ } private async queryMaxFrequency(): Promise<number> { - const result = await this.queryV2(` + const result = await this.query(` select max(freqValue) as maxFreq from ${this.tableName('freq')} `); @@ -186,20 +186,20 @@ } private async queryMaxSourceDur(): Promise<number> { - const maxDurFreqResult = await this.queryV2( + const maxDurFreqResult = await this.query( `select ifnull(max(dur), 0) as maxDur from ${this.tableName('freq')}`); const maxDurNs = maxDurFreqResult.firstRow({'maxDur': NUM}).maxDur; if (this.config.idleTrackId === undefined) { return maxDurNs; } - const maxDurIdleResult = await this.queryV2( + const maxDurIdleResult = await this.query( `select ifnull(max(dur), 0) as maxDur from ${this.tableName('idle')}`); return Math.max(maxDurNs, maxDurIdleResult.firstRow({maxDur: NUM}).maxDur); } private async createFreqIdleViews() { - await this.queryV2(`create view ${this.tableName('freq')} as + await this.query(`create view ${this.tableName('freq')} as select ts, dur, @@ -209,7 +209,7 @@ `); if (this.config.idleTrackId === undefined) { - await this.queryV2(`create view ${this.tableName('freq_idle')} as + await this.query(`create view ${this.tableName('freq_idle')} as select ts, dur, @@ -220,7 +220,7 @@ return; } - await this.queryV2(` + await this.query(` create view ${this.tableName('idle')} as select ts, @@ -230,7 +230,7 @@ where track_id = ${this.config.idleTrackId}; `); - await this.queryV2(` + await this.query(` create virtual table ${this.tableName('freq_idle')} using span_join(${this.tableName('freq')}, ${this.tableName('idle')}); `);
diff --git a/ui/src/tracks/cpu_profile/controller.ts b/ui/src/tracks/cpu_profile/controller.ts index 375b169..4e68e5f 100644 --- a/ui/src/tracks/cpu_profile/controller.ts +++ b/ui/src/tracks/cpu_profile/controller.ts
@@ -36,7 +36,7 @@ where utid = ${this.config.utid} order by ts`; - const result = await this.queryV2(query); + const result = await this.query(query); const numRows = result.numRows(); const data: Data = { start,
diff --git a/ui/src/tracks/cpu_slices/controller.ts b/ui/src/tracks/cpu_slices/controller.ts index 4fc4fd7..9dc89bf 100644 --- a/ui/src/tracks/cpu_slices/controller.ts +++ b/ui/src/tracks/cpu_slices/controller.ts
@@ -29,7 +29,7 @@ private maxDurNs = 0; async onSetup() { - await this.queryV2(` + await this.query(` create view ${this.tableName('sched')} as select ts, @@ -40,7 +40,7 @@ where cpu = ${this.config.cpu} and utid != 0 `); - const queryRes = await this.queryV2(` + const queryRes = await this.query(` select ifnull(max(dur), 0) as maxDur, count(1) as rowCount from ${this.tableName('sched')} `); @@ -51,7 +51,7 @@ if (bucketNs === undefined) { return; } - await this.queryV2(` + await this.query(` create table ${this.tableName('sched_cached')} as select (ts + ${bucketNs / 2}) / ${bucketNs} * ${bucketNs} as cached_tsq, @@ -90,7 +90,7 @@ isCached ? this.tableName('sched_cached') : this.tableName('sched'); const constraintColumn = isCached ? 'cached_tsq' : 'ts'; - const queryRes = await this.queryV2(` + const queryRes = await this.query(` select ${queryTsq} as tsq, ts, @@ -137,8 +137,7 @@ } async onDestroy() { - await this.queryV2( - `drop table if exists ${this.tableName('sched_cached')}`); + await this.query(`drop table if exists ${this.tableName('sched_cached')}`); } }
diff --git a/ui/src/tracks/debug_slices/controller.ts b/ui/src/tracks/debug_slices/controller.ts index 2bf2ffb..0b761a3 100644 --- a/ui/src/tracks/debug_slices/controller.ts +++ b/ui/src/tracks/debug_slices/controller.ts
@@ -27,7 +27,7 @@ static readonly kind = DEBUG_SLICE_TRACK_KIND; async onReload() { - const rawResult = await this.queryV2( + const rawResult = await this.query( `select ifnull(max(depth), 1) as maxDepth from debug_slices`); const maxDepth = rawResult.firstRow({maxDepth: NUM}).maxDepth; globals.dispatch( @@ -36,7 +36,7 @@ async onBoundsChange(start: number, end: number, resolution: number): Promise<Data> { - const queryRes = await this.queryV2(`select + const queryRes = await this.query(`select ifnull(id, -1) as id, ifnull(name, '[null]') as name, ts,
diff --git a/ui/src/tracks/expected_frames/controller.ts b/ui/src/tracks/expected_frames/controller.ts index 2e88371..3265c98 100644 --- a/ui/src/tracks/expected_frames/controller.ts +++ b/ui/src/tracks/expected_frames/controller.ts
@@ -37,7 +37,7 @@ const bucketNs = Math.max(Math.round(resolution * 1e9 * pxSize / 2) * 2, 1); if (this.maxDurNs === 0) { - const maxDurResult = await this.queryV2(` + const maxDurResult = await this.query(` select max(iif(dur = -1, (SELECT end_ts FROM trace_bounds) - ts, dur)) as maxDur from experimental_slice_layout @@ -46,7 +46,7 @@ this.maxDurNs = maxDurResult.firstRow({maxDur: NUM_NULL}).maxDur || 0; } - const queryRes = await this.queryV2(` + const queryRes = await this.query(` SELECT (ts + ${bucketNs / 2}) / ${bucketNs} * ${bucketNs} as tsq, ts,
diff --git a/ui/src/tracks/heap_profile/controller.ts b/ui/src/tracks/heap_profile/controller.ts index 4f93ce5..a79dc3d 100644 --- a/ui/src/tracks/heap_profile/controller.ts +++ b/ui/src/tracks/heap_profile/controller.ts
@@ -38,7 +38,7 @@ types: new Array<string>() }; } - const queryRes = await this.queryV2(` + const queryRes = await this.query(` select * from (select distinct(ts) as ts, 'native' as type from heap_profile_allocation where upid = ${this.config.upid}
diff --git a/ui/src/tracks/process_scheduling/controller.ts b/ui/src/tracks/process_scheduling/controller.ts index b2fab50..13ecee9 100644 --- a/ui/src/tracks/process_scheduling/controller.ts +++ b/ui/src/tracks/process_scheduling/controller.ts
@@ -44,7 +44,7 @@ assertTrue(cpus.length > 0); this.maxCpu = Math.max(...cpus) + 1; - const result = (await this.queryV2(` + const result = (await this.query(` select ifnull(max(dur), 0) as maxDur, count(1) as count from ${this.tableName('process_sched')} `)).iter({maxDur: NUM, count: NUM}); @@ -56,7 +56,7 @@ if (bucketNs === undefined) { return; } - await this.queryV2(` + await this.query(` create table ${this.tableName('process_sched_cached')} as select (ts + ${bucketNs / 2}) / ${bucketNs} * ${bucketNs} as cached_tsq, @@ -137,7 +137,7 @@ const queryTable = isCached ? this.tableName('process_sched_cached') : this.tableName('process_sched'); const constraintColumn = isCached ? 'cached_tsq' : 'ts'; - return this.queryV2(` + return this.query(` select ${tsq} as tsq, ts, @@ -154,7 +154,7 @@ } private async createSchedView() { - await this.queryV2(` + await this.query(` create view ${this.tableName('process_sched')} as select ts, dur, cpu, utid from experimental_sched_upid
diff --git a/ui/src/tracks/process_summary/controller.ts b/ui/src/tracks/process_summary/controller.ts index dbc9d9c..8241562 100644 --- a/ui/src/tracks/process_summary/controller.ts +++ b/ui/src/tracks/process_summary/controller.ts
@@ -39,12 +39,12 @@ const endNs = toNs(end); if (this.setup === false) { - await this.queryV2( + await this.query( `create virtual table ${this.tableName('window')} using window;`); let utids = [this.config.utid]; if (this.config.upid) { - const threadQuery = await this.queryV2( + const threadQuery = await this.query( `select utid from thread where upid=${this.config.upid}`); utids = []; for (const it = threadQuery.iter({utid: NUM}); it.valid(); it.next()) { @@ -52,7 +52,7 @@ } } - const trackQuery = await this.queryV2( + const trackQuery = await this.query( `select id from thread_track where utid in (${utids.join(',')})`); const tracks = []; for (const it = trackQuery.iter({id: NUM}); it.valid(); it.next()) { @@ -60,14 +60,14 @@ } const processSliceView = this.tableName('process_slice_view'); - await this.queryV2( + await this.query( `create view ${processSliceView} as ` + // 0 as cpu is a dummy column to perform span join on. `select ts, dur/${utids.length} as dur ` + `from slice s ` + `where depth = 0 and track_id in ` + `(${tracks.join(',')})`); - await this.queryV2(`create virtual table ${this.tableName('span')} + await this.query(`create virtual table ${this.tableName('span')} using span_join(${processSliceView}, ${this.tableName('window')});`); this.setup = true; @@ -79,7 +79,7 @@ const windowStartNs = Math.floor(startNs / bucketSizeNs) * bucketSizeNs; const windowDurNs = Math.max(1, endNs - windowStartNs); - await this.queryV2(`update ${this.tableName('window')} set + await this.query(`update ${this.tableName('window')} set window_start=${windowStartNs}, window_dur=${windowDurNs}, quantum=${bucketSizeNs} @@ -113,7 +113,7 @@ utilizations: new Float64Array(numBuckets), }; - const queryRes = await this.queryV2(query); + const queryRes = await this.query(query); const it = queryRes.iter({bucket: NUM, utilization: NUM}); for (; it.valid(); it.next()) { const bucket = it.bucket; @@ -128,8 +128,8 @@ onDestroy(): void { if (this.setup) { - this.queryV2(`drop table ${this.tableName('window')}`); - this.queryV2(`drop table ${this.tableName('span')}`); + this.query(`drop table ${this.tableName('window')}`); + this.query(`drop table ${this.tableName('span')}`); this.setup = false; } }
diff --git a/ui/src/tracks/thread_state/controller.ts b/ui/src/tracks/thread_state/controller.ts index 2e43a6d..b4b9420 100644 --- a/ui/src/tracks/thread_state/controller.ts +++ b/ui/src/tracks/thread_state/controller.ts
@@ -33,7 +33,7 @@ private maxDurNs = 0; async onSetup() { - await this.queryV2(` + await this.query(` create view ${this.tableName('thread_state')} as select id, @@ -46,7 +46,7 @@ where utid = ${this.config.utid} and utid != 0 `); - const queryRes = await this.queryV2(` + const queryRes = await this.query(` select ifnull(max(dur), 0) as maxDur from ${this.tableName('thread_state')} `); @@ -81,7 +81,7 @@ order by tsq, state, ioWait `; - const queryRes = await this.queryV2(query); + const queryRes = await this.query(query); const numRows = queryRes.numRows(); const data: Data = { @@ -144,8 +144,7 @@ } async onDestroy() { - await this.queryV2( - `drop table if exists ${this.tableName('thread_state')}`); + await this.query(`drop table if exists ${this.tableName('thread_state')}`); } }