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

边栏推荐
猜你喜欢

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

云平台建设解决方案

Shell编程的条件语句

for loop exercises

走迷宫 BFS

pikachu Over permission

重发布实验报告

Fluorescein-PEG-CLS,胆固醇-聚乙二醇-荧光素科研试剂

pikachu Over permission 越权

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
随机推荐
2022-08-02 mysql/stonedb slow SQL-Q18 - memory usage surge analysis
golang写的存储引擎,基于b+树,mmap
使用tf.image.resize() 和tf.image.resize_with_pad()调整图像大小
Live Preview | Build Business Intelligence, Quickly Embrace Financial Digital Transformation
HCIP BGP实验报告
Testng listener
【云原生实用技巧】使用 skopeo 批量同步 helm chart 依赖镜像
Golang第二章:程序结构
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
优化查询(工作中)
UVa 10003 - Cutting Sticks(白书,区间DP)
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!
HCIP BGP lab report
"Digital Economy Panorama White Paper" Financial Digital User Chapter released!
UVa 437 - The Tower of Babylon (White Book)
override learning (parent and child)
生成器版和查看器版有什么区别?
What is memoization and what is it good for?
LabVIEW code generation error 61056
UVa 10003 - Cutting Sticks (White Book, Interval DP)