Enabling DTrace for Profiling C/C++/Fortran Applications

See Also 

In order to use the tools in the C/C++ DTrace Extended profile configuration, the Solaris user account that you use when you run the IDE must have sufficient DTrace privileges to observe system behavior. The user account must have the trace_user, dtrace_proc, and dtrace_kernel privileges.

When you try to run the tools without sufficient privileges, a message about special access required is displayed along with a Repair button. You can click the Repair button and enter the password for a privileged account such as root. The IDE then temporarily grants the required privileges to your account. To avoid these messages, you can grant the DTrace privileges to your account permanently.

To check your DTrace privileges, type the following at the command prompt:
/bin/ppriv $$

If your account has the required privileges, the ppriv command should return something similar to:

E: basic,dtrace_kernel,dtrace_proc,dtrace_user
I: basic,dtrace_kernel,dtrace_proc,dtrace_user
P: basic,dtrace_kernel,dtrace_proc,dtrace_user
L: all

The line that starts with "I:" is important because it specifies privileges that are inherited by programs started from your shell. If your account doesn't have the required inheritable privileges, and you do not have administrator privileges or root access to your system, you should ask your system administrator to add the dtrace_user, dtrace_proc, and dtrace_kernel inheritable privileges to your account.

If you have administrator privileges or root access to your system, you can grant your user account the required privileges as described below.

To permanently grant required DTrace privileges to a user account:

  1. Make sure the user account whose privileges you want to modify is logged out of the system.
  2. Log in as superuser (root) or another administrator user.
  3. Type the following at the command prompt, and replace username with the user account name you are modifying:
    $ usermod -K defaultpriv=basic,dtrace_kernel,dtrace_user,dtrace_proc username
You can then log in to the user account, start the IDE, and use the profiling tools with the DTrace data provider.

To temporarily grant required DTrace privileges to a user account:

  1. Type the following to determine the process ID of the shell's process:
    $ echo $$
  2. Become superuser (root) or another administrator user.
  3. Type the following, and replace process-ID with the process ID that was returned from the echo command :
    $ ppriv -s I+dtrace_user,dtrace_proc,dtrace_kernel process-ID
All commands typed in the shell specified by process-ID now inherit the required privileges. The user account can start the IDE in this shell and use the tools in the C/C++ DTrace Extended profile configuration.
See also
  Managing C/C++/Fortran Profile Configurations
Profiling C/C++/Fortran Projects
C/C++/Fortran Project Properties Dialog Box: Profile

Legal Notices