diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2018-01-31 00:52:08 -0200 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2018-02-04 08:57:35 +0100 |
commit | 36d5018c0c3802ce430137f08ad72928cc92c03b (patch) | |
tree | 97390322379ce26dce198e734116e79cf60b877a /linux | |
parent | f8d6560d714c99b010aeadee09924d636c83cd02 (diff) |
Implemented various performance counters
Diffstat (limited to 'linux')
-rw-r--r-- | linux/LinuxProcess.c | 150 | ||||
-rw-r--r-- | linux/LinuxProcess.h | 54 | ||||
-rw-r--r-- | linux/LinuxProcessList.c | 87 | ||||
-rw-r--r-- | linux/LinuxProcessList.h | 44 | ||||
-rw-r--r-- | linux/Platform.c | 1 |
5 files changed, 268 insertions, 68 deletions
diff --git a/linux/LinuxProcess.c b/linux/LinuxProcess.c index ba42db1f..9fc32a11 100644 --- a/linux/LinuxProcess.c +++ b/linux/LinuxProcess.c @@ -20,12 +20,22 @@ in the source distribution for its full text. #include "PerfCounter.h" -#define PROCESS_FLAG_LINUX_IOPRIO 0x0100 -#define PROCESS_FLAG_LINUX_OPENVZ 0x0200 -#define PROCESS_FLAG_LINUX_VSERVER 0x0400 -#define PROCESS_FLAG_LINUX_CGROUP 0x0800 -#define PROCESS_FLAG_LINUX_OOM 0x1000 -#define PROCESS_FLAG_LINUX_HPC 0x2000 +#define PROCESS_FLAG_LINUX_IOPRIO 0x0100L +#define PROCESS_FLAG_LINUX_OPENVZ 0x0200L +#define PROCESS_FLAG_LINUX_VSERVER 0x0400L +#define PROCESS_FLAG_LINUX_CGROUP 0x0800L +#define PROCESS_FLAG_LINUX_OOM 0x1000L + +#define PROCESS_FLAG_LINUX_HPC 0xff0000L +#define PROCESS_FLAG_LINUX_HPC_CYCLE 0x10000L +#define PROCESS_FLAG_LINUX_HPC_INSN 0x20000L +#define PROCESS_FLAG_LINUX_HPC_MISS 0x40000L +#define PROCESS_FLAG_LINUX_HPC_BMISS 0x80000L + +#define PROCESS_FLAG_LINUX_HPC_L1DR 0x100000L +#define PROCESS_FLAG_LINUX_HPC_L1DW 0x200000L +#define PROCESS_FLAG_LINUX_HPC_L1DRM 0x400000L +#define PROCESS_FLAG_LINUX_HPC_L1DWM 0x800000L typedef enum UnsupportedProcessFields { FLAGS = 9, @@ -91,8 +101,16 @@ typedef enum LinuxProcessFields { #endif #ifdef HAVE_PERFCOUNTERS IPC = 119, + MCYCLE = 120, + MINSTR = 121, + PERCENT_MISS = 122, + PERCENT_BMISS = 123, + L1DREADS = 124, + L1DRMISSES = 125, + L1DWRITES = 126, + L1DWMISSES = 127, #endif - LAST_PROCESSFIELD = 120, + LAST_PROCESSFIELD = 128, } LinuxProcessField; #include "IOPriority.h" @@ -148,7 +166,21 @@ typedef struct LinuxProcess_ { #ifdef HAVE_PERFCOUNTERS PerfCounter* cycleCounter; PerfCounter* insnCounter; - double ipc; + PerfCounter* missCounter; + PerfCounter* brCounter; + PerfCounter* l1drCounter; + PerfCounter* l1drmCounter; + PerfCounter* l1dwCounter; + PerfCounter* l1dwmCounter; + float ipc; + float mcycle; + float minstr; + float pMiss; + float pBMiss; + float l1dr; + float l1drm; + float l1dw; + float l1dwm; #endif } LinuxProcess; @@ -241,12 +273,20 @@ ProcessFieldData Process_fields[] = { [OOM] = { .name = "OOM", .title = " OOM ", .description = "OOM (Out-of-Memory) killer score", .flags = PROCESS_FLAG_LINUX_OOM, }, [IO_PRIORITY] = { .name = "IO_PRIORITY", .title = "IO ", .description = "I/O priority", .flags = PROCESS_FLAG_LINUX_IOPRIO, }, #ifdef HAVE_DELAYACCT - [PERCENT_CPU_DELAY] = { .name = "PERCENT_CPU_DELAY", .title = "CPUD% ", .description = "CPU delay %", .flags = 0, }, + [PERCENT_CPU_DELAY] = { .name = "PERCENT_CPU_DELAY", .title = "CPD% ", .description = "CPU delay %", .flags = 0, }, [PERCENT_IO_DELAY] = { .name = "PERCENT_IO_DELAY", .title = "IOD% ", .description = "Block I/O delay %", .flags = 0, }, - [PERCENT_SWAP_DELAY] = { .name = "PERCENT_SWAP_DELAY", .title = "SWAPD% ", .description = "Swapin delay %", .flags = 0, }, + [PERCENT_SWAP_DELAY] = { .name = "PERCENT_SWAP_DELAY", .title = "SWD% ", .description = "Swapin delay %", .flags = 0, }, #endif #ifdef HAVE_PERFCOUNTERS - [IPC] = { .name = "IPC", .title = " IPC ", .description = "Executed instructions per cycle", .flags = PROCESS_FLAG_LINUX_HPC, }, + [IPC] = { .name = "IPC", .title = " IPC ", .description = "Executed instructions per cycle", .flags = PROCESS_FLAG_LINUX_HPC_CYCLE | PROCESS_FLAG_LINUX_HPC_INSN, }, + [MCYCLE] = { .name = "MCYCLE", .title = " Mcycle ", .description = "Cycles (millions)", .flags = PROCESS_FLAG_LINUX_HPC_CYCLE, }, + [MINSTR] = { .name = "MINSTR", .title = " Minstr ", .description = "Instructions (millions)", .flags = PROCESS_FLAG_LINUX_HPC_INSN, }, + [PERCENT_MISS] = { .name = "PERCENT_MISS", .title = "MIS% ", .description = "Cache misses per 100 instructions", .flags = PROCESS_FLAG_LINUX_HPC_MISS | PROCESS_FLAG_LINUX_HPC_INSN, }, + [PERCENT_BMISS] = { .name = "PERCENT_BMISS", .title = "BrM% ", .description = "Branch misprediction per 100 instructions", .flags = PROCESS_FLAG_LINUX_HPC_BMISS | PROCESS_FLAG_LINUX_HPC_INSN, }, + [L1DREADS] = { .name = "L1DREADS", .title = " L1Dread ", .description = "L1 data cache: reads (thousands)", .flags = PROCESS_FLAG_LINUX_HPC_L1DR, }, + [L1DRMISSES] = { .name = "L1DRMISSES", .title = " R miss ", .description = "L1 data cache: reads misses (thousands)", .flags = PROCESS_FLAG_LINUX_HPC_L1DRM, }, + [L1DWRITES] = { .name = "L1DWRITES", .title = " L1Dwrite ", .description = "L1D data cache: writes (thousands)", .flags = PROCESS_FLAG_LINUX_HPC_L1DW, }, + [L1DWMISSES] = { .name = "L1DWMISSES", .title = " W miss ", .description = "L1D data cache: write misses (thousands)", .flags = PROCESS_FLAG_LINUX_HPC_L1DWM, }, #endif [LAST_PROCESSFIELD] = { .name = "*** report bug! ***", .title = NULL, .description = NULL, .flags = 0, }, }; @@ -324,14 +364,43 @@ bool LinuxProcess_setIOPriority(LinuxProcess* this, IOPriority ioprio) { return (LinuxProcess_updateIOPriority(this) == ioprio); } -#ifdef HAVE_DELAYACCT -void LinuxProcess_printDelay(float delay_percent, char* buffer, int n) { - if (delay_percent == -1LL) { - xSnprintf(buffer, n, " N/A "); - } else { - xSnprintf(buffer, n, "%4.1f ", delay_percent); - } +#if HAVE_DELAYACCT || HAVE_PERFCOUNTERS + +static char* perfFmt[] = { + "%6.2f ", + NULL, + NULL, + NULL, + NULL, + NULL, + "%6.1f ", + "%7.1f ", + "%8.2f ", + "%9.1f ", +}; + +static char* perfNA[] = { + " N/A ", + NULL, + NULL, + NULL, + NULL, + NULL, + " N/A ", + " N/A ", + " N/A ", + " N/A ", +}; + +static inline void LinuxProcess_printPerfCounter(float val, int len, char* buffer, int n, int* attr) { + if (val != -1) { + xSnprintf(buffer, n, perfFmt[len], val); + } else { + xSnprintf(buffer, n, perfNA[len]); + *attr = CRT_colors[PROCESS_SHADOW]; + } } + #endif void LinuxProcess_writeField(Process* this, RichString* str, ProcessField field) { @@ -408,19 +477,20 @@ void LinuxProcess_writeField(Process* this, RichString* str, ProcessField field) break; } #ifdef HAVE_DELAYACCT - case PERCENT_CPU_DELAY: LinuxProcess_printDelay(lp->cpu_delay_percent, buffer, n); break; - case PERCENT_IO_DELAY: LinuxProcess_printDelay(lp->blkio_delay_percent, buffer, n); break; - case PERCENT_SWAP_DELAY: LinuxProcess_printDelay(lp->swapin_delay_percent, buffer, n); break; + case PERCENT_CPU_DELAY: Process_printPercentage(lp->cpu_delay_percent, buffer, n, &attr); break; + case PERCENT_IO_DELAY: Process_printPercentage(lp->blkio_delay_percent, buffer, n, &attr); break; + case PERCENT_SWAP_DELAY: Process_printPercentage(lp->swapin_delay_percent, buffer, n, &attr); break; #endif #ifdef HAVE_PERFCOUNTERS - case IPC: { - if (lp->ipc == -1) { - attr = CRT_colors[PROCESS_SHADOW]; - xSnprintf(buffer, n, " N/A "); break; - } else { - xSnprintf(buffer, n, "%5.2f ", lp->ipc); break; - } - } + case PERCENT_MISS: Process_printPercentage(lp->pMiss, buffer, n, &attr); break; + case PERCENT_BMISS: Process_printPercentage(lp->pBMiss, buffer, n, &attr); break; + case IPC: LinuxProcess_printPerfCounter(lp->ipc, 0, buffer, n, &attr); break; + case MCYCLE: LinuxProcess_printPerfCounter(lp->mcycle, 8, buffer, n, &attr); break; + case MINSTR: LinuxProcess_printPerfCounter(lp->minstr, 8, buffer, n, &attr); break; + case L1DREADS: LinuxProcess_printPerfCounter(lp->l1dr, 9, buffer, n, &attr); break; + case L1DRMISSES: LinuxProcess_printPerfCounter(lp->l1drm, 9, buffer, n, &attr); break; + case L1DWRITES: LinuxProcess_printPerfCounter(lp->l1dw, 9, buffer, n, &attr); break; + case L1DWMISSES: LinuxProcess_printPerfCounter(lp->l1dwm, 9, buffer, n, &attr); break; #endif default: Process_writeField((Process*)this, str, field); @@ -429,6 +499,8 @@ void LinuxProcess_writeField(Process* this, RichString* str, ProcessField field) RichString_append(str, attr, buffer); } +#define COMPARE_FIELD(_f) return (p2->_f > p1->_f ? 1 : -1) + long LinuxProcess_compare(const void* v1, const void* v2) { LinuxProcess *p1, *p2; Settings *settings = ((Process*)v1)->settings; @@ -484,16 +556,20 @@ long LinuxProcess_compare(const void* v1, const void* v2) { case OOM: return (p2->oom - p1->oom); #ifdef HAVE_DELAYACCT - case PERCENT_CPU_DELAY: - return (p2->cpu_delay_percent > p1->cpu_delay_percent ? 1 : -1); - case PERCENT_IO_DELAY: - return (p2->blkio_delay_percent > p1->blkio_delay_percent ? 1 : -1); - case PERCENT_SWAP_DELAY: - return (p2->swapin_delay_percent > p1->swapin_delay_percent ? 1 : -1); + case PERCENT_CPU_DELAY: COMPARE_FIELD(cpu_delay_percent); + case PERCENT_IO_DELAY: COMPARE_FIELD(blkio_delay_percent); + case PERCENT_SWAP_DELAY: COMPARE_FIELD(swapin_delay_percent); #endif #ifdef HAVE_PERFCOUNTERS - case IPC: - return (p2->ipc > p1->ipc ? 1 : -1); + case PERCENT_MISS: COMPARE_FIELD(pMiss); + case PERCENT_BMISS: COMPARE_FIELD(pBMiss); + case IPC: COMPARE_FIELD(ipc); + case MCYCLE: COMPARE_FIELD(mcycle); + case MINSTR: COMPARE_FIELD(minstr); + case L1DREADS: COMPARE_FIELD(l1dr); + case L1DRMISSES: COMPARE_FIELD(l1drm); + case L1DWRITES: COMPARE_FIELD(l1dw); + case L1DWMISSES: COMPARE_FIELD(l1dwm); #endif case IO_PRIORITY: return LinuxProcess_effectiveIOPriority(p1) - LinuxProcess_effectiveIOPriority(p2); diff --git a/linux/LinuxProcess.h b/linux/LinuxProcess.h index ca22bdda..6abcb127 100644 --- a/linux/LinuxProcess.h +++ b/linux/LinuxProcess.h @@ -12,12 +12,22 @@ in the source distribution for its full text. #include "PerfCounter.h" -#define PROCESS_FLAG_LINUX_IOPRIO 0x0100 -#define PROCESS_FLAG_LINUX_OPENVZ 0x0200 -#define PROCESS_FLAG_LINUX_VSERVER 0x0400 -#define PROCESS_FLAG_LINUX_CGROUP 0x0800 -#define PROCESS_FLAG_LINUX_OOM 0x1000 -#define PROCESS_FLAG_LINUX_HPC 0x2000 +#define PROCESS_FLAG_LINUX_IOPRIO 0x0100L +#define PROCESS_FLAG_LINUX_OPENVZ 0x0200L +#define PROCESS_FLAG_LINUX_VSERVER 0x0400L +#define PROCESS_FLAG_LINUX_CGROUP 0x0800L +#define PROCESS_FLAG_LINUX_OOM 0x1000L + +#define PROCESS_FLAG_LINUX_HPC 0xff0000L +#define PROCESS_FLAG_LINUX_HPC_CYCLE 0x10000L +#define PROCESS_FLAG_LINUX_HPC_INSN 0x20000L +#define PROCESS_FLAG_LINUX_HPC_MISS 0x40000L +#define PROCESS_FLAG_LINUX_HPC_BMISS 0x80000L + +#define PROCESS_FLAG_LINUX_HPC_L1DR 0x100000L +#define PROCESS_FLAG_LINUX_HPC_L1DW 0x200000L +#define PROCESS_FLAG_LINUX_HPC_L1DRM 0x400000L +#define PROCESS_FLAG_LINUX_HPC_L1DWM 0x800000L typedef enum UnsupportedProcessFields { FLAGS = 9, @@ -83,8 +93,16 @@ typedef enum LinuxProcessFields { #endif #ifdef HAVE_PERFCOUNTERS IPC = 119, + MCYCLE = 120, + MINSTR = 121, + PERCENT_MISS = 122, + PERCENT_BMISS = 123, + L1DREADS = 124, + L1DRMISSES = 125, + L1DWRITES = 126, + L1DWMISSES = 127, #endif - LAST_PROCESSFIELD = 120, + LAST_PROCESSFIELD = 128, } LinuxProcessField; #include "IOPriority.h" @@ -140,7 +158,21 @@ typedef struct LinuxProcess_ { #ifdef HAVE_PERFCOUNTERS PerfCounter* cycleCounter; PerfCounter* insnCounter; - double ipc; + PerfCounter* missCounter; + PerfCounter* brCounter; + PerfCounter* l1drCounter; + PerfCounter* l1drmCounter; + PerfCounter* l1dwCounter; + PerfCounter* l1dwmCounter; + float ipc; + float mcycle; + float minstr; + float pMiss; + float pBMiss; + float l1dr; + float l1drm; + float l1dw; + float l1dwm; #endif } LinuxProcess; @@ -177,12 +209,14 @@ IOPriority LinuxProcess_updateIOPriority(LinuxProcess* this); bool LinuxProcess_setIOPriority(LinuxProcess* this, IOPriority ioprio); -#ifdef HAVE_DELAYACCT -void LinuxProcess_printDelay(float delay_percent, char* buffer, int n); +#if HAVE_DELAYACCT || HAVE_PERFCOUNTERS + #endif void LinuxProcess_writeField(Process* this, RichString* str, ProcessField field); +#define COMPARE_FIELD(_f) return (p2->_f > p1->_f ? 1 : -1) + long LinuxProcess_compare(const void* v1, const void* v2); bool Process_isThread(Process* this); diff --git a/linux/LinuxProcessList.c b/linux/LinuxProcessList.c index bba611f0..e72a023d 100644 --- a/linux/LinuxProcessList.c +++ b/linux/LinuxProcessList.c @@ -647,9 +647,9 @@ static void LinuxProcessList_readDelayAcctData(LinuxProcessList* this, LinuxProc } if (nl_send_sync(this->netlink_socket, msg) < 0) { - process->swapin_delay_percent = -1LL; - process->blkio_delay_percent = -1LL; - process->cpu_delay_percent = -1LL; + process->swapin_delay_percent = -1; + process->blkio_delay_percent = -1; + process->cpu_delay_percent = -1; return; } @@ -662,26 +662,71 @@ static void LinuxProcessList_readDelayAcctData(LinuxProcessList* this, LinuxProc #ifdef HAVE_PERFCOUNTERS -static void LinuxProcessList_readPerfCounters(LinuxProcess* lp) { - if (!lp->cycleCounter) { - lp->cycleCounter = PerfCounter_new(lp->super.pid, PERF_TYPE_HARDWARE, PERF_COUNT_HW_CPU_CYCLES); +#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; \ + } \ } - if (!lp->insnCounter) { - lp->insnCounter = PerfCounter_new(lp->super.pid, PERF_TYPE_HARDWARE, PERF_COUNT_HW_INSTRUCTIONS); + +#define SET_IF(_ok, _var, _exp) \ + if (_ok) { \ + _var = _exp; \ + } else { \ + _var = -1; \ } - bool cOk = PerfCounter_read(lp->cycleCounter); - bool iOk = PerfCounter_read(lp->insnCounter); - if (cOk && iOk) { - uint64_t i = PerfCounter_delta(lp->insnCounter); - uint64_t c = PerfCounter_delta(lp->cycleCounter); - if (c > 0) { - lp->ipc = (double)i / c; - } else { - lp->ipc = 0; - } - } else { - lp->ipc = -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)) + +static void LinuxProcessList_readPerfCounters(LinuxProcess* lp, uint64_t flags) { + + READ_COUNTER(c, lp->cycleCounter, PROCESS_FLAG_LINUX_HPC_CYCLE, PERF_TYPE_HARDWARE, PERF_COUNT_HW_CPU_CYCLES); + READ_COUNTER(i, lp->insnCounter, PROCESS_FLAG_LINUX_HPC_INSN, PERF_TYPE_HARDWARE, PERF_COUNT_HW_INSTRUCTIONS); + READ_COUNTER(m, lp->missCounter, PROCESS_FLAG_LINUX_HPC_MISS, PERF_TYPE_HARDWARE, PERF_COUNT_HW_CACHE_MISSES); + READ_COUNTER(b, lp->brCounter, PROCESS_FLAG_LINUX_HPC_BMISS, PERF_TYPE_HARDWARE, PERF_COUNT_HW_BRANCH_MISSES); + + READ_COUNTER(r, lp->l1drCounter, PROCESS_FLAG_LINUX_HPC_L1DR, PERF_TYPE_HW_CACHE, L1DR); + READ_COUNTER(R, lp->l1drmCounter, PROCESS_FLAG_LINUX_HPC_L1DRM, PERF_TYPE_HW_CACHE, L1DRM); + READ_COUNTER(w, lp->l1dwCounter, PROCESS_FLAG_LINUX_HPC_L1DW, PERF_TYPE_HW_CACHE, L1DW); + READ_COUNTER(W, lp->l1dwmCounter, PROCESS_FLAG_LINUX_HPC_L1DWM, PERF_TYPE_HW_CACHE, L1DWM); + + SET_IF(cOk, lp->mcycle, (double)cDelta / 1000000); + SET_IF(iOk, lp->minstr, (double)iDelta / 1000000); + SET_IFNZ(cOk && iOk, cDelta, lp->ipc, (double)iDelta / cDelta); + SET_IFNZ(mOk && iOk, iDelta, lp->pMiss, 100 * ((double)mDelta / iDelta)); + SET_IFNZ(bOk && iOk, iDelta, lp->pBMiss, 100 * ((double)bDelta / iDelta)); + SET_IF(rOk, lp->l1dr, (double)rDelta / 1000); + SET_IF(ROk, lp->l1drm, (double)RDelta / 1000); + SET_IF(wOk, lp->l1dw, (double)wDelta / 1000); + SET_IF(WOk, lp->l1dwm, (double)WDelta / 1000); } #endif @@ -899,7 +944,7 @@ static bool LinuxProcessList_recurseProcTree(LinuxProcessList* this, const char* #ifdef HAVE_PERFCOUNTERS if (ss->flags & PROCESS_FLAG_LINUX_HPC) - LinuxProcessList_readPerfCounters(lp); + LinuxProcessList_readPerfCounters(lp, ss->flags); #endif if (proc->state == 'Z' && (proc->basenameOffset == 0)) { 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); diff --git a/linux/Platform.c b/linux/Platform.c index 025abff6..8ce890f8 100644 --- a/linux/Platform.c +++ b/linux/Platform.c @@ -22,6 +22,7 @@ in the source distribution for its full text. #include "ClockMeter.h" #include "HostnameMeter.h" #include "LinuxProcess.h" +#include "CRT.h" #include <math.h> #include <assert.h> |