第44讲 perfetto 自动化之camera拍照性能自动化分析|极客笔记-凯发k8手机登录

本讲是android camera性能分析专题的第44讲,我们介perfetto 自动化之camera拍照性能自动化分析

更多资源:

资源 描述
在线课程
知识星球 星球名称:深入浅出android camera
星球id: 17296815
wechat 极客笔记圈

camera 拍照性能拆解

这里我们只拆解从单击拍照按钮到收到拍照的图片,后续app的流程大家可以自己完善。

  • 点击拍照->下拍照request
  • 处理完拍照request

camera 拍照时间自动化分析

代码如下:

#!/usr/bin/env python3
from perfetto.trace_processor import traceprocessor
from perfetto.trace_processor import traceprocessorconfig
tp = traceprocessor(trace=r'capture.perfetto-trace', config=traceprocessorconfig(
    bin_path=r'trace_processor_shell_v3.7.exe',
    verbose=false))
### click shutter button icon
geekcamera_click_sql = """select ts/1e6, dur/1e6 from
                slice
                join process_track on slice.track_id = process_track.id
                join process using(upid)
                where slice.name='deliverinputevent' and process.name like '%geekcamera%'
                order by slice.ts desc
                limit 1"""
click_app_icon = tp.query(geekcamera_click_sql)
click_app_icon_ms = click_app_icon.as_pandas_dataframe().values[0][0]
### capture submitrequest
still_capture = tp.query("""select ts/1e6, dur/1e6 from
                            slice
                            where name = "still capture" limit 1""").as_pandas_dataframe()
still_capture_begin_ms = still_capture.values[0][0]
still_capture_dur_ms = still_capture.values[0][1]
print("total camera capture time:"   str(round((still_capture_begin_ms   still_capture_dur_ms - click_app_icon_ms), 2))   " ms, break down as following:")
print("    [app] click                     -->                  submitrequestlist: "  
      str(round((still_capture_begin_ms - click_app_icon_ms), 2))   " ms")
print("    [hal] submitrequestlist         -->                  capture end: "  
      str(round((still_capture_dur_ms), 2))   " ms")

输出:

camera 拍照时间自动化分析

camera课程

python教程

java教程

web教程

数据库教程

图形图像教程

办公软件教程

linux教程

计算机教程

大数据教程

开发工具教程

android camera性能分析

网站地图