1-- 2-- Copyright 2023 The Android Open Source Project 3-- 4-- Licensed under the Apache License, Version 2.0 (the "License"); 5-- you may not use this file except in compliance with the License. 6-- You may obtain a copy of the License at 7-- 8-- https://www.apache.org/licenses/LICENSE-2.0 9-- 10-- Unless required by applicable law or agreed to in writing, software 11-- distributed under the License is distributed on an "AS IS" BASIS, 12-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13-- See the License for the specific language governing permissions and 14-- limitations under the License. 15-- 16 17-- Events when CPU entered hypervisor. 18CREATE PERFETTO VIEW pkvm_hypervisor_events( 19 -- Id of the corresponding slice in slices table. 20 slice_id INT, 21 -- CPU that entered hypervisor. 22 cpu INT, 23 -- Timestamp when CPU entered hypervisor (in nanoseconds). 24 ts INT, 25 -- How much time CPU spent in hypervisor (in nanoseconds). 26 dur INT, 27 -- Reason for entering hypervisor (e.g. host_hcall, host_mem_abort), or NULL if unknown. 28 reason STRING 29) AS 30SELECT 31 slices.id as slice_id, 32 cpu_track.cpu as cpu, 33 slices.ts as ts, 34 slices.dur as dur, 35 EXTRACT_ARG(slices.arg_set_id, 'hyp_enter_reason') as reason 36FROM slices 37JOIN cpu_track ON cpu_track.id = slices.track_id 38WHERE 39 slices.category = 'pkvm_hyp' 40