Ada 4.1.1
Fast spec-compliant URL parser
Loading...
Searching...
No Matches
apple_arm_events.h File Reference
#include <dlfcn.h>
#include <mach/mach_time.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/kdebug.h>
#include <sys/sysctl.h>
#include <unistd.h>

Go to the source code of this file.

Classes

struct  performance_counters
struct  kpep_event
 KPEP event (size: 48/28 bytes on 64/32 bit OS). More...
struct  kpep_db
 KPEP database (size: 144/80 bytes on 64/32 bit OS). More...
struct  kpep_config
 KPEP config (size: 80/44 bytes on 64/32 bit OS). More...
struct  lib_symbol
struct  kd_buf
struct  kd_regtype
struct  kbufinfo_t
struct  event_alias

Macros

#define KPC_CLASS_FIXED   (0)
#define KPC_CLASS_CONFIGURABLE   (1)
#define KPC_CLASS_POWER   (2)
#define KPC_CLASS_RAWPMU   (3)
#define KPC_CLASS_FIXED_MASK   (1u << KPC_CLASS_FIXED)
#define KPC_CLASS_CONFIGURABLE_MASK   (1u << KPC_CLASS_CONFIGURABLE)
#define KPC_CLASS_POWER_MASK   (1u << KPC_CLASS_POWER)
#define KPC_CLASS_RAWPMU_MASK   (1u << KPC_CLASS_RAWPMU)
#define KPC_PMU_ERROR   (0)
#define KPC_PMU_INTEL_V3   (1)
#define KPC_PMU_ARM_APPLE   (2)
#define KPC_PMU_INTEL_V2   (3)
#define KPC_PMU_ARM_V2   (4)
#define KPC_MAX_COUNTERS   32
#define KPERF_SAMPLER_TH_INFO   (1U << 0)
#define KPERF_SAMPLER_TH_SNAPSHOT   (1U << 1)
#define KPERF_SAMPLER_KSTACK   (1U << 2)
#define KPERF_SAMPLER_USTACK   (1U << 3)
#define KPERF_SAMPLER_PMC_THREAD   (1U << 4)
#define KPERF_SAMPLER_PMC_CPU   (1U << 5)
#define KPERF_SAMPLER_PMC_CONFIG   (1U << 6)
#define KPERF_SAMPLER_MEMINFO   (1U << 7)
#define KPERF_SAMPLER_TH_SCHEDULING   (1U << 8)
#define KPERF_SAMPLER_TH_DISPATCH   (1U << 9)
#define KPERF_SAMPLER_TK_SNAPSHOT   (1U << 10)
#define KPERF_SAMPLER_SYS_MEM   (1U << 11)
#define KPERF_SAMPLER_TH_INSCYC   (1U << 12)
#define KPERF_SAMPLER_TK_INFO   (1U << 13)
#define KPERF_ACTION_MAX   (32)
#define KPERF_TIMER_MAX   (8)
#define KPEP_ARCH_I386   0
#define KPEP_ARCH_X86_64   1
#define KPEP_ARCH_ARM   2
#define KPEP_ARCH_ARM64   3
#define lib_nelems(x)
#define lib_symbol_def(name)
#define lib_path_kperf   "/System/Library/PrivateFrameworks/kperf.framework/kperf"
#define lib_path_kperfdata   "/System/Library/PrivateFrameworks/kperfdata.framework/kperfdata"
#define return_err()
#define KDBG_CLASSTYPE   0x10000
#define KDBG_SUBCLSTYPE   0x20000
#define KDBG_RANGETYPE   0x40000
#define KDBG_TYPENONE   0x80000
#define KDBG_CKTYPES   0xF0000
#define KDBG_VALCHECK   0x00200000U
#define EVENT_NAME_MAX   8

Typedefs

typedef float f32
typedef double f64
typedef int8_t i8
typedef uint8_t u8
typedef int16_t i16
typedef uint16_t u16
typedef int32_t i32
typedef uint32_t u32
typedef int64_t i64
typedef uint64_t u64
typedef size_t usize
typedef u64 kpc_config_t
typedef struct kpep_event kpep_event
 KPEP event (size: 48/28 bytes on 64/32 bit OS).
typedef struct kpep_db kpep_db
 KPEP database (size: 144/80 bytes on 64/32 bit OS).
typedef struct kpep_config kpep_config
 KPEP config (size: 80/44 bytes on 64/32 bit OS).
typedef uintptr_t kd_buf_argtype

Enumerations

enum  kpep_config_error_code {
  KPEP_CONFIG_ERROR_NONE = 0 , KPEP_CONFIG_ERROR_INVALID_ARGUMENT = 1 , KPEP_CONFIG_ERROR_OUT_OF_MEMORY = 2 , KPEP_CONFIG_ERROR_IO = 3 ,
  KPEP_CONFIG_ERROR_BUFFER_TOO_SMALL = 4 , KPEP_CONFIG_ERROR_CUR_SYSTEM_UNKNOWN = 5 , KPEP_CONFIG_ERROR_DB_PATH_INVALID = 6 , KPEP_CONFIG_ERROR_DB_NOT_FOUND = 7 ,
  KPEP_CONFIG_ERROR_DB_ARCH_UNSUPPORTED = 8 , KPEP_CONFIG_ERROR_DB_VERSION_UNSUPPORTED = 9 , KPEP_CONFIG_ERROR_DB_CORRUPT = 10 , KPEP_CONFIG_ERROR_EVENT_NOT_FOUND = 11 ,
  KPEP_CONFIG_ERROR_CONFLICTING_EVENTS = 12 , KPEP_CONFIG_ERROR_COUNTERS_NOT_FORCED = 13 , KPEP_CONFIG_ERROR_EVENT_UNAVAILABLE = 14 , KPEP_CONFIG_ERROR_ERRNO = 15 ,
  KPEP_CONFIG_ERROR_MAX
}
 Error code for kpep_config_xxx() and kpep_db_xxx() functions. More...

Functions

performance_counters operator- (const performance_counters &a, const performance_counters &b)
static int kperf_lightweight_pet_get (u32 *enabled)
 Get lightweight PET mode (not in kperf.framework).
static int kperf_lightweight_pet_set (u32 enabled)
 Set lightweight PET mode (not in kperf.framework).
static const char * kpep_config_error_desc (int code)
 Error description.
static void lib_deinit (void)
static bool lib_init (void)
static int kdebug_reset (void)
static int kdebug_reinit (void)
static int kdebug_setreg (kd_regtype *kdr)
 Set debug filter.
