Version: SMASH-1.8
tsc.cc
Go to the documentation of this file.
1
/*
2
*
3
* Copyright (c) 2014-2018
4
* SMASH Team
5
*
6
* GNU General Public License (GPLv3 or later)
7
*
8
*/
9
10
#include "
smash/tsc.h
"
11
12
#include <cmath>
13
#include <iomanip>
14
#include <iostream>
15
16
namespace
smash
{
17
18
std::ostream &
operator<<
(std::ostream &out,
const
TimeStampCounter
&tsc) {
19
auto
c = tsc.
cycles
();
20
int
blocks[10];
21
int
n
= 0;
22
for
(
int
digits = std::log10(c); digits > 0; digits -= 3) {
23
blocks[
n
++] = c % 1000;
24
c /= 1000;
25
}
26
if
(
n
== 0) {
27
return
out;
28
}
29
const
auto
lastFill = out.fill(
'0'
);
30
out << blocks[--
n
];
31
while
(
n
> 0) {
32
out <<
'\''
<< std::setw(3) << blocks[--
n
];
33
}
34
out.fill(lastFill);
35
return
out <<
" Cycles"
;
36
}
37
38
}
// namespace smash
smash
Definition:
action.h:24
smash::operator<<
std::ostream & operator<<(std::ostream &out, const ActionPtr &action)
Definition:
action.h:463
smash::TimeStampCounter
A low-overhead timer for benchmarking small regions of code.
Definition:
tsc.h:40
tsc.h
smash::TimeStampCounter::cycles
uint64_t cycles() const
Definition:
tsc.h:89
smash::pdg::n
constexpr int n
Neutron.
Definition:
pdgcode_constants.h:30
src
tsc.cc
Impressum
Data privacy protection
Generated on Tue Apr 7 2020 13:50:13 for SMASH by
Doxygen
1.8.16