I feel like this has probably been asked before but I was unable to find any post that addresses my questions.
I am attempting to profile a system daemon that I wrote on a Linux system (Ubuntu 14.04.5; 3.19 kernel) during its normal execution. My daemon starts running as root but then de-escalates its privileges to a system account (i.e. a daemon or service account with no password or login ability).
When I attempt to run collection using amplxe-cl as root and attach to my daemon process I get this error message:
amplxe: Error: Data collection is interrupted because credentials of the target process and VTune Amplifier do not match. Please start both target process and VTune Amplifier with the credentials of the same user and try collecting data again.
amplxe: Collection failed.
amplxe: Internal Error
I can understand in other cases but if I'm running as root, why can't I profile any process that I want?
Next I tried running amplxe-cl using sudo to run it as the same account that the daemon is running (let's say the username and group are "bob") like this:
sudo -u bob -g bob amplxe-cl -collect hotspots -r <some dir> --target-pid <some pid>
This appears to work, at least in that it doesn't fail and return an error immediately, but when I attempt to stop collection by hitting CTRL-C, nothing happens and the process hangs. I then attempted to issue the "stop" from another terminal and got this error:
amplxe: Error: Cannot handle the given command due to an internal error.
amplxe: Internal Error
Is there any way to profile my daemon without making code changes or system configuration changes?
I'm running vTune 2016 update 4 if that matters.
One quick advice to unblock you can be to run advanced-hotspot (HW-counter based analysis) to profile the whole system and then run the service. The collection can be stopped either by timeout of manually from a consol. Then you can group data by process in grid and concentrate on the process.
Thanks & Regards, Dmitry
Thanks for the reply. I guess that's a start for now.
Do you why, as root, I'm not allowed to profile any process? Is there some legitimate reason for this or is it a defect? If it is a defect I'd like to report it to the development team so it can be addressed in a future version.