static int kdebug_trace_setbuf (int nbufs)
static int kdebug_trace_enable (bool enable)
static int kdebug_get_bufinfo (kbufinfo_t *info)
static int kdebug_trace_read (void *buf, usize len, usize *count)
static int kdebug_wait (usize timeout_ms, bool *suc)
static kpep_event * get_event (kpep_db *db, const event_alias *alias)
bool setup_performance_counters ()
performance_counters get_counters ()

Variables

static int(* kpc_cpu_string )(char *buf, usize buf_size)
static u32(* kpc_pmu_version )(void)
static u32(* kpc_get_counting )(void)
static int(* kpc_set_counting )(u32 classes)
static u32(* kpc_get_thread_counting )(void)
static int(* kpc_set_thread_counting )(u32 classes)
static u32(* kpc_get_config_count )(u32 classes)
static int(* kpc_get_config )(u32 classes, kpc_config_t *config)
static int(* kpc_set_config )(u32 classes, kpc_config_t *config)
static u32(* kpc_get_counter_count )(u32 classes)
static int(* kpc_get_cpu_counters )(bool all_cpus, u32 classes, int *curcpu, u64 *buf)
static int(* kpc_get_thread_counters )(u32 tid, u32 buf_count, u64 *buf)
static int(* kpc_force_all_ctrs_set )(int val)
static int(* kpc_force_all_ctrs_get )(int *val_out)
static int(* kperf_action_count_set )(u32 count)
static int(* kperf_action_count_get )(u32 *count)
static int(* kperf_action_samplers_set )(u32 actionid, u32 sample)
static int(* kperf_action_samplers_get )(u32 actionid, u32 *sample)
static int(* kperf_action_filter_set_by_task )(u32 actionid, i32 port)
static int(* kperf_action_filter_set_by_pid )(u32 actionid, i32 pid)
static int(* kperf_timer_count_set )(u32 count)
static int(* kperf_timer_count_get )(u32 *count)
static int(* kperf_timer_period_set )(u32 actionid, u64 tick)
static int(* kperf_timer_period_get )(u32 actionid, u64 *tick)
static int(* kperf_timer_action_set )(u32 actionid, u32 timerid)
static int(* kperf_timer_action_get )(u32 actionid, u32 *timerid)
static int(* kperf_timer_pet_set )(u32 timerid)
static int(* kperf_timer_pet_get )(u32 *timerid)
static int(* kperf_sample_set )(u32 enabled)
static int(* kperf_sample_get )(u32 *enabled)
static int(* kperf_reset )(void)
static u64(* kperf_ns_to_ticks )(u64 ns)
 Nanoseconds to CPU ticks.
static u64(* kperf_ticks_to_ns )(u64 ticks)
 CPU ticks to nanoseconds.
static u64(* kperf_tick_frequency )(void)
 CPU ticks frequency (mach_absolute_time).
static const char * kpep_config_error_names [KPEP_CONFIG_ERROR_MAX]
 Error description for kpep_config_error_code.
static int(* kpep_config_create )(kpep_db *db, kpep_config **cfg_ptr)
static void(* kpep_config_free )(kpep_config *cfg)
 Free the config.
static int(* kpep_config_add_event )(kpep_config *cfg, kpep_event **ev_ptr, u32 flag, u32 *err)
static int(* kpep_config_remove_event )(kpep_config *cfg, usize idx)
static int(* kpep_config_force_counters )(kpep_config *cfg)
static int(* kpep_config_events_count )(kpep_config *cfg, usize *count_ptr)
static int(* kpep_config_events )(kpep_config *cfg, kpep_event **buf, usize buf_size)
static int(* kpep_config_kpc )(kpep_config *cfg, kpc_config_t *buf, usize buf_size)
static int(* kpep_config_kpc_count )(kpep_config *cfg, usize *count_ptr)
static int(* kpep_config_kpc_classes )(kpep_config *cfg, u32 *classes_ptr)
static int(* kpep_config_kpc_map )(kpep_config *cfg, usize *buf, usize buf_size)
static int(* kpep_db_create )(const char *name, kpep_db **db_ptr)
static void(* kpep_db_free )(kpep_db *db)
 Free the kpep database.
static int(* kpep_db_name )(kpep_db *db, const char **name)
static int(* kpep_db_aliases_count )(kpep_db *db, usize *count)
static int(* kpep_db_aliases )(kpep_db *db, const char **buf, usize buf_size)
static int(* kpep_db_counters_count )(kpep_db *db, u8 classes, usize *count)
static int(* kpep_db_events_count )(kpep_db *db, usize *count)
static int(* kpep_db_events )(kpep_db *db, kpep_event **buf, usize buf_size)
static int(* kpep_db_event )(kpep_db *db, const char *name, kpep_event **ev_ptr)
static int(* kpep_event_name )(kpep_event *ev, const char **name_ptr)
static int(* kpep_event_alias )(kpep_event *ev, const char **alias_ptr)
static int(* kpep_event_description )(kpep_event *ev, const char **str_ptr)
static const lib_symbol lib_symbols_kperf []
static const lib_symbol lib_symbols_kperfdata []
static bool lib_inited = false
static bool lib_has_err = false
static char lib_err_msg [256]
static void * lib_handle_kperf = NULL
static void * lib_handle_kperfdata = NULL
static const event_alias profile_events []
 Event names from /usr/share/kpep/<name>.plist.
kpc_config_t regs [KPC_MAX_COUNTERS] = {0}
usize counter_map [KPC_MAX_COUNTERS] = {0}
u64 counters_0 [KPC_MAX_COUNTERS] = {0}
u64 counters_1 [KPC_MAX_COUNTERS] = {0}
const usize ev_count = sizeof(profile_events) / sizeof(profile_events[0])

Macro Definition Documentation

◆ EVENT_NAME_MAX

#define EVENT_NAME_MAX   8

Definition at line 914 of file apple_arm_events.h.

Referenced by get_event().

◆ KDBG_CKTYPES

#define KDBG_CKTYPES   0xF0000

Definition at line 802 of file apple_arm_events.h.

◆ KDBG_CLASSTYPE

#define KDBG_CLASSTYPE   0x10000

Definition at line 798 of file apple_arm_events.h.

◆ KDBG_RANGETYPE

#define KDBG_RANGETYPE   0x40000

Definition at line 800 of file apple_arm_events.h.

◆ KDBG_SUBCLSTYPE

#define KDBG_SUBCLSTYPE   0x20000

Definition at line 799 of file apple_arm_events.h.

◆ KDBG_TYPENONE

#define KDBG_TYPENONE   0x80000

