当前位置:网站首页>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);
...
}
具体使用
边栏推荐
- 剑指offer第22题-链表中倒数第K个节点
- 嵌入式系统:概述
- LabVIEW代码生成错误 61056
- 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!
- Republish the lab report
- [b01lers2020]Life on Mars
- Bytebase数据库 Schema 变更管理工具
- Makefile
- 如何设计 DAO 的 PoW 评判标准 并平衡不可能三角
- 嵌入式系统:时钟
猜你喜欢
随机推荐
什么是memoization,它有什么用?
Internet user account information management regulations come into effect today: must crack down on account trading and gray products
HCIP BGP lab report
【MySQL进阶】数据库与表的创建和管理
With 4 years of work experience, the 5 communication methods between multi-threads can't be said, can you believe it?
趣链的产品构架
UVa 10003 - Cutting Sticks(白书,区间DP)
互联网用户账号信息管理规定今起施行:必须严打账号买卖灰产
优化查询(工作中)
HCIP BGP实验报告
The sword refers to the offer question 22 - the Kth node from the bottom in the linked list
Recognized by International Authorities | Yunzhuang Technology was selected in "RPA Global Market Pattern Report, Q3 2022"
静态文件快速建站
Golang第一章:入门
举一个 web worker 的例子
亿流量大考(2):开发一套高容错分布式系统
Cisco ike2 IPSec configuration
Quickly build a website with static files
【day1】
Research status of target detection at home and abroad