From 34d19fcf468b63c33c8341849610187228f4966c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Wed, 8 Nov 2023 14:04:48 +0100 Subject: [PATCH] measure parsing and solve time --- src/example.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/example.cpp b/src/example.cpp index d874ed9..7253769 100644 --- a/src/example.cpp +++ b/src/example.cpp @@ -1,9 +1,11 @@ #include // For writing to the standard output. #include // For reading input files. +#include #include "graph.hpp" #include "edmonds.h" + int main(int argc, char** argv) { if (argc != 2) @@ -16,10 +18,16 @@ int main(int argc, char** argv) if (not input_file_graph.is_open()) { throw std::runtime_error(std::string("Could not open file for reading: ") + argv[1]); } + auto start = std::chrono::high_resolution_clock::now(); ED::Graph graph = ED::Graph::read_dimacs(input_file_graph); + auto end = std::chrono::high_resolution_clock::now(); + std::cout << "Parsing time: " << std::chrono::duration_cast(end - start) << std::endl; // Now, calculate the matching + auto start2 = std::chrono::high_resolution_clock::now(); ED::Graph optimum_matching = Edmonds::maximum_matching(graph); + auto end2 = std::chrono::high_resolution_clock::now(); + std::cout << "Solving time: " << std::chrono::duration_cast(end2 - start2) << std::endl; std::cout << optimum_matching; return EXIT_SUCCESS; }