Definition at line 801 of file apple_arm_events.h.

◆ KDBG_VALCHECK

#define KDBG_VALCHECK   0x00200000U

Definition at line 805 of file apple_arm_events.h.

◆ KPC_CLASS_CONFIGURABLE

#define KPC_CLASS_CONFIGURABLE   (1)

Definition at line 126 of file apple_arm_events.h.

◆ KPC_CLASS_CONFIGURABLE_MASK

#define KPC_CLASS_CONFIGURABLE_MASK   (1u << KPC_CLASS_CONFIGURABLE)

Definition at line 132 of file apple_arm_events.h.

Referenced by setup_performance_counters().

◆ KPC_CLASS_FIXED

#define KPC_CLASS_FIXED   (0)

Definition at line 125 of file apple_arm_events.h.

◆ KPC_CLASS_FIXED_MASK

#define KPC_CLASS_FIXED_MASK   (1u << KPC_CLASS_FIXED)

Definition at line 131 of file apple_arm_events.h.

◆ KPC_CLASS_POWER

#define KPC_CLASS_POWER   (2)

Definition at line 127 of file apple_arm_events.h.

◆ KPC_CLASS_POWER_MASK

#define KPC_CLASS_POWER_MASK   (1u << KPC_CLASS_POWER)

Definition at line 133 of file apple_arm_events.h.

◆ KPC_CLASS_RAWPMU

#define KPC_CLASS_RAWPMU   (3)

Definition at line 128 of file apple_arm_events.h.

◆ KPC_CLASS_RAWPMU_MASK

#define KPC_CLASS_RAWPMU_MASK   (1u << KPC_CLASS_RAWPMU)

Definition at line 134 of file apple_arm_events.h.

◆ KPC_MAX_COUNTERS

#define KPC_MAX_COUNTERS   32

Definition at line 148 of file apple_arm_events.h.

Referenced by get_counters().

◆ KPC_PMU_ARM_APPLE

#define KPC_PMU_ARM_APPLE   (2)

Definition at line 139 of file apple_arm_events.h.

◆ KPC_PMU_ARM_V2

#define KPC_PMU_ARM_V2   (4)

Definition at line 141 of file apple_arm_events.h.

◆ KPC_PMU_ERROR

#define KPC_PMU_ERROR   (0)

Definition at line 137 of file apple_arm_events.h.

◆ KPC_PMU_INTEL_V2

#define KPC_PMU_INTEL_V2   (3)

Definition at line 140 of file apple_arm_events.h.

◆ KPC_PMU_INTEL_V3

#define KPC_PMU_INTEL_V3   (1)

Definition at line 138 of file apple_arm_events.h.

◆ KPEP_ARCH_ARM

#define KPEP_ARCH_ARM   2

Definition at line 380 of file apple_arm_events.h.

◆ KPEP_ARCH_ARM64

#define KPEP_ARCH_ARM64   3

Definition at line 381 of file apple_arm_events.h.

◆ KPEP_ARCH_I386

#define KPEP_ARCH_I386   0

Definition at line 378 of file apple_arm_events.h.

◆ KPEP_ARCH_X86_64

#define KPEP_ARCH_X86_64   1

Definition at line 379 of file apple_arm_events.h.

◆ KPERF_ACTION_MAX

#define KPERF_ACTION_MAX   (32)

Definition at line 168 of file apple_arm_events.h.

◆ KPERF_SAMPLER_KSTACK

#define KPERF_SAMPLER_KSTACK   (1U << 2)

Definition at line 154 of file apple_arm_events.h.

◆ KPERF_SAMPLER_MEMINFO

#define KPERF_SAMPLER_MEMINFO   (1U << 7)

Definition at line 159 of file apple_arm_events.h.

◆ KPERF_SAMPLER_PMC_CONFIG

#define KPERF_SAMPLER_PMC_CONFIG   (1U << 6)

Definition at line 158 of file apple_arm_events.h.

◆ KPERF_SAMPLER_PMC_CPU

#define KPERF_SAMPLER_PMC_CPU   (1U << 5)

Definition at line 157 of file apple_arm_events.h.

◆ KPERF_SAMPLER_PMC_THREAD

#define KPERF_SAMPLER_PMC_THREAD   (1U << 4)

Definition at line 156 of file apple_arm_events.h.

◆ KPERF_SAMPLER_SYS_MEM

#define KPERF_SAMPLER_SYS_MEM   (1U << 11)

Definition at line 163 of file apple_arm_events.h.

◆ KPERF_SAMPLER_TH_DISPATCH

#define KPERF_SAMPLER_TH_DISPATCH   (1U << 9)

Definition at line 161 of file apple_arm_events.h.

◆ KPERF_SAMPLER_TH_INFO

#define KPERF_SAMPLER_TH_INFO   (1U << 0)

Definition at line 152 of file apple_arm_events.h.

◆ KPERF_SAMPLER_TH_INSCYC

#define KPERF_SAMPLER_TH_INSCYC   (1U << 12)

Definition at line 164 of file apple_arm_events.h.

◆ KPERF_SAMPLER_TH_SCHEDULING

#define KPERF_SAMPLER_TH_SCHEDULING   (1U << 8)

Definition at line 160 of file apple_arm_events.h.

◆ KPERF_SAMPLER_TH_SNAPSHOT

#define KPERF_SAMPLER_TH_SNAPSHOT   (1U << 1)

Definition at line 153 of file apple_arm_events.h.

◆ KPERF_SAMPLER_TK_INFO

#define KPERF_SAMPLER_TK_INFO   (1U << 13)

Definition at line 165 of file apple_arm_events.h.

◆ KPERF_SAMPLER_TK_SNAPSHOT

#define KPERF_SAMPLER_TK_SNAPSHOT   (1U << 10)

Definition at line 162 of file apple_arm_events.h.

◆ KPERF_SAMPLER_USTACK

#define KPERF_SAMPLER_USTACK   (1U << 3)

Definition at line 155 of file apple_arm_events.h.

◆ KPERF_TIMER_MAX

#define KPERF_TIMER_MAX   (8)

Definition at line 171 of file apple_arm_events.h.

◆ lib_nelems

#define lib_nelems ( x)
Value:
(sizeof(x) / sizeof((x)[0]))

Definition at line 616 of file apple_arm_events.h.

Referenced by lib_deinit(), and lib_init().

◆ lib_path_kperf

#define lib_path_kperf   "/System/Library/PrivateFrameworks/kperf.framework/kperf"

Definition at line 683 of file apple_arm_events.h.

