The GlobalConfiguration is explicitly passed around through constructors of various objects that need access to the configuration. This ad-hoc solution works for the specific use cases it was meant to support, but isn't very generic. We have a top-level object in libcamera, the CameraManager, that also needs to be accessed from various locations and is passed to object constructors. Standardize on passing the CameraManager everywhere, and access the global configuration through it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> Reviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>
42 lines
808 B
C++
42 lines
808 B
C++
/* 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 <string>
|
|
#include <time.h>
|
|
|
|
namespace libcamera {
|
|
|
|
class CameraManager;
|
|
|
|
class Benchmark
|
|
{
|
|
public:
|
|
Benchmark(const CameraManager &cm, const std::string &name);
|
|
~Benchmark();
|
|
|
|
void startFrame(void);
|
|
void finishFrame(void);
|
|
|
|
private:
|
|
std::string name_;
|
|
timespec frameStartTime_;
|
|
bool measure_;
|
|
/* Skip 30 frames for things to stabilize then measure 30 frames */
|
|
unsigned int encounteredFrames_ = 0;
|
|
int64_t frameProcessTime_ = 0;
|
|
unsigned int skipBeforeMeasure_ = 30;
|
|
unsigned int framesToMeasure_ = 30;
|
|
};
|
|
|
|
} /* namespace libcamera */
|