Skip to content

Commit

Permalink
Added some performance labels
Browse files Browse the repository at this point in the history
  • Loading branch information
HFTrader committed Mar 30, 2024
1 parent 829bb5c commit fd8b8e5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
3 changes: 2 additions & 1 deletion libs/PerfGroup.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once
#include <vector>
#include <string>
#include <cstdint>
#include <unordered_map>
#include "PerfUtils.h"

Expand Down Expand Up @@ -33,4 +34,4 @@ struct PerfGroup {
std::vector<Descriptor> _ids;
std::vector<size_t> _order;
std::unordered_map<std::string, size_t> _names;
};
};
12 changes: 11 additions & 1 deletion libs/PerfUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,17 @@ bool translate(const char *events[], perf_event_attr *evds, size_t size) {
{"cycles", {PERF_TYPE_HARDWARE, PERF_COUNT_HW_CPU_CYCLES}},
{"instructions", {PERF_TYPE_HARDWARE, PERF_COUNT_HW_INSTRUCTIONS}},
{"cache-misses", {PERF_TYPE_HW_CACHE, PERF_COUNT_HW_CACHE_MISSES}},
{"branch-misses", {PERF_TYPE_HARDWARE, PERF_COUNT_HW_BRANCH_MISSES}}};
{"branch-misses", {PERF_TYPE_HARDWARE, PERF_COUNT_HW_BRANCH_MISSES}},
{"backend-stall-cycles",
{PERF_TYPE_HARDWARE, PERF_COUNT_HW_STALLED_CYCLES_BACKEND}},
{"frontend-stall-cycles",
{PERF_TYPE_HARDWARE, PERF_COUNT_HW_STALLED_CYCLES_FRONTEND}},
{"pagefaults", {PERF_TYPE_SOFTWARE, PERF_COUNT_SW_PAGE_FAULTS}},
{"context-switches", {PERF_TYPE_SOFTWARE, PERF_COUNT_SW_CONTEXT_SWITCHES}},
{"cpu-migrations", {PERF_TYPE_SOFTWARE, PERF_COUNT_SW_CPU_MIGRATIONS}},
{"pagefaults-minor", {PERF_TYPE_SOFTWARE, PERF_COUNT_SW_PAGE_FAULTS_MIN}},
{"pagefaults-major", {PERF_TYPE_SOFTWARE, PERF_COUNT_SW_PAGE_FAULTS_MAJ}},
{"alignment-faults", {PERF_TYPE_SOFTWARE, PERF_COUNT_SW_ALIGNMENT_FAULTS}}};
for (size_t j = 0; j < size; ++j) {
perf_event_attr &pe(evds[j]);
memset(&pe, 0, sizeof(pe));
Expand Down

0 comments on commit fd8b8e5

Please sign in to comment.