1/* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16select 17 the_tracks.ipid as upid, 18 the_tracks.itid as utid, 19 total_dur as hasSched, 20 process_view.pid as pid, 21 thread_view.tid as tid, 22 process_view.name as processName, 23 thread_view.name as threadName 24from ( 25 select ipid, itid from sched_view join thread_view using(itid) group by itid 26) the_tracks 27left join (select ipid, sum(dur) as total_dur 28 from sched_view join thread_view using(itid) 29 group by ipid 30) using(ipid) 31left join thread_view using(itid) 32left join process_view using(ipid) 33order by 34 total_dur desc, 35 the_tracks.ipid, 36 the_tracks.itid