Commit [9fba36]  Maximize  Restore  History

Fix 'Invalid argument' running 'opcontrol --start --callgraph=<n>' in Timer mode

When a processor type does not support oprofile event-based profiling,
the oprofile kernel driver writes "timer" to the /dev/oprofile/cpu_type
file. For some architectures, the architecture-specific oprofile
kernel driver does not set 'oprofile_operations.backtrace' when in timer
mode. When the opcontrol "--start" option is being executed,
one of the actions taken is to write the CALLGRAPH value from the daemonrc
file to /dev/oprofile/backtrace_depth. The function defined to respond to
writes to this file is drivers/oprofile/oprofile_files.c:depth_write().
In that function, if 'oprofile_operations.backtrace' is not set, it
returns -EINVAL, resulting in the following opcontrol error:
opcontrol: line 1172: echo: write error: Invalid argument

This patch detects when the system is in timer mode and handles this error
appropriately -- if simply writing '0' to backtrace_depth, the error is
ignored; otherwise, print a message that call graph is not supported on
this system in TIMER mode.

Signed-off-by: Maynard Johnson <>

Maynard Johnson Maynard Johnson 2014-07-14

changed utils/opcontrol
utils/opcontrol Diff Switch to side-by-side view