libcamera: software_isp: Move benchmark code to its own class

Move the code for the builtin benchmark to its own small
Benchmark class.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
This commit is contained in:
Hans de Goede 2025-05-10 16:12:16 +02:00 committed by Bryan O'Donoghue
parent d9ffeb0bf1
commit ba4218669b
6 changed files with 135 additions and 39 deletions

View file

@ -0,0 +1,36 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2024, Red Hat Inc.
*
* Authors:
* Hans de Goede <hdegoede@redhat.com>
*
* Simple builtin benchmark to measure software ISP processing times
*/
#pragma once
#include <stdint.h>
#include <time.h>
namespace libcamera {
class Benchmark
{
public:
Benchmark();
~Benchmark();
void startFrame(void);
void finishFrame(void);
private:
unsigned int measuredFrames_;
int64_t frameProcessTime_;
timespec frameStartTime_;
/* Skip 30 frames for things to stabilize then measure 30 frames */
static constexpr unsigned int kFramesToSkip = 30;
static constexpr unsigned int kLastFrameToMeasure = 60;
};
} /* namespace libcamera */

View file

@ -1,6 +1,7 @@
# SPDX-License-Identifier: CC0-1.0
libcamera_internal_headers += files([
'benchmark.h',
'debayer_params.h',
'software_isp.h',
'swisp_stats.h',