summaryrefslogtreecommitdiffstats
path: root/llvm/pmu/arm/arm-events.cpp
blob: 3da73397476271c0dbd3e9115e1f8333f7156627 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
 *  (C) 2018 by Computer System Laboratory, IIS, Academia Sinica, Taiwan.
 *      See COPYRIGHT in top-level directory.
 */

#include "pmu/pmu-global.h"

namespace pmu {

/* ARMv8 recommended implementation defined event types. 
 * (copied from linux-4.x/arch/arm64/kernel/perf_event.c) */
#define ICACHE_MISS_CONFIG (0x01)
#define MEM_LOADS_CONFIG   (0x06)
#define MEM_STORES_CONFIG  (0x07)


extern EventID PreEvents[PMU_EVENT_MAX];  /* Pre-defined events.   */

static void ARMSetupEventCode()
{
#define SetupEvent(_Event,_Config)            \
    PreEvents[_Event].Type   = PERF_TYPE_RAW; \
    PreEvents[_Event].Config = _Config;

    SetupEvent(PMU_ICACHE_MISSES, ICACHE_MISS_CONFIG);
    SetupEvent(PMU_MEM_LOADS, MEM_LOADS_CONFIG);
    SetupEvent(PMU_MEM_STORES, MEM_STORES_CONFIG);

#undef SetEventCode
}

int ARMInit()
{
    ARMSetupEventCode();
    return PMU_OK;
}

} /* namespace pmu */

/*
 * vim: ts=8 sts=4 sw=4 expandtab
 */
OpenPOWER on IntegriCloud