2024年10月30日 第28讲 Buffer Limit Latency 极客笔记
本讲是Android Camera性能分析专题的第28讲,我们介绍CameraServer Buffer Limit Latency,包括如下内容:
资源 | 描述 |
---|---|
在线课程 | 极客笔记在线课程 |
知识星球 | 星球名称:深入浅出Android Camera 星球ID: 17296815 |
极客笔记圈 |
Buffer Limit Latency用于衡量当某路Stream dequeue buffer数量达到producer的最大值后,等待HAL处理的耗时。
Buffer Limit Latency直方图配置
添加Sample的时机
// Wait for new buffer returned back if we are running into the limit.
size_t numOutstandingBuffers = getHandoutOutputBufferCountLocked();
if (numOutstandingBuffers == camera_stream::max_buffers) {
ALOGV("%s: Already dequeued max output buffers (%d), wait for next returned one.",
__FUNCTION__, camera_stream::max_buffers);
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);
if (res != OK) {
if (res == TIMED_OUT) {
ALOGE("%s: wait for output buffer return timed out after %lldms (max_buffers %d)",
__FUNCTION__, waitBufferTimeout / 1000000LL,
camera_stream::max_buffers);
}
return res;
}
size_t updatedNumOutstandingBuffers = getHandoutOutputBufferCountLocked();
if (updatedNumOutstandingBuffers >= numOutstandingBuffers) {
ALOGE("%s: outsanding buffer count goes from %zu to %zu, "
"getBuffer(s) call must not run in parallel!", __FUNCTION__,
numOutstandingBuffers, updatedNumOutstandingBuffers);
return INVALID_OPERATION;
}
}
本文链接:http://so.lmcjl.com/news/16561/