advent2024

Advent of Code 2024
git clone git://bsandro.tech/advent2024
Log | Files | Refs

utils.hpp (463B)


      1 #pragma once
      2 
      3 #include <chrono>
      4 #include <vector>
      5 
      6 struct Performance {
      7     Performance() {}
      8 
      9     ~Performance() {
     10         auto end = std::chrono::high_resolution_clock::now();
     11         auto duration = std::chrono::duration<float>(end - start).count();
     12         std::cout << "time: " << std::to_string(duration) << " seconds" << std::endl;
     13     }
     14 
     15     std::chrono::time_point<std::chrono::high_resolution_clock> start = std::chrono::high_resolution_clock::now();
     16 };