Chronometer.cpp 510 Bytes
Newer Older
1
#include <pinkIndexer/Chronometer.h>
2
3
4
5

#include <iostream>
#include <string>

6
namespace pinkIndexer
7
{
8
9
10
11
12
    Chronometer::Chronometer(const std::string& key)
        : key_(key)
        , startTime_(std::chrono::system_clock::now())
    {
    }
13

14
15
16
17
18
    Chronometer::~Chronometer()
    {
        auto duration = std::chrono::system_clock::now() - startTime_;
        std::cout << key_ << " elapsed: " << std::chrono::duration_cast<std::chrono::milliseconds>(duration).count() << "\n";
    }
19
} // namespace pinkIndexer