libcamera: include/libcamera/internal/software_isp/benchmark.h Source File

libcamera v0.7.2 Supporting cameras in Linux since 2019

Loading...
Searching...
No Matches
benchmark.h
1/* SPDX-License-Identifier: LGPL-2.1-or-later */
2/*
3 * Copyright (C) 2024, Red Hat Inc.
4 *
5 * Authors:
6 * Hans de Goede <hdegoede@redhat.com>
7 *
8 * Simple builtin benchmark to measure software ISP processing times
9 */
10
11#pragma once
12
13#include <stdint.h>
14#include <string>
15#include <time.h>
16
17namespace libcamera {
18
19class CameraManager;
20
21 class Benchmark
22{
23public:
24 Benchmark(const CameraManager &cm, const std::string &name);
25 ~Benchmark();
26
27 void startFrame(void);
28 void finishFrame(void);
29
30private:
31 std::string name_;
32 timespec frameStartTime_;
33 bool measure_;
34 /* Skip 30 frames for things to stabilize then measure 30 frames */
35 unsigned int encounteredFrames_ = 0;
36 int64_t frameProcessTime_ = 0;
37 unsigned int skipBeforeMeasure_ = 30;
38 unsigned int framesToMeasure_ = 30;
39};
40
41} /* namespace libcamera */
libcamera::Benchmark::Benchmark
Benchmark(const CameraManager &cm, const std::string &name)
Constructs a Benchmark object.
Definition benchmark.cpp:32
libcamera::Benchmark::finishFrame
void finishFrame(void)
Finish measuring process time for a single frame.
Definition benchmark.cpp:82
libcamera::Benchmark::startFrame
void startFrame(void)
Start measuring process time for a single frame.
Definition benchmark.cpp:61
libcamera::CameraManager
Provide access and manage all cameras in the system.
Definition camera_manager.h:25
libcamera
Top-level libcamera namespace.
Definition backtrace.h:17