test: add benchmark

This commit is contained in:
parker
2025-07-10 19:25:06 +01:00
parent 433c66cd5a
commit 72de0c5602
3 changed files with 61 additions and 0 deletions

43
tests/Benchmarks.cpp Normal file
View File

@@ -0,0 +1,43 @@
#include <catch2/catch_test_macros.hpp>
#include <catch2/benchmark/catch_benchmark.hpp>
#include <memory>
#include "Engine/Network/NetworkManager.h"
#include "Engine/Operator/GeometryOperator.h"
#include "Engine/Types.h"
#include <iostream>
struct NMReset
{
NMReset()
{
enzo::nt::NetworkManager::_reset();
}
~NMReset()
{
enzo::nt::NetworkManager::_reset();
}
};
TEST_CASE_METHOD(NMReset, "Network Manager")
{
using namespace enzo;
nt::OpId prevOp = 0;
for(int i=0; i<100; ++i){
nt::OpId newOp = nt::NetworkManager::addOperator();
if(prevOp!=0)
{
nt::connectOperators(newOp, 0, prevOp, 0);
}
prevOp = newOp;
}
nt::NetworkManager* nm = nt::NetworkManager::getInstance();
BENCHMARK("Cook 100 Ops")
{
nm->setDisplayOp(prevOp);
};
}

View File

@@ -1,4 +1,5 @@
#include <catch2/catch_test_macros.hpp>
#include <catch2/benchmark/catch_benchmark.hpp>
#include <memory>
#include "Engine/Network/NetworkManager.h"
#include "Engine/Operator/GeometryOperator.h"