Skip to main content
Glama
walac

perf-mcp

by walac

perf_lock_contention

Identifies lock contention in Linux by analyzing wait times and stack traces, with optional BPF tracing to pinpoint where threads block.

Instructions

Detailed lock contention analysis showing where threads wait for locks, with optional BPF-based tracking.

Key parameters:

  • lock_addr: show lock addresses.

  • lock_owner: show which task holds the lock.

  • callstack_filter: filter by callstack pattern.

  • use_bpf: use BPF for live contention tracing.

  • type_filter: filter by lock type.

  • stack_skip: skip N stack frames.

Output: contention table with wait times and optional stacks. Requires: perf lock record or lock tracepoints.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cpuNoCPUs to filter
keyNoSort key
mapNoShow lock map
pidNoFilter by PID
tidNoFilter by TID
sortNoSort by key(s): contended,wait_total,wait_max,wait_min,avg_wait
forceNoDon't complain, do it
inputYesPath to perf.data file
quietNoDo not show any warnings
outputNoOutput file path
threadsNoShow per-thread stats
use_bpfNoUse BPF for contention tracing
verboseNoVerbosity level (0-2)
vmlinuxNovmlinux pathname
all_cpusNoSystem-wide collection
kallsymsNokallsyms pathname
lock_addrNoShow lock addresses
max_stackNoMaximum stack depth
lock_ownerNoShow lock owners
stack_skipNoNumber of stack frames to skip
lock_cgroupNoShow lock contention per cgroup
lock_filterNoFilter by specific lock addr/name
type_filterNoFilter by lock type
inject_delayNoInject delay in microseconds
cgroup_filterNoFilter by cgroup
combine_locksNoCombine locks by caller
dump_raw_traceNoDump raw trace in ASCII
map_nr_entriesNoMax entries for BPF maps
callstack_filterNoFilter by callstack pattern

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It explains the output ('contention table with wait times and optional stacks') and the prerequisites, and notes that BPF-based tracking is optional. This is useful context beyond the schema, though it does not cover potential failure modes or privilege requirements for BPF, so it is not a 5.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is relatively concise and front-loaded with the main purpose. The key parameters list is somewhat redundant given the schema, but it helps prioritize important options for a 29-parameter tool. The structure is clear and readable, earning a 4 rather than a 5 due to the redundant parameter list.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (29 parameters, output schema present, no annotations), the description provides a solid overview: purpose, output format, prerequisites, and optional modes. It does not explain every parameter (the schema handles that) and lacks sibling differentiation, but it is sufficiently complete for an agent to understand what the tool does and when it can be invoked.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3. The description lists key parameters with explanations that largely mirror the schema descriptions (e.g., 'lock_addr: show lock addresses' vs. schema 'Show lock addresses'). There is minimal added semantic value, though minor nuances like 'live' in 'use_bpf: use BPF for live contention tracing' provide a slight enhancement. Overall, the description does not meaningfully add beyond what the schema already provides.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Detailed lock contention analysis showing where threads wait for locks' with a specific verb and resource. It distinguishes itself as a detailed analysis tool, but does not explicitly differentiate from sibling tools like perf_lock_report or perf_lock_info, so it falls short of a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides a prerequisite ('Requires: perf lock record or lock tracepoints') which gives some context on when the tool can be used. However, it does not explicitly state when to use this tool versus alternatives, or provide when-not-to-use guidance. The 'detailed' emphasis implies usage for deeper analysis, but it is not explicit, so the guidance is only implied.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/walac/perf-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server