Version: SMASH-3.1
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
std::ostream & operator<<(std::ostream &out, const ActionPtr &action)
Convenience: dereferences the ActionPtr to Action.
Definition: action.h:547
constexpr int n
Neutron.
Definition: action.h:24