software_isp: benchmark: Print what is being benchmarked

With the GPU accelerated softISP 2 separate benchmark results are printed,
1 for the generation of the output images on the GPU and a separate one
for generating the statistics on the CPU.

Add a new name argument to the Benchmark class descriptor and print this
out when printing the benchmark result.

Signed-off-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Hans de Goede
2026-02-15 10:44:18 +01:00
committed by Kieran Bingham
parent f0a79dd68b
commit 7bcc2168bf
4 changed files with 9 additions and 5 deletions

View File

@@ -11,6 +11,7 @@
#pragma once
#include <stdint.h>
#include <string>
#include <time.h>
#include <libcamera/base/log.h>
#include "libcamera/internal/global_configuration.h"
@@ -20,13 +21,14 @@ namespace libcamera {
class Benchmark
{
public:
Benchmark(const GlobalConfiguration &configuration);
Benchmark(const GlobalConfiguration &configuration, 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 */

View File

@@ -26,7 +26,8 @@ LOG_DEFINE_CATEGORY(Benchmark)
/**
* \brief Constructs a Benchmark object
*/
Benchmark::Benchmark(const GlobalConfiguration &configuration)
Benchmark::Benchmark(const GlobalConfiguration &configuration, const std::string &name)
: name_(name)
{
skipBeforeMeasure_ = configuration.option<unsigned int>(
{ "software_isp", "measure", "skip" })
@@ -81,7 +82,7 @@ void Benchmark::finishFrame(void)
frameProcessTime_ += timeDiff(frameEndTime, frameStartTime_);
if (encounteredFrames_ == skipBeforeMeasure_ + framesToMeasure_) {
LOG(Benchmark, Info)
<< "Processed " << framesToMeasure_
<< name_ << " processed " << framesToMeasure_
<< " frames in " << frameProcessTime_ / 1000 << "us, "
<< frameProcessTime_ / (1000 * framesToMeasure_)
<< " us/frame";

View File

@@ -58,7 +58,8 @@ namespace libcamera {
LOG_DEFINE_CATEGORY(Debayer)
Debayer::Debayer(const GlobalConfiguration &configuration) : bench_(configuration)
Debayer::Debayer(const GlobalConfiguration &configuration)
: bench_(configuration, "Debayer")
{
}

View File

@@ -155,7 +155,7 @@ namespace libcamera {
LOG_DEFINE_CATEGORY(SwStatsCpu)
SwStatsCpu::SwStatsCpu(const GlobalConfiguration &configuration)
: sharedStats_("softIsp_stats"), bench_(configuration)
: sharedStats_("softIsp_stats"), bench_(configuration, "CPU stats")
{
if (!sharedStats_)
LOG(SwStatsCpu, Error)