Skip to content

Commit

Permalink
Use Timer from cpputils library.
Browse files Browse the repository at this point in the history
  • Loading branch information
przemek83 committed Sep 5, 2024
1 parent 2e31b1c commit 9e1e3fc
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 39 deletions.
4 changes: 1 addition & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ set(${PROJECT_NAME}_SOURCES
src/NumbersGenerator.cpp
src/Config.h
src/Config.cpp
src/Timer.h
src/Timer.cpp
src/FileOutput.h
src/FileOutput.cpp
src/Runner.h
Expand All @@ -62,7 +60,7 @@ set(${PROJECT_NAME}_SOURCES

# Create default binaries.
add_library (${PROJECT_NAME}-lib STATIC ${${PROJECT_NAME}_SOURCES})
target_link_libraries(${PROJECT_NAME}-lib yaml-cpp::yaml-cpp argparse)
target_link_libraries(${PROJECT_NAME}-lib yaml-cpp::yaml-cpp argparse cpputils)

add_executable(${PROJECT_NAME} src/main.cpp)
target_link_libraries(${PROJECT_NAME} ${PROJECT_NAME}-lib)
Expand Down
7 changes: 4 additions & 3 deletions src/Runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

#include <future>

#include <cpputils/Timer.h>

#include "NumbersGenerator.h"
#include "ProgressBarOverall.h"
#include "Timer.h"

void Runner::prepareSimulations(const config::Params& params, long int seed)
{
Expand All @@ -23,7 +24,7 @@ void Runner::prepareSimulations(const config::Params& params, long int seed)

std::vector<SimResults> Runner::runSequential()
{
const Timer timer;
const Timer timer{Timer::Duration::SECONDS};
std::vector<SimResults> dataToReturn;
const std::size_t simCount{simulations_.size()};
dataToReturn.reserve(simCount);
Expand All @@ -36,7 +37,7 @@ std::vector<SimResults> Runner::runSequential()

std::vector<SimResults> Runner::runParallel()
{
const Timer timer;
const Timer timer{Timer::Duration::SECONDS};
std::vector<std::future<SimResults>> futures;
const std::size_t simCount{simulations_.size()};
for (std::size_t i{0}; i < simCount; ++i)
Expand Down
14 changes: 0 additions & 14 deletions src/Timer.cpp

This file was deleted.

19 changes: 0 additions & 19 deletions src/Timer.h

This file was deleted.

0 comments on commit 9e1e3fc

Please sign in to comment.