libcamera v0.7.1
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
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 */
Benchmark(const CameraManager &cm, const std::string &name)
Constructs a Benchmark object.
Definition benchmark.cpp:32
void finishFrame(void)
Finish measuring process time for a single frame.
Definition benchmark.cpp:82
void startFrame(void)
Start measuring process time for a single frame.
Definition benchmark.cpp:61
Provide access and manage all cameras in the system.
Definition camera_manager.h:25
Top-level libcamera namespace.
Definition backtrace.h:17