Summary: Does the pthread_mutex lock profile have?
Summary: No, since there is no pthread_mutex trace point in user space.
According to the source file tools/perf/builtin-lock.c ( http://lxr.free-electrons.com/source/tools/perf/builtin-lock.c#L939 ) cmd_lock calls __cmd_record , which defines several trace points for perf record (via -e TRACEPOINT_NAME ), as well as the transfer parameters -R -m 1024 -c 1 - perf report . List of specific trace points: lock_tracepoints :
842 static const struct perf_evsel_str_handler lock_tracepoints[] = { 843 { "lock:lock_acquire", perf_evsel__process_lock_acquire, }, 844 { "lock:lock_acquired", perf_evsel__process_lock_acquired, }, 845 { "lock:lock_contended", perf_evsel__process_lock_contended, }, 846 { "lock:lock_release", perf_evsel__process_lock_release, }, 847 };
TRACE_EVENT(lock_acquire,.. is defined in trace/events/lock.h And trace_lock_acquire is defined only in kernel / locking / lockdep.c (double-check in debian codebase: http://codesearch.debian.net/search?q=trace_lock_acquire ). Only CONFIG_LOCKDEP is missing in your kernel according to kernel/locking/Makefile : obj-$(CONFIG_LOCKDEP) += lockdep.o (trace points are defined unconditionally in lockdep.c .
According to https://www.kernel.org/doc/Documentation/trace/tracepoints.txt all trace points are kernel-only, so perf lock will not detect user space locks.
You can try tracking points from LTTng, a project that declares user space trace points ( http://lttng.org/ust ). But there will be no ready statistics of blocking, but only raw data on trace points. You should also define trace points using the tracef() macro (recompile pthreads / glibc or try to create your own wrapper around pthread).
source share