当前位置:网站首页>AOSP CameraLatencyHistogram的原理与使用
AOSP CameraLatencyHistogram的原理与使用
2022-08-03 22:39:00 【InfoQ】

CameraLatencyHistogram是什么
源码解析
头文件定义

- mBinSizeMs 记录的是当前记录表的标准时间,比如预设一次request的标准时长为40ms
- mBinCount 记录的是直方图的等级划分数量,通常默认是10个等级
- mBins 记录的是直方图各个等级的数量
- mTotalCount 记录的是直方图的统计数量总数
类初始化

增加一个数据/清空所有数据

dump/log以及内部处理函数formatHistogramText

- 先dump数据的行头,标识dump时的记录数据量;
- 然后将直方图数据构造成字符串;
- 将直方图数据写入到对应的fd文件中。

- 先打印耗时的时间段,如33ms/66ms/99ms,最大值打印为inf (max ms)
- 然后打印每一个段数据占总数据量的百分比
100.0*mBins[i]/mTotalCount
- 最后打印一个%号。
使用该工具的位置
mDequeueBufferLatency:dequeue buffer的时延,5ms
///frameworks/av/services/camera/libcameraservice/device3/Camera3OutputStream.h
//dequebuffer默认耗时5ms,进行记录
static const int32_t kDequeueLatencyBinSize = 5; // in ms C
ameraLatencyHistogram mDequeueBufferLatency;
status_t Camera3OutputStream::getBuffersLocked(std::vector<OutstandingBuffer>* outBuffers) {
...
nsecs_t dequeueStart = systemTime(SYSTEM_TIME_MONOTONIC);
res = consumer->dequeueBuffers(&buffers);
nsecs_t dequeueEnd = systemTime(SYSTEM_TIME_MONOTONIC);
mDequeueBufferLatency.add(dequeueStart, dequeueEnd);
...
}mBufferLimitLatency:buffer signal时延,33ms
///frameworks/av/services/camera/libcameraservice/device3/Camera3Stream.h
// Latency histogram of the wait time for handout buffer count to drop below
// max_buffers.
static const int32_t kBufferLimitLatencyBinSize = 33; //in ms
CameraLatencyHistogram mBufferLimitLatency;
status_t Camera3Stream::getBuffer(camera_stream_buffer *buffer, nsecs_t waitBufferTimeout, const std::vector<size_t>& surface_ids) {
...
nsecs_t waitStart = systemTime(SYSTEM_TIME_MONOTONIC);
if (waitBufferTimeout < kWaitForBufferDuration) {
waitBufferTimeout = kWaitForBufferDuration;
}
res = mOutputBufferReturnedSignal.waitRelative(mLock, waitBufferTimeout);
nsecs_t waitEnd = systemTime(SYSTEM_TIME_MONOTONIC);
mBufferLimitLatency.add(waitStart, waitEnd);
...
}mRequestLatency:request执行的时延,40ms
///frameworks/av/services/camera/libcameraservice/device3/Camera3Device.h
//记录request的时延,默认一帧request时长40ms
static const int32_t kRequestLatencyBinSize = 40; // in ms
CameraLatencyHistogram mRequestLatency;
bool Camera3Device::RequestThread::threadLoop() {
...
bool submitRequestSuccess = false;
nsecs_t tRequestStart = systemTime(SYSTEM_TIME_MONOTONIC);
submitRequestSuccess = sendRequestsBatch();
nsecs_t tRequestEnd = systemTime(SYSTEM_TIME_MONOTONIC);
mRequestLatency.add(tRequestStart, tRequestEnd);
...
}具体使用

边栏推荐
- 授人以渔 - 如何自行查询任意 SAP UI5 控件属性的文档和技术实现细节试读版
- Live Preview | Build Business Intelligence, Quickly Embrace Financial Digital Transformation
- Gains double award | know micro easily won the "2021 China digital twin solution suppliers in excellence" "made in China's smart excellent recommended products" double award!
- UVa 437 - The Tower of Babylon(白书)
- 剑指offer第22题-链表中倒数第K个节点
- Adobe是什么?
- LabVIEW code generation error 61056
- Summary bug 】 【 Elipse garbled solution project code in Chinese!
- Embedded systems: overview
- Boss: There are too many systems in the company, can you realize account interoperability?
猜你喜欢

藏宝计划TreasureProject(TPC)系统模式开发技术原理

Analysys Analysis: The transaction scale of China's online retail B2C market in Q2 2022 will reach 2,344.47 billion yuan

On the Qixi Festival of 2022, I will offer 7 exquisite confession codes, and at the same time teach you to quickly change the source code for your own use

21天打卡挑战学习MySQL——《Window下安装MySql》第一周 第三篇

.NET6之MiniAPI(十四):跨域CORS(上)

全球观之地理部分

win10系统下yolov5-V6.1版本的tensorrt部署细节教程及bug修改

【开源框架】国内首个通用云计算框架,任意程序都可做成云计算。

关于IDO预售系统开发技术讲解丨浅谈IDO预售合约系统开发原理分析

Lift, Splat, Shoot: Encoding Images from Arbitrary Camera Rigs by Implicitly Unprojecting to 3D 论文笔记
随机推荐
golang写的存储引擎,基于b+树,mmap
HDU 5655 CA Loves Stick
Causes of Mysql Disk Holes and Several Ways to Rebuild Tables
Quickly build a website with static files
LabVIEW代码生成错误 61056
[b01lers2020]Life on Mars
utlis thread pool
Bytebase数据库 Schema 变更管理工具
UVa 437 - The Tower of Babylon(白书)
node连接mysql数据库报错:Client does not support authentication protocol requested by server
关于IDO预售系统开发技术讲解丨浅谈IDO预售合约系统开发原理分析
什么是memoization,它有什么用?
生成器版和查看器版有什么区别?
21天打卡挑战学习MySQL——《Window下安装MySql》第一周 第三篇
HCIP BGP lab report
2022-08-03 Oracle executes slow SQL-Q17 comparison
Optimize the query (work in progress)
数据一致性:双删为什么要延时?
L2-041 插松枝
目标检测技术研究现状及发展趋势