test: add benchmark
This commit is contained in:
43
tests/Benchmarks.cpp
Normal file
43
tests/Benchmarks.cpp
Normal 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);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user