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

边栏推荐
- Causes of Mysql Disk Holes and Several Ways to Rebuild Tables
- Storage engine written by golang, based on b+ tree, mmap
- for loop exercises
- 网络基础学习系列四(网络层,数据链路层和一些其他重要协议或技术)
- golang写的存储引擎,基于b+树,mmap
- 互联网用户账号信息管理规定今起施行:必须严打账号买卖灰产
- Bytebase database schema change management tool
- 直播预告 | 构建业务智联,快速拥抱财务数字化转型
- Kotlin - 扩展函数和运算符重载
- 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

授人以渔 - 如何自行查询任意 SAP UI5 控件属性的文档和技术实现细节试读版

Live Preview | Build Business Intelligence, Quickly Embrace Financial Digital Transformation

113. 授人以渔 - 如何自行查询任意 SAP UI5 控件属性的文档和技术实现细节

Zilliz 2023 秋季校园招聘正式启动!

重发布实验报告

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

override学习(父类和子类)

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

Network basic learning series four (network layer, data link layer and some other important protocols or technologies)
随机推荐
Live Preview | Build Business Intelligence, Quickly Embrace Financial Digital Transformation
Summary bug 】 【 Elipse garbled solution project code in Chinese!
Fluorescein-PEG-CLS,胆固醇-聚乙二醇-荧光素科研试剂
Golang第二章:程序结构
JPA Native Query(本地查询)及查询结果转换
嵌入式系统:GPIO
物联网新零售模式,引领购物新潮流
2022/8/3 考试总结
UVa 1025 - A Spy in the Metro(白书)
关于IDO预售系统开发技术讲解丨浅谈IDO预售合约系统开发原理分析
【day6】类与对象、封装、构造方法
Nine ways to teach you to read the file path in the resources directory
嵌入式系统:概述
MiniAPI of .NET6 (14): Cross-domain CORS (Part 1)
决策树、GBDT、XGBOOST树的可视化
Republish the lab report
[b01lers2020]Life on Mars
【day1】
BMN: Boundary-Matching Network for Temporal Action Proposal Generation阅读笔记
PowerMockup 4.3.4::::Crack