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

边栏推荐
- UVa 1025 - A Spy in the Metro (White Book)
- [MySQL Advanced] Creation and Management of Databases and Tables
- 488. Zuma Game
- 斩获双奖|易知微荣获“2021中国数字孪生解决方案优秀供应商”“中国智能制造优秀推荐产品”双奖项!
- 使用tf.image.resize() 和tf.image.resize_with_pad()调整图像大小
- Why do we need callbacks
- 2022-08-03 Oracle executes slow SQL-Q17 comparison
- .NET6之MiniAPI(十四):跨域CORS(上)
- Click the icon in Canvas App to generate PDF and save it to Dataverse
- 生成器版和查看器版有什么区别?
猜你喜欢

for loop exercises

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

【bug】汇总Elipse项目中代码中文乱码解决方法!

noip初赛

Embedded Systems: GPIO

目标检测技术研究现状及发展趋势
![navicat 连接 mongodb 报错[13][Unauthorized] command listDatabases requires authentication](/img/09/a579c60e07cdc145175e72673409f7.png)
navicat 连接 mongodb 报错[13][Unauthorized] command listDatabases requires authentication

获国际权威认可 | 云扩科技入选《RPA全球市场格局报告,Q3 2022》

What is the difference between the generator version and the viewer version?

【开源框架】国内首个通用云计算框架,任意程序都可做成云计算。
随机推荐
Testng监听器
UVa 437 - The Tower of Babylon (White Book)
亿流量大考(2):开发一套高容错分布式系统
为什么我们需要回调
CAS:178744-28-0,mPEG-DSPE,DSPE-mPEG,甲氧基-聚乙二醇-磷脂酰乙醇胺供应
2019年10月SQL注入的两倍
Republish the lab report
Embedded systems: overview
藏宝计划TreasureProject(TPC)系统模式开发技术原理
Shell编程的条件语句
noip初赛
for循环练习题
The sword refers to the offer question 22 - the Kth node from the bottom in the linked list
Flink--Join以及Flink函数
[b01lers2020]Life on Mars
Canvas App中点击图标生成PDF并保存到Dataverse中
Boss: There are too many systems in the company, can you realize account interoperability?
Makefile
Causes of Mysql Disk Holes and Several Ways to Rebuild Tables
Zilliz 2023 秋季校园招聘正式启动!