diff options
Diffstat (limited to 'ui/src/tracks/cpu_profile/controller.ts')
-rw-r--r-- | ui/src/tracks/cpu_profile/controller.ts | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/ui/src/tracks/cpu_profile/controller.ts b/ui/src/tracks/cpu_profile/controller.ts index 070cedba9..4e68e5f0b 100644 --- a/ui/src/tracks/cpu_profile/controller.ts +++ b/ui/src/tracks/cpu_profile/controller.ts @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -import {slowlyCountRows} from '../../common/query_iterator'; +import {NUM} from '../../common/query_result'; import { TrackController, trackControllerRegistry @@ -28,13 +28,16 @@ class CpuProfileTrackController extends TrackController<Config, Data> { static readonly kind = CPU_PROFILE_TRACK_KIND; async onBoundsChange(start: number, end: number, resolution: number): Promise<Data> { - const query = `select id, ts, callsite_id from cpu_profile_stack_sample - where utid = ${this.config.utid} - order by ts`; + const query = `select + id, + ts, + callsite_id as callsiteId + from cpu_profile_stack_sample + where utid = ${this.config.utid} + order by ts`; const result = await this.query(query); - - const numRows = slowlyCountRows(result); + const numRows = result.numRows(); const data: Data = { start, end, @@ -45,10 +48,11 @@ class CpuProfileTrackController extends TrackController<Config, Data> { callsiteId: new Uint32Array(numRows), }; - for (let row = 0; row < numRows; row++) { - data.ids[row] = +result.columns[0].longValues![row]; - data.tsStarts[row] = +result.columns[1].longValues![row]; - data.callsiteId[row] = +result.columns[2].longValues![row]; + const it = result.iter({id: NUM, ts: NUM, callsiteId: NUM}); + for (let row = 0; it.valid(); it.next(), ++row) { + data.ids[row] = it.id; + data.tsStarts[row] = it.ts; + data.callsiteId[row] = it.callsiteId; } return data; |