From 28372905a333f0678b836f6f289ad546f758103c Mon Sep 17 00:00:00 2001 From: Johannes Stoelp Date: Fri, 4 Oct 2024 19:10:04 +0200 Subject: move pmc descriptors into own header --- example/counting.cc | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'example') diff --git a/example/counting.cc b/example/counting.cc index a2af7f9..5d086f6 100644 --- a/example/counting.cc +++ b/example/counting.cc @@ -1,18 +1,16 @@ -#include #include "perf.hpp" +#include + int main() { - perf_group pg({ - {.name = "CPUCLK", - .type = PERF_TYPE_SOFTWARE, - .config = PERF_COUNT_SW_CPU_CLOCK}, - {.name = "TASK", - .type = PERF_TYPE_SOFTWARE, - .config = PERF_COUNT_SW_TASK_CLOCK}, - {.name = "INSN", - .type = PERF_TYPE_HARDWARE, - .config = PERF_COUNT_HW_INSTRUCTIONS}, - }); + 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"); -- cgit v1.2.3