ATLAS Offline Software
Loading...
Searching...
No Matches
Timer.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include <chrono>
6#include <iostream>
7
8using namespace std::chrono;
9
10struct Timer{
11
12 void timeit(){
13
14 auto t0 = high_resolution_clock::now();
15 int ndo = 1000000;
16 int i{0};
17 for (int i = 0; i != ndo; ++i){
18 i += 1;
19 i -= 1;
20 }
21 auto t1 = high_resolution_clock::now();
22 std::cout << i << '\n';
23 std::cout << duration_cast<milliseconds>(t1-t0).count()
24 <<"ms\n";
25 }
26};
27
28int main(){
29 Timer timer;
30 timer.timeit();
31}
static Double_t t0
int main()
Definition Timer.cxx:28
void timeit()
Definition Timer.cxx:12