summaryrefslogtreecommitdiff
path: root/example/counting.cc
blob: 5d086f676c89984b643238b5140f9d107b0d400a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include "perf.hpp"

#include <cstdio>

int main() {
  perf_group pg({PMC_CPU_CLK, PMC_TASK_CLK, PMC_INSN, PMC_CYCLES});

  std::puts("- start-stop-dump");
  pg.start();
  pg.stop();
  pg.dump();

  std::puts("- start-2nop-stop-dump");
  pg.start();
  asm volatile("nop");
  asm volatile("nop");
  pg.stop();
  pg.dump();
}