libcamera v0.7.0+1595-4b6c47bd-nvm
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#include <libcamera/base/log.h>
17#include "libcamera/internal/global_configuration.h"
18
19namespace libcamera {
20
22{
23public:
24 Benchmark(const GlobalConfiguration &configuration, 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 */
Simple builtin benchmark.
Definition benchmark.h:22
void finishFrame(void)
Finish measuring process time for a single frame.
Definition benchmark.cpp:77
void startFrame(void)
Start measuring process time for a single frame.
Definition benchmark.cpp:56
Support for global libcamera configuration.
Definition global_configuration.h:22
Logging infrastructure.
Top-level libcamera namespace.
Definition backtrace.h:17