cache line locking on AMD x86_64 utilising L3 CAT pseudo-locking
26

Configure Feed

Select the types of activity you want to include in your feed.

icepick / include / icepick.h
3.2 kB 97 lines
1#ifndef ICEPICK_H 2#define ICEPICK_H 3 4#include <stddef.h> 5#include <stdint.h> 6#include <stdbool.h> 7 8#define ICEPICK_E_NO_CAT (-1) 9#define ICEPICK_E_PERMISSION (-2) 10#define ICEPICK_E_NO_CLOS (-3) 11#define ICEPICK_E_TOO_LARGE (-4) 12#define ICEPICK_E_NUMA (-5) 13#define ICEPICK_E_HUGEPAGE (-6) 14#define ICEPICK_E_VERIFY (-7) 15#define ICEPICK_E_INVALID (-8) 16#define ICEPICK_E_ALLOC (-9) 17#define ICEPICK_E_MSR (-10) 18#define ICEPICK_E_THREAD (-11) 19 20typedef enum { 21 ICEPICK_PRIME_TEMPORAL, 22 ICEPICK_PRIME_PREFETCHT2, 23 ICEPICK_PRIME_PREFETCHNTA, 24 ICEPICK_PRIME_NT_STORE, 25} icepick_prime_strategy_t; 26 27typedef enum { 28 ICEPICK_PATTERN_SEQUENTIAL, 29 ICEPICK_PATTERN_REVERSE, 30 ICEPICK_PATTERN_STRIDED, 31 ICEPICK_PATTERN_POINTER_CHASE, 32} icepick_access_pattern_t; 33 34typedef struct icepick_topology icepick_topology_t; 35typedef struct icepick_region icepick_region_t; 36typedef struct icepick_monitor icepick_monitor_t; 37 38typedef struct { 39 size_t size; 40 unsigned clos_id; 41 int numa_node; 42 bool huge_pages; 43 bool verify; 44 bool auto_monitor; 45 uint64_t pmu_poll_interval_ns; 46 uint64_t probe_interval_ns; 47 uint32_t miss_threshold; 48 icepick_prime_strategy_t prime_strategy; 49 icepick_access_pattern_t access_pattern; 50 size_t stride_bytes; 51 unsigned prime_iterations; 52} icepick_config_t; 53 54typedef struct { 55 uint64_t mean_ns; 56 uint64_t stddev_ns; 57 uint64_t p50_ns; 58 uint64_t p99_ns; 59 uint64_t p999_ns; 60 uint64_t min_ns; 61 uint64_t max_ns; 62} icepick_latency_stats_t; 63 64int icepick_discover_topology(icepick_topology_t **topo); 65void icepick_free_topology(icepick_topology_t *topo); 66 67unsigned icepick_topology_l3_ways(const icepick_topology_t *topo); 68size_t icepick_topology_l3_size(const icepick_topology_t *topo); 69size_t icepick_topology_way_size(const icepick_topology_t *topo); 70unsigned icepick_topology_max_clos(const icepick_topology_t *topo); 71unsigned icepick_topology_ccx_count(const icepick_topology_t *topo); 72bool icepick_topology_cat_supported(const icepick_topology_t *topo); 73 74int icepick_lock(icepick_topology_t *topo, const icepick_config_t *cfg, icepick_region_t **region); 75int icepick_unlock(icepick_region_t *region); 76 77void *icepick_region_ptr(const icepick_region_t *region); 78size_t icepick_region_size(const icepick_region_t *region); 79unsigned icepick_region_clos(const icepick_region_t *region); 80 81int icepick_verify(const icepick_region_t *region, icepick_latency_stats_t *stats); 82 83int icepick_bench(void *ptr, size_t size, size_t iterations, 84 icepick_latency_stats_t *stats); 85 86int icepick_monitor_start(icepick_region_t *region, icepick_monitor_t **mon); 87int icepick_monitor_start_ex(icepick_region_t *region, uint64_t pmu_poll_ns, 88 uint64_t probe_ns, uint32_t miss_thresh, 89 icepick_monitor_t **mon); 90int icepick_monitor_stop(icepick_monitor_t *mon); 91uint64_t icepick_monitor_eviction_count(const icepick_monitor_t *mon); 92uint64_t icepick_monitor_reprime_count(const icepick_monitor_t *mon); 93bool icepick_monitor_is_degraded(const icepick_monitor_t *mon); 94 95const char *icepick_strerror(int err); 96 97#endif