当前位置:网站首页>The principle and use of AOSP CameraLatencyHistogram
The principle and use of AOSP CameraLatencyHistogram
2022-08-03 22:45:00 【InfoQ】

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

- mBinSizeMs The record is the standard time of the current record table,Such as preset oncerequestThe standard duration is 40ms
- mBinCount Records the number of levels of the histogram,通常默认是10个等级
- mBins Records the number of levels in the histogram
- mTotalCount Records the total number of statistics for the histogram
类初始化

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

dump/logand internal processing functionsformatHistogramText

- 先dumpThe line header of the data,标识dumpamount of recorded data;
- The histogram data is then constructed as a string;
- Write the histogram data to the corresponding fd文件中.

- Print the elapsed time period first,如33ms/66ms/99ms,The maximum value is printed as inf (max ms)
- Then print the percentage of each segment data to the total data volume
100.0*mBins[i]/mTotalCount
- Print one last%号.
Where to use the tool
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:requestexecution delay,40ms
///frameworks/av/services/camera/libcameraservice/device3/Camera3Device.h
//记录request的时延,Default one framerequest时长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);
...
}具体使用

边栏推荐
- 113. 授人以渔 - 如何自行查询任意 SAP UI5 控件属性的文档和技术实现细节
- Pytest学习-setup/teardown
- Optimize the query (work in progress)
- With 4 years of work experience, the 5 communication methods between multi-threads can't be said, can you believe it?
- HDU 5655 CA Loves Stick
- 网络基础学习系列四(网络层,数据链路层和一些其他重要协议或技术)
- node连接mysql数据库报错:Client does not support authentication protocol requested by server
- 关于IDO预售系统开发技术讲解丨浅谈IDO预售合约系统开发原理分析
- for loop exercises
- Research status of target detection at home and abroad
猜你喜欢

2022-08-02 mysql/stonedb慢SQL-Q18-内存使用暴涨分析

2022的七夕,奉上7个精美的表白代码,同时教大家快速改源码自用

如何设计 DAO 的 PoW 评判标准 并平衡不可能三角

【day6】类与对象、封装、构造方法

Lift, Splat, Shoot: Encoding Images from Arbitrary Camera Rigs by Implicitly Unprojecting to 3D 论文笔记

投资性大于游戏性 NFT游戏到底是不是门好生意
![[b01lers2020]Life on Mars](/img/d0/d5c9b7224542c8843ce29adc7ef713.png)
[b01lers2020]Life on Mars

易观分析:2022年Q2中国网络零售B2C市场交易规模达23444.7亿元

生成器版和查看器版有什么区别?

Bytebase数据库 Schema 变更管理工具
随机推荐
[MySQL Advanced] Creation and Management of Databases and Tables
嵌入式系统:时钟
The sword refers to the offer question 22 - the Kth node from the bottom in the linked list
Golang Chapter 2: Program Structure
win10系统下yolov5-V6.1版本的tensorrt部署细节教程及bug修改
Testng监听器
《数字经济全景白皮书》金融数字用户篇 重磅发布!
Summary bug 】 【 Elipse garbled solution project code in Chinese!
pikachu Over permission
RPA power business automation super order!
趣链的产品构架
如何设计 DAO 的 PoW 评判标准 并平衡不可能三角
483. Smallest Good Base
Nine ways to teach you to read the file path in the resources directory
封装、包、访问权限修饰符、static变量
Embedded Systems: Clocks
FinClip最易用的智能电视小程序
斩获双奖|易知微荣获“2021中国数字孪生解决方案优秀供应商”“中国智能制造优秀推荐产品”双奖项!
2022-08-03 Oracle executes slow SQL-Q17 comparison
encapsulation, package, access modifier, static variable