Referenced by lib_init().

◆ lib_path_kperfdata

#define lib_path_kperfdata   "/System/Library/PrivateFrameworks/kperfdata.framework/kperfdata"

Definition at line 684 of file apple_arm_events.h.

Referenced by lib_init().

◆ lib_symbol_def

#define lib_symbol_def ( name)
Value:
{ #name, (void **)&name }

Definition at line 617 of file apple_arm_events.h.

◆ return_err

#define return_err ( )
Value:
do { \
lib_deinit(); \
lib_inited = true; \
lib_has_err = true; \
return false; \
} while (false)
static bool lib_inited
static bool lib_has_err

Referenced by lib_init().

Typedef Documentation

◆ f32

typedef float f32

Definition at line 106 of file apple_arm_events.h.

◆ f64

typedef double f64

Definition at line 107 of file apple_arm_events.h.

◆ i16

typedef int16_t i16

Definition at line 110 of file apple_arm_events.h.

◆ i32

typedef int32_t i32

Definition at line 112 of file apple_arm_events.h.

◆ i64

typedef int64_t i64

Definition at line 114 of file apple_arm_events.h.

◆ i8

typedef int8_t i8

Definition at line 108 of file apple_arm_events.h.

◆ kd_buf_argtype

typedef uintptr_t kd_buf_argtype

Definition at line 775 of file apple_arm_events.h.

◆ kpc_config_t

typedef u64 kpc_config_t

Definition at line 174 of file apple_arm_events.h.

◆ kpep_config

typedef struct kpep_config kpep_config

KPEP config (size: 80/44 bytes on 64/32 bit OS).

◆ kpep_db

typedef struct kpep_db kpep_db

KPEP database (size: 144/80 bytes on 64/32 bit OS).

◆ kpep_event

typedef struct kpep_event kpep_event

KPEP event (size: 48/28 bytes on 64/32 bit OS).

◆ u16

typedef uint16_t u16

Definition at line 111 of file apple_arm_events.h.

◆ u32

typedef uint32_t u32

Definition at line 113 of file apple_arm_events.h.

◆ u64

typedef uint64_t u64

Definition at line 115 of file apple_arm_events.h.

◆ u8

typedef uint8_t u8

Definition at line 109 of file apple_arm_events.h.

◆ usize

typedef size_t usize

Definition at line 116 of file apple_arm_events.h.

Enumeration Type Documentation

◆ kpep_config_error_code

Error code for kpep_config_xxx() and kpep_db_xxx() functions.

Enumerator
KPEP_CONFIG_ERROR_NONE 
KPEP_CONFIG_ERROR_INVALID_ARGUMENT 
KPEP_CONFIG_ERROR_OUT_OF_MEMORY 
KPEP_CONFIG_ERROR_IO 
KPEP_CONFIG_ERROR_BUFFER_TOO_SMALL 
KPEP_CONFIG_ERROR_CUR_SYSTEM_UNKNOWN 
KPEP_CONFIG_ERROR_DB_PATH_INVALID 
KPEP_CONFIG_ERROR_DB_NOT_FOUND 
KPEP_CONFIG_ERROR_DB_ARCH_UNSUPPORTED 
KPEP_CONFIG_ERROR_DB_VERSION_UNSUPPORTED 
KPEP_CONFIG_ERROR_DB_CORRUPT 
KPEP_CONFIG_ERROR_EVENT_NOT_FOUND 
KPEP_CONFIG_ERROR_CONFLICTING_EVENTS 
KPEP_CONFIG_ERROR_COUNTERS_NOT_FORCED 
KPEP_CONFIG_ERROR_EVENT_UNAVAILABLE 
KPEP_CONFIG_ERROR_ERRNO 
KPEP_CONFIG_ERROR_MAX 

Definition at line 440 of file apple_arm_events.h.

Function Documentation

◆ get_counters()

performance_counters get_counters ( )
inline

◆ get_event()

kpep_event * get_event ( kpep_db * db,
const event_alias * alias )
static

Definition at line 949 of file apple_arm_events.h.

References EVENT_NAME_MAX, kpep_db_event, and event_alias::names.

Referenced by setup_performance_counters().

◆ kdebug_get_bufinfo()

int kdebug_get_bufinfo ( kbufinfo_t * info)
static

Retrieve trace buffer information from kernel.

Returns
0 on success.

Definition at line 871 of file apple_arm_events.h.

◆ kdebug_reinit()

int kdebug_reinit ( void )
static

Disable and reinitialize the trace buffers.

Returns
0 on success.

Definition at line 841 of file apple_arm_events.h.

◆ kdebug_reset()

int kdebug_reset ( void )
static

Clean up trace buffers and reset ktrace/kdebug/kperf.

Returns
0 on success.

Definition at line 834 of file apple_arm_events.h.

◆ kdebug_setreg()

int kdebug_setreg ( kd_regtype * kdr)
static

Set debug filter.

Definition at line 847 of file apple_arm_events.h.

◆ kdebug_trace_enable()

int kdebug_trace_enable ( bool enable)
static

Enable or disable kdebug trace. Trace buffer must already be initialized.

Returns
0 on success.

Definition at line 864 of file apple_arm_events.h.

◆ kdebug_trace_read()

int kdebug_trace_read ( void * buf,
usize len,
usize * count )
static

Retrieve trace buffers from kernel.

Parameters
bufMemory to receive buffer data, array of kd_buf.
lenLength of buf in bytes.
countNumber of trace entries (kd_buf) obtained.
Returns
0 on success.

Definition at line 883 of file apple_arm_events.h.

◆ kdebug_trace_setbuf()

int kdebug_trace_setbuf ( int nbufs)
static

Set maximum number of trace entries (kd_buf). Only allow allocation up to half the available memory (sane_size).

Returns
0 on success.

Definition at line 856 of file apple_arm_events.h.

◆ kdebug_wait()

int kdebug_wait ( usize timeout_ms,
bool * suc )
static

Block until there are new buffers filled or timeout_ms have passed.

Parameters
timeout_mstimeout milliseconds, 0 means wait forever.
sucset true if new buffers filled.
Returns
0 on success.

Definition at line 901 of file apple_arm_events.h.

◆ kpep_config_error_desc()

const char * kpep_config_error_desc ( int code)
static

Error description.

Definition at line 480 of file apple_arm_events.h.

References KPEP_CONFIG_ERROR_MAX, and kpep_config_error_names.

Referenced by setup_performance_counters().

◆ kperf_lightweight_pet_get()

int kperf_lightweight_pet_get ( u32 * enabled)
static

Get lightweight PET mode (not in kperf.framework).

Definition at line 360 of file apple_arm_events.h.

◆ kperf_lightweight_pet_set()

int kperf_lightweight_pet_set ( u32 enabled)
static

Set lightweight PET mode (not in kperf.framework).

Definition at line 367 of file apple_arm_events.h.

◆ lib_deinit()

◆ lib_init()

◆ operator-()

◆ setup_performance_counters()

Variable Documentation

◆ counter_map

usize counter_map[KPC_MAX_COUNTERS] = {0}

Definition at line 962 of file apple_arm_events.h.

Referenced by get_counters(), and setup_performance_counters().

◆ counters_0

u64 counters_0[KPC_MAX_COUNTERS] = {0}

Definition at line 963 of file apple_arm_events.h.

Referenced by get_counters().

◆ counters_1

u64 counters_1[KPC_MAX_COUNTERS] = {0}

Definition at line 964 of file apple_arm_events.h.

◆ ev_count

const usize ev_count = sizeof(profile_events) / sizeof(profile_events[0])

Definition at line 965 of file apple_arm_events.h.

Referenced by setup_performance_counters().

◆ kpc_cpu_string

int(* kpc_cpu_string) (char *buf, usize buf_size) ( char * buf,
usize buf_size )
static

Print current CPU identification string to the buffer (same as snprintf), such as "cpu_7_8_10b282dc_46". This string can be used to locate the PMC database in /usr/share/kpep.

Returns
string's length, or negative value if error occurs.
Note
This method does not requires root privileges.

sysctl get(hw.cputype), get(hw.cpusubtype), get(hw.cpufamily), get(machdep.cpu.model)

Definition at line 183 of file apple_arm_events.h.

◆ kpc_force_all_ctrs_get

int(* kpc_force_all_ctrs_get) (int *val_out) ( int * val_out)
static

Get the state of all_ctrs.

Returns
0 for success.

sysctl get(kpc.force_all_ctrs)

Definition at line 279 of file apple_arm_events.h.

Referenced by setup_performance_counters().

◆ kpc_force_all_ctrs_set

int(* kpc_force_all_ctrs_set) (int val) ( int val)
static

Acquire/release the counters used by the Power Manager.

Parameters
val1:acquire, 0:release
Returns
0 for success.

sysctl set(kpc.force_all_ctrs)

Definition at line 274 of file apple_arm_events.h.

Referenced by setup_performance_counters().

◆ kpc_get_config

int(* kpc_get_config) (u32 classes, kpc_config_t *config) ( u32 classes,
kpc_config_t * config )
static

Get config registers.

Parameters
classessee class mask constants above.
configConfig buffer to receive values, should not smaller than kpc_get_config_count(classes) * sizeof(kpc_config_t).
Returns
0 for success.

sysctl get(kpc.config_count), get(kpc.config)

Definition at line 229 of file apple_arm_events.h.

◆ kpc_get_config_count

u32(* kpc_get_config_count) (u32 classes) ( u32 classes)
static

Get how many config registers there are for a given mask. For example: Intel may returns 1 for KPC_CLASS_FIXED_MASK, returns 4 for KPC_CLASS_CONFIGURABLE_MASK.

Parameters
classesSee class mask constants above.
Returns
0 if error occurs or no class is set.
Note
This method does not requires root privileges.

sysctl get(kpc.config_count)

Definition at line 221 of file apple_arm_events.h.

◆ kpc_get_counter_count

u32(* kpc_get_counter_count) (u32 classes) ( u32 classes)
static

Get how many counters there are for a given mask. For example: Intel may returns 3 for KPC_CLASS_FIXED_MASK, returns 4 for KPC_CLASS_CONFIGURABLE_MASK.

Parameters
classesSee class mask constants above.
Note
This method does not requires root privileges.

sysctl get(kpc.counter_count)

Definition at line 245 of file apple_arm_events.h.

◆ kpc_get_counting

u32(* kpc_get_counting) (void) ( void )
static

Get running PMC classes.

Returns
See class mask constants above, 0 if error occurs or no class is set.

sysctl get(kpc.counting)

Definition at line 194 of file apple_arm_events.h.

◆ kpc_get_cpu_counters

int(* kpc_get_cpu_counters) (bool all_cpus, u32 classes, int *curcpu, u64 *buf) ( bool all_cpus,
u32 classes,
int * curcpu,
u64 * buf )
static

Get counter accumulations. If all_cpus is true, the buffer count should not smaller than (cpu_count * counter_count). Otherwize, the buffer count should not smaller than (counter_count).

See also
kpc_get_counter_count(), kpc_cpu_count().
Parameters
all_cpustrue for all CPUs, false for current cpu.
classesSee class mask constants above.
curcpuA pointer to receive current cpu id, can be NULL.
bufBuffer to receive counter's value.
Returns
0 for success.

sysctl get(hw.ncpu), get(kpc.counter_count), get(kpc.counters)

Definition at line 258 of file apple_arm_events.h.

◆ kpc_get_thread_counters

int(* kpc_get_thread_counters) (u32 tid, u32 buf_count, u64 *buf) ( u32 tid,
u32 buf_count,
u64 * buf )
static

Get counter accumulations for current thread.

Parameters
tidThread id, should be 0.
buf_countThe number of buf's elements (not bytes), should not smaller than kpc_get_counter_count().
bufBuffer to receive counter's value.
Returns
0 for success.

sysctl get(kpc.thread_counters)

Definition at line 268 of file apple_arm_events.h.

Referenced by get_counters().

◆ kpc_get_thread_counting

u32(* kpc_get_thread_counting) (void) ( void )
static

Get running PMC classes for current thread.

Returns
See class mask constants above, 0 if error occurs or no class is set.

sysctl get(kpc.thread_counting)

Definition at line 206 of file apple_arm_events.h.

◆ kpc_pmu_version

u32(* kpc_pmu_version) (void) ( void )
static

Get the version of KPC that's being run.

Returns
See PMU version constants above.

sysctl get(kpc.pmu_version)

Definition at line 188 of file apple_arm_events.h.

◆ kpc_set_config

int(* kpc_set_config) (u32 classes, kpc_config_t *config) ( u32 classes,
kpc_config_t * config )
static

Set config registers.

Parameters
classessee class mask constants above.
configConfig buffer, should not smaller than kpc_get_config_count(classes) * sizeof(kpc_config_t).
Returns
0 for success.

sysctl get(kpc.config_count), set(kpc.config)

Definition at line 237 of file apple_arm_events.h.

Referenced by setup_performance_counters().

◆ kpc_set_counting

int(* kpc_set_counting) (u32 classes) ( u32 classes)
static

Set PMC classes to enable counting.

Parameters
classesSee class mask constants above, set 0 to shutdown counting.
Returns
0 for success.

sysctl set(kpc.counting)

Definition at line 200 of file apple_arm_events.h.

Referenced by setup_performance_counters().

◆ kpc_set_thread_counting

int(* kpc_set_thread_counting) (u32 classes) ( u32 classes)
static

Set PMC classes to enable counting for current thread.

Parameters
classesSee class mask constants above, set 0 to shutdown counting.
Returns
0 for success.

sysctl set(kpc.thread_counting)

Definition at line 212 of file apple_arm_events.h.

Referenced by setup_performance_counters().

◆ kpep_config_add_event

int(* kpep_config_add_event) (kpep_config *cfg, kpep_event **ev_ptr, u32 flag, u32 *err) ( kpep_config * cfg,
kpep_event ** ev_ptr,
u32 flag,
u32 * err )
static

Add an event to config.

Parameters
cfgThe config.
ev_ptrA event pointer.
flag0: all, 1: user space only
errError bitmap pointer, can be NULL. If return value is CONFLICTING_EVENTS, this bitmap contains the conflicted event indices, e.g. "1 << 2" means index 2.
Returns
kpep_config_error_code, 0 for success.

Definition at line 504 of file apple_arm_events.h.

Referenced by setup_performance_counters().

◆ kpep_config_create

int(* kpep_config_create) (kpep_db *db, kpep_config **cfg_ptr) ( kpep_db * db,
kpep_config ** cfg_ptr )
static

Create a config.

Parameters
dbA kpep db, see kpep_db_create()
cfg_ptrA pointer to receive the new config.
Returns
kpep_config_error_code, 0 for success.

Definition at line 491 of file apple_arm_events.h.

Referenced by setup_performance_counters().

◆ kpep_config_error_names

const char* kpep_config_error_names[KPEP_CONFIG_ERROR_MAX]
static
Initial value:
= {
"none",
"invalid argument",
"out of memory",
"I/O",
"buffer too small",
"current system unknown",
"database path invalid",
"database not found",
"database architecture unsupported",
"database version unsupported",
"database corrupt",
"event not found",
"conflicting events",
"all counters must be forced",
"event unavailable",
"check errno"}

Error description for kpep_config_error_code.

Definition at line 461 of file apple_arm_events.h.

Referenced by kpep_config_error_desc().

◆ kpep_config_events

int(* kpep_config_events) (kpep_config *cfg, kpep_event **buf, usize buf_size) ( kpep_config * cfg,
kpep_event ** buf,
usize buf_size )
static

Get all event pointers.

Parameters
bufA buffer to receive event pointers.
buf_sizeThe buffer's size in bytes, should not smaller than kpep_config_events_count() * sizeof(void *).
Returns
kpep_config_error_code, 0 for success.

Definition at line 524 of file apple_arm_events.h.

◆ kpep_config_events_count

int(* kpep_config_events_count) (kpep_config *cfg, usize *count_ptr) ( kpep_config * cfg,
usize * count_ptr )
static

Get events count.

Returns
kpep_config_error_code, 0 for success.

Definition at line 517 of file apple_arm_events.h.

◆ kpep_config_force_counters

int(* kpep_config_force_counters) (kpep_config *cfg) ( kpep_config * cfg)
static

Force all counters.

Returns
kpep_config_error_code, 0 for success.

Definition at line 513 of file apple_arm_events.h.

Referenced by setup_performance_counters().

◆ kpep_config_free

void(* kpep_config_free) (kpep_config *cfg) ( kpep_config * cfg)
static

Free the config.

Definition at line 494 of file apple_arm_events.h.

◆ kpep_config_kpc

int(* kpep_config_kpc) (kpep_config *cfg, kpc_config_t *buf, usize buf_size) ( kpep_config * cfg,
kpc_config_t * buf,
usize buf_size )
static

Get kpc register configs.

Parameters
bufA buffer to receive kpc register configs.
buf_sizeThe buffer's size in bytes, should not smaller than kpep_config_kpc_count() * sizeof(kpc_config_t).
Returns
kpep_config_error_code, 0 for success.

Definition at line 532 of file apple_arm_events.h.

Referenced by setup_performance_counters().

◆ kpep_config_kpc_classes

int(* kpep_config_kpc_classes) (kpep_config *cfg, u32 *classes_ptr) ( kpep_config * cfg,
u32 * classes_ptr )
static

Get kpc classes.

Parameters
classesSee class mask constants above.
Returns
kpep_config_error_code, 0 for success.

Definition at line 542 of file apple_arm_events.h.

Referenced by setup_performance_counters().

◆ kpep_config_kpc_count

int(* kpep_config_kpc_count) (kpep_config *cfg, usize *count_ptr) ( kpep_config * cfg,
usize * count_ptr )
static

Get kpc register config count.

Returns
kpep_config_error_code, 0 for success.

Definition at line 537 of file apple_arm_events.h.

Referenced by setup_performance_counters().

◆ kpep_config_kpc_map

int(* kpep_config_kpc_map) (kpep_config *cfg, usize *buf, usize buf_size) ( kpep_config * cfg,
usize * buf,
usize buf_size )
static

Get the index mapping from event to counter.

Parameters
bufA buffer to receive indexes.
buf_sizeThe buffer's size in bytes, should not smaller than kpep_config_events_count() * sizeof(kpc_config_t).
Returns
kpep_config_error_code, 0 for success.

Definition at line 549 of file apple_arm_events.h.

Referenced by setup_performance_counters().

◆ kpep_config_remove_event

int(* kpep_config_remove_event) (kpep_config *cfg, usize idx) ( kpep_config * cfg,
usize idx )
static

Remove event at index.

Returns
kpep_config_error_code, 0 for success.

Definition at line 509 of file apple_arm_events.h.

◆ kpep_db_aliases

int(* kpep_db_aliases) (kpep_db *db, const char **buf, usize buf_size) ( kpep_db * db,
const char ** buf,
usize buf_size )
static

Get all alias.

Parameters
bufA buffer to receive all alias strings.
buf_sizeThe buffer's size in bytes, should not smaller than kpep_db_aliases_count() * sizeof(void *).
Returns
kpep_config_error_code, 0 for success.

Definition at line 573 of file apple_arm_events.h.

◆ kpep_db_aliases_count

int(* kpep_db_aliases_count) (kpep_db *db, usize *count) ( kpep_db * db,
usize * count )
static

Get the event alias count.

Returns
kpep_config_error_code, 0 for success.

Definition at line 566 of file apple_arm_events.h.

◆ kpep_db_counters_count

int(* kpep_db_counters_count) (kpep_db *db, u8 classes, usize *count) ( kpep_db * db,
u8 classes,
usize * count )
static

Get counters count for given classes.

Parameters
classes1: Fixed, 2: Configurable.
Returns
kpep_config_error_code, 0 for success.

Definition at line 578 of file apple_arm_events.h.

◆ kpep_db_create

int(* kpep_db_create) (const char *name, kpep_db **db_ptr) ( const char * name,
kpep_db ** db_ptr )
static

Open a kpep database file in "/usr/share/kpep/" or "/usr/local/share/kpep/".

Parameters
nameFile name, for example "haswell", "cpu_100000c_1_92fb37c8". Pass NULL for current CPU.
Returns
kpep_config_error_code, 0 for success.

Definition at line 555 of file apple_arm_events.h.

Referenced by setup_performance_counters().

◆ kpep_db_event

int(* kpep_db_event) (kpep_db *db, const char *name, kpep_event **ev_ptr) ( kpep_db * db,
const char * name,
kpep_event ** ev_ptr )
static

Get one event by name.

Returns
kpep_config_error_code, 0 for success.

Definition at line 593 of file apple_arm_events.h.

Referenced by get_event().

◆ kpep_db_events

int(* kpep_db_events) (kpep_db *db, kpep_event **buf, usize buf_size) ( kpep_db * db,
kpep_event ** buf,
usize buf_size )
static

Get all events.

Parameters
bufA buffer to receive all event pointers.
buf_sizeThe buffer's size in bytes, should not smaller than kpep_db_events_count() * sizeof(void *).
Returns
kpep_config_error_code, 0 for success.

Definition at line 589 of file apple_arm_events.h.

◆ kpep_db_events_count

int(* kpep_db_events_count) (kpep_db *db, usize *count) ( kpep_db * db,
usize * count )
static

Get all event count.

Returns
kpep_config_error_code, 0 for success.

Definition at line 582 of file apple_arm_events.h.

◆ kpep_db_free

void(* kpep_db_free) (kpep_db *db) ( kpep_db * db)
static

Free the kpep database.

Definition at line 558 of file apple_arm_events.h.

◆ kpep_db_name

int(* kpep_db_name) (kpep_db *db, const char **name) ( kpep_db * db,
const char ** name )
static

Get the database's name.

Returns
kpep_config_error_code, 0 for success.

Definition at line 562 of file apple_arm_events.h.

◆ kpep_event_alias

int(* kpep_event_alias) (kpep_event *ev, const char **alias_ptr) ( kpep_event * ev,
const char ** alias_ptr )
static

Get event's alias.

Returns
kpep_config_error_code, 0 for success.

Definition at line 601 of file apple_arm_events.h.

◆ kpep_event_description

int(* kpep_event_description) (kpep_event *ev, const char **str_ptr) ( kpep_event * ev,
const char ** str_ptr )
static

Get event's description.

Returns
kpep_config_error_code, 0 for success.

Definition at line 605 of file apple_arm_events.h.

◆ kpep_event_name

int(* kpep_event_name) (kpep_event *ev, const char **name_ptr) ( kpep_event * ev,
const char ** name_ptr )
static

Get event's name.

Returns
kpep_config_error_code, 0 for success.

Definition at line 597 of file apple_arm_events.h.

◆ kperf_action_count_get

int(* kperf_action_count_get) (u32 *count) ( u32 * count)
static

Get number of actions.

sysctl get(kperf.action.count)

Definition at line 287 of file apple_arm_events.h.

◆ kperf_action_count_set

int(* kperf_action_count_set) (u32 count) ( u32 count)
static

Set number of actions, should be KPERF_ACTION_MAX.

sysctl set(kperf.action.count)

Definition at line 283 of file apple_arm_events.h.

◆ kperf_action_filter_set_by_pid

int(* kperf_action_filter_set_by_pid) (u32 actionid, i32 pid) ( u32 actionid,
i32 pid )
static

Apply a pid filter to the action, -1 to disable filter.

sysctl set(kperf.action.filter_by_pid)

Definition at line 304 of file apple_arm_events.h.

◆ kperf_action_filter_set_by_task

int(* kperf_action_filter_set_by_task) (u32 actionid, i32 port) ( u32 actionid,
i32 port )
static

Apply a task filter to the action, -1 to disable filter.

sysctl set(kperf.action.filter_by_task)

Definition at line 300 of file apple_arm_events.h.

◆ kperf_action_samplers_get

int(* kperf_action_samplers_get) (u32 actionid, u32 *sample) ( u32 actionid,
u32 * sample )
static

Get what to sample when a trigger fires an action.

sysctl get(kperf.action.samplers)

Definition at line 296 of file apple_arm_events.h.

◆ kperf_action_samplers_set

int(* kperf_action_samplers_set) (u32 actionid, u32 sample) ( u32 actionid,
u32 sample )
static

Set what to sample when a trigger fires an action, e.g. KPERF_SAMPLER_PMC_CPU.

sysctl set(kperf.action.samplers)

Definition at line 292 of file apple_arm_events.h.

◆ kperf_ns_to_ticks

u64(* kperf_ns_to_ticks) (u64 ns) ( u64 ns)
static

Nanoseconds to CPU ticks.

Definition at line 351 of file apple_arm_events.h.

◆ kperf_reset

int(* kperf_reset) (void) ( void )
static

Reset kperf: stop sampling, kdebug, timers and actions.

Returns
0 for success.

Definition at line 348 of file apple_arm_events.h.

◆ kperf_sample_get

int(* kperf_sample_get) (u32 *enabled) ( u32 * enabled)
static

Get is currently sampling.

sysctl get(kperf.sampling)

Definition at line 344 of file apple_arm_events.h.

◆ kperf_sample_set

int(* kperf_sample_set) (u32 enabled) ( u32 enabled)
static

Enable or disable sampling.

sysctl set(kperf.sampling)

Definition at line 340 of file apple_arm_events.h.

◆ kperf_tick_frequency

u64(* kperf_tick_frequency) (void) ( void )
static

CPU ticks frequency (mach_absolute_time).

Definition at line 357 of file apple_arm_events.h.

◆ kperf_ticks_to_ns

u64(* kperf_ticks_to_ns) (u64 ticks) ( u64 ticks)
static

CPU ticks to nanoseconds.

Definition at line 354 of file apple_arm_events.h.

◆ kperf_timer_action_get

int(* kperf_timer_action_get) (u32 actionid, u32 *timerid) ( u32 actionid,
u32 * timerid )
static

Get timer number and actionid.

sysctl get(kperf.timer.action)

Definition at line 328 of file apple_arm_events.h.

◆ kperf_timer_action_set

int(* kperf_timer_action_set) (u32 actionid, u32 timerid) ( u32 actionid,
u32 timerid )
static

Set timer number and actionid.

sysctl set(kperf.timer.action)

Definition at line 324 of file apple_arm_events.h.

◆ kperf_timer_count_get

int(* kperf_timer_count_get) (u32 *count) ( u32 * count)
static

Get number of time triggers.

sysctl get(kperf.timer.count)

Definition at line 312 of file apple_arm_events.h.

◆ kperf_timer_count_set

int(* kperf_timer_count_set) (u32 count) ( u32 count)
static

Set number of time triggers, should be KPERF_TIMER_MAX.

sysctl set(kperf.timer.count)

Definition at line 308 of file apple_arm_events.h.

◆ kperf_timer_period_get

int(* kperf_timer_period_get) (u32 actionid, u64 *tick) ( u32 actionid,
u64 * tick )
static

Get timer number and period.

sysctl get(kperf.timer.period)

Definition at line 320 of file apple_arm_events.h.

◆ kperf_timer_period_set

int(* kperf_timer_period_set) (u32 actionid, u64 tick) ( u32 actionid,
u64 tick )
static

Set timer number and period.

sysctl set(kperf.timer.period)

Definition at line 316 of file apple_arm_events.h.

◆ kperf_timer_pet_get

int(* kperf_timer_pet_get) (u32 *timerid) ( u32 * timerid)
static

Get which timer ID does PET (Profile Every Thread).

sysctl get(kperf.timer.pet_timer)

Definition at line 336 of file apple_arm_events.h.

◆ kperf_timer_pet_set

int(* kperf_timer_pet_set) (u32 timerid) ( u32 timerid)
static

Set which timer ID does PET (Profile Every Thread).

sysctl set(kperf.timer.pet_timer)

Definition at line 332 of file apple_arm_events.h.

◆ lib_err_msg

char lib_err_msg[256]
static

Definition at line 689 of file apple_arm_events.h.

Referenced by lib_init(), and setup_performance_counters().

◆ lib_handle_kperf

void* lib_handle_kperf = NULL
static

Definition at line 691 of file apple_arm_events.h.

Referenced by lib_deinit(), and lib_init().

◆ lib_handle_kperfdata

void* lib_handle_kperfdata = NULL
static

Definition at line 692 of file apple_arm_events.h.

Referenced by lib_deinit(), and lib_init().

◆ lib_has_err

bool lib_has_err = false
static

Definition at line 688 of file apple_arm_events.h.

Referenced by lib_deinit(), and lib_init().

◆ lib_inited

bool lib_inited = false
static

Definition at line 687 of file apple_arm_events.h.

Referenced by lib_deinit(), and lib_init().

◆ lib_symbols_kperf

const lib_symbol lib_symbols_kperf[]
static

Definition at line 620 of file apple_arm_events.h.

Referenced by lib_deinit(), and lib_init().

◆ lib_symbols_kperfdata

const lib_symbol lib_symbols_kperfdata[]
static
Initial value:
= {
}
static int(* kpep_db_create)(const char *name, kpep_db **db_ptr)
static int(* kpep_config_kpc_map)(kpep_config *cfg, usize *buf, usize buf_size)
static void(* kpep_db_free)(kpep_db *db)
Free the kpep database.
#define lib_symbol_def(name)
static int(* kpep_event_name)(kpep_event *ev, const char **name_ptr)
static int(* kpep_config_add_event)(kpep_config *cfg, kpep_event **ev_ptr, u32 flag, u32 *err)
static int(* kpep_config_events_count)(kpep_config *cfg, usize *count_ptr)
static int(* kpep_config_kpc_classes)(kpep_config *cfg, u32 *classes_ptr)
static int(* kpep_db_events)(kpep_db *db, kpep_event **buf, usize buf_size)
static int(* kpep_db_aliases_count)(kpep_db *db, usize *count)
static int(* kpep_config_kpc)(kpep_config *cfg, kpc_config_t *buf, usize buf_size)
static void(* kpep_config_free)(kpep_config *cfg)
Free the config.
static int(* kpep_db_aliases)(kpep_db *db, const char **buf, usize buf_size)
static int(* kpep_event_description)(kpep_event *ev, const char **str_ptr)
static int(* kpep_config_create)(kpep_db *db, kpep_config **cfg_ptr)
static int(* kpep_db_event)(kpep_db *db, const char *name, kpep_event **ev_ptr)
static int(* kpep_config_kpc_count)(kpep_config *cfg, usize *count_ptr)
static int(* kpep_db_events_count)(kpep_db *db, usize *count)
static int(* kpep_db_counters_count)(kpep_db *db, u8 classes, usize *count)
static int(* kpep_event_alias)(kpep_event *ev, const char **alias_ptr)
static int(* kpep_config_events)(kpep_config *cfg, kpep_event **buf, usize buf_size)
static int(* kpep_config_remove_event)(kpep_config *cfg, usize idx)
static int(* kpep_db_name)(kpep_db *db, const char **name)
static int(* kpep_config_force_counters)(kpep_config *cfg)

Definition at line 657 of file apple_arm_events.h.

Referenced by lib_deinit(), and lib_init().

◆ profile_events

const event_alias profile_events[]
static
Initial value:
= {
{"cycles",
{
"FIXED_CYCLES",
"CPU_CLK_UNHALTED.THREAD",
"CPU_CLK_UNHALTED.CORE",
}},
{"instructions",
{
"FIXED_INSTRUCTIONS",
"INST_RETIRED.ANY"
}},
{"branches",
{
"INST_BRANCH",
"BR_INST_RETIRED.ALL_BRANCHES",
"INST_RETIRED.ANY",
}},
{"branch-misses",
{
"BRANCH_MISPRED_NONSPEC",
"BRANCH_MISPREDICT",
"BR_MISP_RETIRED.ALL_BRANCHES",
"BR_INST_RETIRED.MISPRED",
}},
}

Event names from /usr/share/kpep/<name>.plist.

Definition at line 921 of file apple_arm_events.h.

Referenced by setup_performance_counters().

◆ regs

Definition at line 961 of file apple_arm_events.h.

Referenced by setup_performance_counters().