2024年10月31日 第40讲 Perfetto 自动化之常用SQL查询语句 极客笔记
本讲是Android Camera性能分析专题的第40讲,我们介Perfetto 自动化之常用SQL查询语句。
更多资源:
资源 | 描述 |
---|---|
在线课程 | 极客笔记在线课程 |
知识星球 | 星球名称:深入浅出Android Camera 星球ID: 17296815 |
极客笔记圈 |
条件查询时,忽略大小写
SELECT * FROM slice WHERE LOWER(name) LIKE "%cam%" LIMIT 50
Trace最开始的5秒,每个进程的CPU Time
SELECT process.name, SUM(sched.dur)/1e9 AS cpu_sec
FROM sched
JOIN thread using(utid)
JOIN process using(upid)
WHERE ts <= (SELECT ts+5000000000 FROM sched ORDER BY ts LIMIT 1)
GROUP BY upid
ORDER BY cpu_sec DESC
LIMIT 100;
统计处理Camera CaptureRequest的帧率
SELECT COUNT(*)/((MAX(ts) - MIN(ts))/1e9) AS Request_FPS
FROM slice
WHERE name='frame capture'
输出:
统计某路Camera Stream的帧率(以预览为例)
SELECT COUNT(*)/((MAX(ts) - MIN(ts))/1e9) AS FPS
FROM slice
JOIN thread_track ON slice.track_id = thread_track.id
JOIN thread USING(utid)
WHERE slice.name LIKE '%queueBuffer%' AND thread.name like '%PreviewSpacer%'
输出:
统计某路Camera Stream相邻两帧的时间间隔,用于衡量抖动(以预览为例) – LAG函数说明
SELECT ((slice.ts) - LAG(slice.ts,1) OVER (ORDER BY (slice.ts) ASC))/1e6 AS diff_ms
FROM slice
JOIN thread_track ON slice.track_id = thread_track.id
JOIN thread USING(utid)
WHERE slice.name LIKE '%queueBuffer%' AND thread.name like '%PreviewSpacer%'
LIMIT -1 OFFSET 1 --LIMIT设置为-1表示选择所有剩余行,OFFSET为1表示跳过第一行
输出:
本文链接:http://so.lmcjl.com/news/16675/