Commit [c0b7ac]  Maximize  Restore  History

Make operf/ocount detect invalid timer mode from opcontrol

Certain architecture/processor models are not supported by the
legacy oprofile kernel driver, so the cpu type detected (when
opcontrol is run) is "timer". If a user runs opcontrol on such
a system and does not unload the oprofile kernel module (using
'opcontrol --deinit') prior to using operf or ocount, the operf
and ocount tools will fail; for example, running 'operf <cmd>'
(with no event specified) will fail with the following unhelpful

Unable to find default event

This failure is due to how operf and ocount ascertain the cpu
type by calling libop/op_events.c:op_get_cpu_type(). That function
will look first in the oprofilefs (/dev/oprofile/cpu_type, in particular)
to try to determine the running cpu type. In the case described above,
the /dev/oprofile/cpu_type file contains 'timer', so operf and ocount
then try to find the default event for cpu type 'timer', but since timer
mode is not supported on either operf or ocount, there is default event,
so the tool fails.

Additionally, the ophelp command, when run in the same situation (where
the /dev/oprofile/cpu_type file contains 'timer') will not display the
expected list of native events; instead it simply says:
Using timer interrupt.

This patch makes operf and ocount exit immediately with a helpful message
if cpu type 'timer' is detected. A helpful message is also added to ophelp
for the same circumstances.

Signed-off-by: Maynard Johnson <>

Maynard Johnson Maynard Johnson 2014-01-31

changed pe_counting/ocount.cpp
changed pe_profiling/operf.cpp
changed utils/ophelp.c
pe_counting/ocount.cpp Diff Switch to side-by-side view
pe_profiling/operf.cpp Diff Switch to side-by-side view
utils/ophelp.c Diff Switch to side-by-side view

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks