Re: Using OProfile 1.2.0 without root privileges

William Cohen <[email protected]>
Newsgroups gmane.linux.oprofile
Message-ID <[email protected]>
On 06/06/2018 12:26 PM, Aditya Kashi wrote:
> Hello,
> I came across OProfile recently and it seems to be very useful. I could build it and it seems to be working on Ubuntu 18.04.
> I tried to profile a simple C++ code with operf. However, I cannot use it without sudo.
> 
>     $ /path/to/oprofile-1.2.0/bin/operf --version
>     Unexpected error running operf: Permission denied
> 
> However, this works:
> 
>     $ sudo /path/to/oprofile-1.2.0/bin/operf --version
>     /path/to/oprofile-1.2.0/bin/operf: oprofile 1.2.0 compiled on Jun  5 2018 14:26:25
> 
> What do I need to do to run it without admin privileges? I need to run it on a cluster that I have access to, but I cannot use sudo there. I don't necessarily need a system-wide profile, I think I can do with just profiling my executable.
> 
> Regards,
> Aditya

With newer kernels the  /proc/sys/kernel/perf_event_paranoid default setting is causing the problem.  You will need to change the value for  /proc/sys/kernel/perf_event_paranoid to 1 with the following command run as root:

sysctl kernel.perf_event_paranoid=1

References URLs:

https://superuser.com/questions/980632/run-perf-without-root-rights
http://vince-debian.blogspot.com/2016/02/making-oprofile-work-again-with-recent.html

-Will

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
oprofile-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oprofile-list
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.