Skip to content

File BenchmarksContainer.h

File List > benchmark > BenchmarksContainer.h

Go to the documentation of this file

#pragma once

#include <string>
#include <vector>
#include <functional>
#include <filesystem>
#include <fstream>


#include <benchmark/benchmark.h>

#include "mesh/Mesh.h"
#include "point_cloud/PointCloud.h"
#include "algos/mesh_to_pointcloud/ISurfaceSampler.h"
#include "algos/pointcloud_to_mesh/ISurfaceReconstructor.h"
#include "Metric.h"


#include "metrics/implementations/bench_memory_peak.h"
#include "../include/structure/ToFaceResult.h"
#include "structure/VertexToFace.h"
#include "algos/pointcloud_to_mesh/PoissonSurface.h"
#include "serializer/PlySerializer.h"


using namespace Argos;


struct Pipeline
{
    std::string name;

    std::function<void(benchmark::State&)> runner;
};


class BenchmarksContainer {
    std::vector<std::filesystem::path> inputFilesPaths;
    std::vector<Pipeline> pipelines;
    std::filesystem::path outputFolderPath;

    PointCloud cloud;
    Mesh originalMesh;


    void reconstructionBenchmark(benchmark::State& state, ISurfaceReconstructor& reconstructor, const std::vector<std::shared_ptr<Metric>>& metrics, const std::string& pipelineName);
public:
    BenchmarksContainer(std::filesystem::path objFolder, std::filesystem::path outputFolderPath);

    void addBenchmark(std::string benchName, std::shared_ptr<ISurfaceReconstructor> reconstructor, const std::vector<std::shared_ptr<Metric>>
                      &metrics);

    void run(benchmark::BenchmarkReporter* reporter = nullptr, std::shared_ptr<ISurfaceSampler> sampler = nullptr);
};