summaryrefslogtreecommitdiffstats
path: root/linux/LinuxProcessList.h
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2018-01-31 00:52:08 -0200
committerHisham Muhammad <hisham@gobolinux.org>2018-02-17 15:30:15 -0200
commit0cbdf8ba271d874d2efd3171cff0d4ebeabc087f (patch)
treecf613264b0935230b21ac46aeba34501ba152fca /linux/LinuxProcessList.h
parentcf0c074cc8c7e6fe858d621ea59976d2159d51bf (diff)
Implemented various performance counters
Diffstat (limited to 'linux/LinuxProcessList.h')
-rw-r--r--linux/LinuxProcessList.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/linux/LinuxProcessList.h b/linux/LinuxProcessList.h
index 06447713..310f5dfd 100644
--- a/linux/LinuxProcessList.h
+++ b/linux/LinuxProcessList.h
@@ -118,6 +118,50 @@ void ProcessList_delete(ProcessList* pl);
#ifdef HAVE_PERFCOUNTERS
+#define READ_COUNTER(_b, _var, _flag, _type, _config) \
+ bool _b ## Ok = false; \
+ uint64_t _b ## Delta = 0; \
+ if (flags & _flag) { \
+ if (!_var) { \
+ _var = PerfCounter_new(lp->super.pid, _type, _config); \
+ _b ## Ok = PerfCounter_read(_var); \
+ _b ## Delta = 0; \
+ } else { \
+ _b ## Ok = PerfCounter_read(_var); \
+ _b ## Delta = PerfCounter_delta(_var); \
+ } \
+ if (_b ## Ok) { \
+ } \
+ } else { \
+ if (_var) { \
+ PerfCounter_delete(_var); \
+ _var = NULL; \
+ } \
+ }
+
+#define SET_IF(_ok, _var, _exp) \
+ if (_ok) { \
+ _var = _exp; \
+ } else { \
+ _var = -1; \
+ }
+
+#define SET_IFNZ(_ok, _z, _var, _exp) \
+ if (_ok) { \
+ if (_z > 0) { \
+ _var = _exp; \
+ } else { \
+ _var = 0; \
+ } \
+ } else { \
+ _var = -1; \
+ }
+
+#define L1DR (PERF_COUNT_HW_CACHE_L1D | (PERF_COUNT_HW_CACHE_OP_READ << 8) | (PERF_COUNT_HW_CACHE_RESULT_ACCESS << 16))
+#define L1DRM (PERF_COUNT_HW_CACHE_L1D | (PERF_COUNT_HW_CACHE_OP_READ << 8) | (PERF_COUNT_HW_CACHE_RESULT_MISS << 16))
+#define L1DW (PERF_COUNT_HW_CACHE_L1D | (PERF_COUNT_HW_CACHE_OP_WRITE << 8) | (PERF_COUNT_HW_CACHE_RESULT_ACCESS << 16))
+#define L1DWM (PERF_COUNT_HW_CACHE_L1D | (PERF_COUNT_HW_CACHE_OP_WRITE << 8) | (PERF_COUNT_HW_CACHE_RESULT_MISS << 16))
+
#endif
void ProcessList_goThroughEntries(ProcessList* super);

© 2014-2024 Faster IT GmbH | imprint | privacy policy