Skip to content

Instantly share code, notes, and snippets.

@mmozeiko
mmozeiko / _miniperf_readme.md
Last active June 13, 2025 20:41
get PMU counter values with ETW, perf or kperf

MiniPerf

Example of how to capture CPU counters with ETW on Windows, perf on Linux or kperf on Apple.

Using ETW needs somewhat recently updated Windows 10 or 11. Not sure about exact version.

Currently tested on:

  • etw on Qualcomm Snapdragon X Elite, Windows 11, arm64
  • etw on AMD Zen 3, Windows 11 (with virtualization enabled in BIOS)
@maluoi
maluoi / colorspace_cubehelix.cpp
Created November 11, 2020 03:20
Converts cubehelix HSL to RGB
// Reference here: http://www.mrao.cam.ac.uk/~dag/CUBEHELIX/
skg_color128_t skg_col_helix128(float h, float s, float l, float alpha) {
const float tau = 6.28318f;
l = fminf(1,l);
float angle = tau * (h+(1/3.f));
float amp = s * l * (1.f - l);
float a_cos = cosf(angle);
float a_sin = sinf(angle);
float r = l + amp * (-0.14861f * a_cos + 1.78277f * a_sin);