|
Ada 4.1.1
Fast spec-compliant URL parser
|
#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 |
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]) |
| #define EVENT_NAME_MAX 8 |
Definition at line 914 of file apple_arm_events.h.
Referenced by get_event().
| #define KDBG_CKTYPES 0xF0000 |
Definition at line 802 of file apple_arm_events.h.
| #define KDBG_CLASSTYPE 0x10000 |
Definition at line 798 of file apple_arm_events.h.
| #define KDBG_RANGETYPE 0x40000 |
Definition at line 800 of file apple_arm_events.h.
| #define KDBG_SUBCLSTYPE 0x20000 |
Definition at line 799 of file apple_arm_events.h.
| #define KDBG_TYPENONE 0x80000 |
Definition at line 801 of file apple_arm_events.h.
| #define KDBG_VALCHECK 0x00200000U |
Definition at line 805 of file apple_arm_events.h.
| #define KPC_CLASS_CONFIGURABLE (1) |
Definition at line 126 of file apple_arm_events.h.
| #define KPC_CLASS_CONFIGURABLE_MASK (1u << KPC_CLASS_CONFIGURABLE) |
Definition at line 132 of file apple_arm_events.h.
Referenced by setup_performance_counters().
| #define KPC_CLASS_FIXED (0) |
Definition at line 125 of file apple_arm_events.h.
| #define KPC_CLASS_FIXED_MASK (1u << KPC_CLASS_FIXED) |
Definition at line 131 of file apple_arm_events.h.
| #define KPC_CLASS_POWER (2) |
Definition at line 127 of file apple_arm_events.h.
| #define KPC_CLASS_POWER_MASK (1u << KPC_CLASS_POWER) |
Definition at line 133 of file apple_arm_events.h.
| #define KPC_CLASS_RAWPMU (3) |
Definition at line 128 of file apple_arm_events.h.
| #define KPC_CLASS_RAWPMU_MASK (1u << KPC_CLASS_RAWPMU) |
Definition at line 134 of file apple_arm_events.h.
| #define KPC_MAX_COUNTERS 32 |
Definition at line 148 of file apple_arm_events.h.
Referenced by get_counters().
| #define KPC_PMU_ARM_APPLE (2) |
Definition at line 139 of file apple_arm_events.h.
| #define KPC_PMU_ARM_V2 (4) |
Definition at line 141 of file apple_arm_events.h.
| #define KPC_PMU_ERROR (0) |
Definition at line 137 of file apple_arm_events.h.
| #define KPC_PMU_INTEL_V2 (3) |
Definition at line 140 of file apple_arm_events.h.
| #define KPC_PMU_INTEL_V3 (1) |
Definition at line 138 of file apple_arm_events.h.
| #define KPEP_ARCH_ARM 2 |
Definition at line 380 of file apple_arm_events.h.
| #define KPEP_ARCH_ARM64 3 |
Definition at line 381 of file apple_arm_events.h.
| #define KPEP_ARCH_I386 0 |
Definition at line 378 of file apple_arm_events.h.
| #define KPEP_ARCH_X86_64 1 |
Definition at line 379 of file apple_arm_events.h.
| #define KPERF_ACTION_MAX (32) |
Definition at line 168 of file apple_arm_events.h.
| #define KPERF_SAMPLER_KSTACK (1U << 2) |
Definition at line 154 of file apple_arm_events.h.
| #define KPERF_SAMPLER_MEMINFO (1U << 7) |
Definition at line 159 of file apple_arm_events.h.
| #define KPERF_SAMPLER_PMC_CONFIG (1U << 6) |
Definition at line 158 of file apple_arm_events.h.
| #define KPERF_SAMPLER_PMC_CPU (1U << 5) |
Definition at line 157 of file apple_arm_events.h.
| #define KPERF_SAMPLER_PMC_THREAD (1U << 4) |
Definition at line 156 of file apple_arm_events.h.
| #define KPERF_SAMPLER_SYS_MEM (1U << 11) |
Definition at line 163 of file apple_arm_events.h.
| #define KPERF_SAMPLER_TH_DISPATCH (1U << 9) |
Definition at line 161 of file apple_arm_events.h.
| #define KPERF_SAMPLER_TH_INFO (1U << 0) |
Definition at line 152 of file apple_arm_events.h.
| #define KPERF_SAMPLER_TH_INSCYC (1U << 12) |
Definition at line 164 of file apple_arm_events.h.
| #define KPERF_SAMPLER_TH_SCHEDULING (1U << 8) |
Definition at line 160 of file apple_arm_events.h.
| #define KPERF_SAMPLER_TH_SNAPSHOT (1U << 1) |
Definition at line 153 of file apple_arm_events.h.
| #define KPERF_SAMPLER_TK_INFO (1U << 13) |
Definition at line 165 of file apple_arm_events.h.
| #define KPERF_SAMPLER_TK_SNAPSHOT (1U << 10) |
Definition at line 162 of file apple_arm_events.h.
| #define KPERF_SAMPLER_USTACK (1U << 3) |
Definition at line 155 of file apple_arm_events.h.
| #define KPERF_TIMER_MAX (8) |
Definition at line 171 of file apple_arm_events.h.
| #define lib_nelems | ( | x | ) |
Definition at line 616 of file apple_arm_events.h.
Referenced by lib_deinit(), and lib_init().
| #define lib_path_kperf "/System/Library/PrivateFrameworks/kperf.framework/kperf" |
Definition at line 683 of file apple_arm_events.h.
Referenced by lib_init().
| #define lib_path_kperfdata "/System/Library/PrivateFrameworks/kperfdata.framework/kperfdata" |
Definition at line 684 of file apple_arm_events.h.
Referenced by lib_init().
| #define lib_symbol_def | ( | name | ) |
Definition at line 617 of file apple_arm_events.h.
| #define return_err | ( | ) |
Referenced by lib_init().
| typedef float f32 |
Definition at line 106 of file apple_arm_events.h.
| typedef double f64 |
Definition at line 107 of file apple_arm_events.h.
| typedef int16_t i16 |
Definition at line 110 of file apple_arm_events.h.
| typedef int32_t i32 |
Definition at line 112 of file apple_arm_events.h.
| typedef int64_t i64 |
Definition at line 114 of file apple_arm_events.h.
| typedef int8_t i8 |
Definition at line 108 of file apple_arm_events.h.
| typedef uintptr_t kd_buf_argtype |
Definition at line 775 of file apple_arm_events.h.
| typedef u64 kpc_config_t |
Definition at line 174 of file apple_arm_events.h.
| typedef struct kpep_config kpep_config |
KPEP config (size: 80/44 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_event kpep_event |
KPEP event (size: 48/28 bytes on 64/32 bit OS).
| typedef uint16_t u16 |
Definition at line 111 of file apple_arm_events.h.
| typedef uint32_t u32 |
Definition at line 113 of file apple_arm_events.h.
| typedef uint64_t u64 |
Definition at line 115 of file apple_arm_events.h.
| typedef uint8_t u8 |
Definition at line 109 of file apple_arm_events.h.
| typedef size_t usize |
Definition at line 116 of file apple_arm_events.h.
Error code for kpep_config_xxx() and kpep_db_xxx() functions.
Definition at line 440 of file apple_arm_events.h.
|
inline |
Definition at line 1081 of file apple_arm_events.h.
References counter_map, counters_0, kpc_get_thread_counters, and KPC_MAX_COUNTERS.
Referenced by event_collector::end(), and event_collector::start().
|
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().
|
static |
Retrieve trace buffer information from kernel.
Definition at line 871 of file apple_arm_events.h.
|
static |
Disable and reinitialize the trace buffers.
Definition at line 841 of file apple_arm_events.h.
|
static |
Clean up trace buffers and reset ktrace/kdebug/kperf.
Definition at line 834 of file apple_arm_events.h.
|
static |
Set debug filter.
Definition at line 847 of file apple_arm_events.h.
|
static |
Enable or disable kdebug trace. Trace buffer must already be initialized.
Definition at line 864 of file apple_arm_events.h.
Retrieve trace buffers from kernel.
| buf | Memory to receive buffer data, array of kd_buf. |
| len | Length of buf in bytes. |
| count | Number of trace entries (kd_buf) obtained. |
Definition at line 883 of file apple_arm_events.h.
|
static |
Set maximum number of trace entries (kd_buf). Only allow allocation up to half the available memory (sane_size).
Definition at line 856 of file apple_arm_events.h.
|
static |
Block until there are new buffers filled or timeout_ms have passed.
| timeout_ms | timeout milliseconds, 0 means wait forever. |
| suc | set true if new buffers filled. |
Definition at line 901 of file apple_arm_events.h.
|
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().
|
static |
Get lightweight PET mode (not in kperf.framework).
Definition at line 360 of file apple_arm_events.h.
|
static |
Set lightweight PET mode (not in kperf.framework).
Definition at line 367 of file apple_arm_events.h.
|
static |
Definition at line 694 of file apple_arm_events.h.
References lib_symbol::impl, lib_handle_kperf, lib_handle_kperfdata, lib_has_err, lib_inited, lib_nelems, lib_symbols_kperf, and lib_symbols_kperfdata.
|
static |
Definition at line 711 of file apple_arm_events.h.
References lib_symbol::impl, lib_err_msg, lib_handle_kperf, lib_handle_kperfdata, lib_has_err, lib_inited, lib_nelems, lib_path_kperf, lib_path_kperfdata, lib_symbols_kperf, lib_symbols_kperfdata, lib_symbol::name, and return_err.
Referenced by setup_performance_counters().
|
inline |
Definition at line 99 of file apple_arm_events.h.
References performance_counters::branches, performance_counters::cycles, performance_counters::instructions, and performance_counters::missed_branches.
| bool setup_performance_counters | ( | ) |
Definition at line 967 of file apple_arm_events.h.
References event_alias::alias, counter_map, ev_count, get_event(), KPC_CLASS_CONFIGURABLE_MASK, kpc_force_all_ctrs_get, kpc_force_all_ctrs_set, kpc_set_config, kpc_set_counting, kpc_set_thread_counting, kpep_config_add_event, kpep_config_create, kpep_config_error_desc(), kpep_config_force_counters, kpep_config_kpc, kpep_config_kpc_classes, kpep_config_kpc_count, kpep_config_kpc_map, kpep_db_create, lib_err_msg, lib_init(), kpep_db::marketing_name, kpep_db::name, profile_events, and regs.
| 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().
| u64 counters_0[KPC_MAX_COUNTERS] = {0} |
Definition at line 963 of file apple_arm_events.h.
Referenced by get_counters().
| u64 counters_1[KPC_MAX_COUNTERS] = {0} |
Definition at line 964 of file apple_arm_events.h.
| 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().
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.
sysctl get(hw.cputype), get(hw.cpusubtype), get(hw.cpufamily), get(machdep.cpu.model)
Definition at line 183 of file apple_arm_events.h.
|
static |
Get the state of all_ctrs.
sysctl get(kpc.force_all_ctrs)
Definition at line 279 of file apple_arm_events.h.
Referenced by setup_performance_counters().
|
static |
Acquire/release the counters used by the Power Manager.
| val | 1:acquire, 0:release |
sysctl set(kpc.force_all_ctrs)
Definition at line 274 of file apple_arm_events.h.
Referenced by setup_performance_counters().
|
static |
Get config registers.
| classes | see class mask constants above. |
| config | Config buffer to receive values, should not smaller than kpc_get_config_count(classes) * sizeof(kpc_config_t). |
sysctl get(kpc.config_count), get(kpc.config)
Definition at line 229 of file apple_arm_events.h.
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.
| classes | See class mask constants above. |
sysctl get(kpc.config_count)
Definition at line 221 of file apple_arm_events.h.
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.
| classes | See class mask constants above. |
sysctl get(kpc.counter_count)
Definition at line 245 of file apple_arm_events.h.
|
static |
Get running PMC classes.
sysctl get(kpc.counting)
Definition at line 194 of file apple_arm_events.h.
|
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).
| all_cpus | true for all CPUs, false for current cpu. |
| classes | See class mask constants above. |
| curcpu | A pointer to receive current cpu id, can be NULL. |
| buf | Buffer to receive counter's value. |
sysctl get(hw.ncpu), get(kpc.counter_count), get(kpc.counters)
Definition at line 258 of file apple_arm_events.h.
|
static |
Get counter accumulations for current thread.
| tid | Thread id, should be 0. |
| buf_count | The number of buf's elements (not bytes), should not smaller than kpc_get_counter_count(). |
| buf | Buffer to receive counter's value. |
sysctl get(kpc.thread_counters)
Definition at line 268 of file apple_arm_events.h.
Referenced by get_counters().
|
static |
Get running PMC classes for current thread.
sysctl get(kpc.thread_counting)
Definition at line 206 of file apple_arm_events.h.
|
static |
Get the version of KPC that's being run.
sysctl get(kpc.pmu_version)
Definition at line 188 of file apple_arm_events.h.
|
static |
Set config registers.
| classes | see class mask constants above. |
| config | Config buffer, should not smaller than kpc_get_config_count(classes) * sizeof(kpc_config_t). |
sysctl get(kpc.config_count), set(kpc.config)
Definition at line 237 of file apple_arm_events.h.
Referenced by setup_performance_counters().
Set PMC classes to enable counting.
| classes | See class mask constants above, set 0 to shutdown counting. |
sysctl set(kpc.counting)
Definition at line 200 of file apple_arm_events.h.
Referenced by setup_performance_counters().
Set PMC classes to enable counting for current thread.
| classes | See class mask constants above, set 0 to shutdown counting. |
sysctl set(kpc.thread_counting)
Definition at line 212 of file apple_arm_events.h.
Referenced by setup_performance_counters().
|
static |
Add an event to config.
| cfg | The config. |
| ev_ptr | A event pointer. |
| flag | 0: all, 1: user space only |
| err | Error 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. |
Definition at line 504 of file apple_arm_events.h.
Referenced by setup_performance_counters().
|
static |
Create a config.
| db | A kpep db, see kpep_db_create() |
| cfg_ptr | A pointer to receive the new config. |
Definition at line 491 of file apple_arm_events.h.
Referenced by setup_performance_counters().
|
static |
Error description for kpep_config_error_code.
Definition at line 461 of file apple_arm_events.h.
Referenced by kpep_config_error_desc().
|
static |
Get all event pointers.
| buf | A buffer to receive event pointers. |
| buf_size | The buffer's size in bytes, should not smaller than kpep_config_events_count() * sizeof(void *). |
Definition at line 524 of file apple_arm_events.h.
|
static |
Get events count.
Definition at line 517 of file apple_arm_events.h.
|
static |
Force all counters.
Definition at line 513 of file apple_arm_events.h.
Referenced by setup_performance_counters().
|
static |
Free the config.
Definition at line 494 of file apple_arm_events.h.
|
static |
Get kpc register configs.
| buf | A buffer to receive kpc register configs. |
| buf_size | The buffer's size in bytes, should not smaller than kpep_config_kpc_count() * sizeof(kpc_config_t). |
Definition at line 532 of file apple_arm_events.h.
Referenced by setup_performance_counters().
|
static |
Get kpc classes.
| classes | See class mask constants above. |
Definition at line 542 of file apple_arm_events.h.
Referenced by setup_performance_counters().
|
static |
Get kpc register config count.
Definition at line 537 of file apple_arm_events.h.
Referenced by setup_performance_counters().
|
static |
Get the index mapping from event to counter.
| buf | A buffer to receive indexes. |
| buf_size | The buffer's size in bytes, should not smaller than kpep_config_events_count() * sizeof(kpc_config_t). |
Definition at line 549 of file apple_arm_events.h.
Referenced by setup_performance_counters().
|
static |
Remove event at index.
Definition at line 509 of file apple_arm_events.h.
|
static |
Get all alias.
| buf | A buffer to receive all alias strings. |
| buf_size | The buffer's size in bytes, should not smaller than kpep_db_aliases_count() * sizeof(void *). |
Definition at line 573 of file apple_arm_events.h.
Get the event alias count.
Definition at line 566 of file apple_arm_events.h.
|
static |
Get counters count for given classes.
| classes | 1: Fixed, 2: Configurable. |
Definition at line 578 of file apple_arm_events.h.
|
static |
Open a kpep database file in "/usr/share/kpep/" or "/usr/local/share/kpep/".
| name | File name, for example "haswell", "cpu_100000c_1_92fb37c8". Pass NULL for current CPU. |
Definition at line 555 of file apple_arm_events.h.
Referenced by setup_performance_counters().
|
static |
Get one event by name.
Definition at line 593 of file apple_arm_events.h.
Referenced by get_event().
|
static |
Get all events.
| buf | A buffer to receive all event pointers. |
| buf_size | The buffer's size in bytes, should not smaller than kpep_db_events_count() * sizeof(void *). |
Definition at line 589 of file apple_arm_events.h.
Get all event count.
Definition at line 582 of file apple_arm_events.h.
Free the kpep database.
Definition at line 558 of file apple_arm_events.h.
Get the database's name.
Definition at line 562 of file apple_arm_events.h.
|
static |
Get event's alias.
Definition at line 601 of file apple_arm_events.h.
|
static |
Get event's description.
Definition at line 605 of file apple_arm_events.h.
|
static |
Get event's name.
Definition at line 597 of file apple_arm_events.h.
Get number of actions.
sysctl get(kperf.action.count)
Definition at line 287 of file apple_arm_events.h.
Set number of actions, should be KPERF_ACTION_MAX.
sysctl set(kperf.action.count)
Definition at line 283 of file apple_arm_events.h.
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.
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.
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.
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.
Nanoseconds to CPU ticks.
Definition at line 351 of file apple_arm_events.h.
|
static |
Reset kperf: stop sampling, kdebug, timers and actions.
Definition at line 348 of file apple_arm_events.h.
Get is currently sampling.
sysctl get(kperf.sampling)
Definition at line 344 of file apple_arm_events.h.
Enable or disable sampling.
sysctl set(kperf.sampling)
Definition at line 340 of file apple_arm_events.h.
|
static |
CPU ticks frequency (mach_absolute_time).
Definition at line 357 of file apple_arm_events.h.
CPU ticks to nanoseconds.
Definition at line 354 of file apple_arm_events.h.
Get timer number and actionid.
sysctl get(kperf.timer.action)
Definition at line 328 of file apple_arm_events.h.
Set timer number and actionid.
sysctl set(kperf.timer.action)
Definition at line 324 of file apple_arm_events.h.
Get number of time triggers.
sysctl get(kperf.timer.count)
Definition at line 312 of file apple_arm_events.h.
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.
Get timer number and period.
sysctl get(kperf.timer.period)
Definition at line 320 of file apple_arm_events.h.
Set timer number and period.
sysctl set(kperf.timer.period)
Definition at line 316 of file apple_arm_events.h.
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.
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.
|
static |
Definition at line 689 of file apple_arm_events.h.
Referenced by lib_init(), and setup_performance_counters().
|
static |
Definition at line 691 of file apple_arm_events.h.
Referenced by lib_deinit(), and lib_init().
|
static |
Definition at line 692 of file apple_arm_events.h.
Referenced by lib_deinit(), and lib_init().
|
static |
Definition at line 688 of file apple_arm_events.h.
Referenced by lib_deinit(), and lib_init().
|
static |
Definition at line 687 of file apple_arm_events.h.
Referenced by lib_deinit(), and lib_init().
|
static |
Definition at line 620 of file apple_arm_events.h.
Referenced by lib_deinit(), and lib_init().
|
static |
Definition at line 657 of file apple_arm_events.h.
Referenced by lib_deinit(), and lib_init().
|
static |
Event names from /usr/share/kpep/<name>.plist.
Definition at line 921 of file apple_arm_events.h.
Referenced by setup_performance_counters().
| kpc_config_t regs[KPC_MAX_COUNTERS] = {0} |
Definition at line 961 of file apple_arm_events.h.
Referenced by setup_performance_counters().