Skip to content
Kitbay
Skill

cpu-profile

Apache-2.0Updated on Nov 11, 202650,877GitHub stars

A skill kept in the ClickHouse repository for finding where a ClickHouse query spends CPU time, using the server's built-in sampling profiler rather than Linux perf.

What the skill teaches

A skill kept in the ClickHouse repository for finding where a ClickHouse query spends CPU time, using the server's built-in sampling profiler rather than Linux perf. Given a query ID, the agent analyses existing traces; given SQL, it runs the query through clickhouse-client with a fresh ID and fine-grained profiler settings; with no input it can list recent slow queries. Three parallel subagents pull the busiest leaf functions, the most common full stacks and a collapsed-stack export from the trace log, and the agent reports hotspots, a breakdown by subsystem and findings. Follow-ups filter by function, compare wall-clock with CPU samples or draw a flamegraph. It needs introspection functions enabled and the debug symbols package.

Capabilities

  • Run a ClickHouse query with the sampling profiler
  • List the busiest functions and stacks
  • Export collapsed stacks for a flamegraph
  • Compare wall-clock and CPU samples