当前位置:网站首页>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);
...
}
具体使用

边栏推荐
- 获国际权威认可 | 云扩科技入选《RPA全球市场格局报告,Q3 2022》
- UVa 10003 - Cutting Sticks (White Book, Interval DP)
- Flutter 桌面探索 | 自定义可拖拽导航栏
- 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!
- utils timer
- Basic Concepts of Graphs
- 目标检测的国内外研究现状
- 投资性大于游戏性 NFT游戏到底是不是门好生意
- Nine ways to teach you to read the file path in the resources directory
- log4j-slf4j-impl cannot be present with log4j-to-slf4j
猜你喜欢
Embedded Systems: Clocks
电商秒杀系统
如何设计 DAO 的 PoW 评判标准 并平衡不可能三角
嵌入式系统:时钟
Recognized by International Authorities | Yunzhuang Technology was selected in "RPA Global Market Pattern Report, Q3 2022"
用于流动质押和收益生成的 Web3 基础设施
override学习(父类和子类)
BMN: Boundary-Matching Network for Temporal Action Proposal Generation阅读笔记
Bytebase数据库 Schema 变更管理工具
2022的七夕,奉上7个精美的表白代码,同时教大家快速改源码自用
随机推荐
How to write a database document management tool based on WPF (2)
What is memoization and what is it good for?
for loop exercises
Summary bug 】 【 Elipse garbled solution project code in Chinese!
静态文件快速建站
PowerMockup 4.3.4::::Crack
21天打卡挑战学习MySQL—Day第一周 第一篇
关于IDO预售系统开发技术讲解丨浅谈IDO预售合约系统开发原理分析
藏宝计划TreasureProject(TPC)系统模式开发技术原理
With the rise of concepts such as metaverse and web3.0, many digital forms such as digital people and digital scenes have begun to appear.
start with connect by 实现递归查询
FinClip最易用的智能电视小程序
UVa 1025 - A Spy in the Metro (White Book)
代码随想录笔记_动态规划_416分割等和子集
LabVIEW代码生成错误 61056
[N1CTF 2018] eating_cms
[N1CTF 2018]eating_cms
云计算国内外发展现状
Optimize the query (work in progress)
BMN: Boundary-Matching Network for Temporal Action Proposal Generation阅读笔记