CNDObservabilityTool

NetBeans 6.7 C/C++ Pack introduced new feature Observability Tool.

Contents


Introduction

This tutorial demonstrates how to use new feature of C/C++ Development Pack: Observability Tool.


This feature works for Solaris and Linux OS, but you can use this feature from your Windows or MacOS laptop using C/++ Remote Development feature

Requirements

Software Version Required
NetBeans IDE (including C/C++ support) Version 6.7
Java Development Kit Version 6 or version 5
C/C++ compilers (Sun Studio, GCC or MinGW) any version


Solaris as a development platform

To demonstrate this feature we will use sample project ProfilingDemo. Create Sample Project and run it.


I have created new ProfilingDemo sample project and ran it on my OpenSolaris x86 workstation. New Run Monitor component with nice indicators occurred.


http://wiki.netbeans.org/attach/CNDObservabilityTool/CndObservabilityToolDemo1_CNDObservabilityTool.png


I can see some pictures for ¨CPU usage¨ and for ¨Threads usage¨ indicators, but for ¨Memory usage¨ I do not see graph I can see message that I should add SunStudio to Build Tools Collection. OK, I will add Sun Studio Compilers and Tools to the Build Tools Collection


http://wiki.netbeans.org/attach/CNDObservabilityTool/CNDObservabilityToolOptions_CNDObservabilityTool.png



and see what happened.



http://wiki.netbeans.org/attach/CNDObservabilityTool/CNDObservabilityToolDetails_CNDObservabilityTool.png


Now we can view the details of the information for each indicator in the Detailed View component which can be opened with the mouse click in the indicator. To navigate from the details to the source code use context menu action ¨Go To Source¨ our double mouse click. While project ProfilingDemo was running I have clicked on ¨Thread usage¨ indicator and saw the message ¨Looking for thread lock problems..¨.

http://wiki.netbeans.org/attach/CNDObservabilityTool/CNDObservabilityToolLookingFor_CNDObservabilityTool.png

Note: When I have seen this message first time I was sure that when some thread synchronization problems will occur I will automatically see the data in the ¨Thread Synchronization Details¨ window but no.. In the reality I should click on ¨Thread usage¨ indicator to update view as it will not be updated automatically. The same notice can be applied to ¨Monitor usage¨ and ¨CPU usage¨ indicators


Profile Properties

I had to add SunStudio Compiler Collections to enable ¨Memory usage¨ indicator and details view, is there some other providers I can use on my Solaris machine? The answer is YES.

Open Project Properties Profile node.


http://wiki.netbeans.org/attach/CNDObservabilityTool/CndObservabilityToolDemoProperties_CNDObservabilityTool.png


In the ¨Data Provider¨ combo box I see 3 items (on my Solaris): Sun Studio (which is selected by default on Solaris), DTrace and Simple(Indicators Only). That means I can try to use DTrace, I am not a local user (if I would be a local user I would have enough privileges to use DTrace), but let's try and see what will happen....


http://wiki.netbeans.org/attach/CNDObservabilityTool/CNDObservabilityToolDTrace_CNDObservabilityTool.png


¨CPU usage¨ and ¨Thread usage¨ monitors works just fine but for ¨Memory Monitor¨ we can see the message that I do not have privileges enough to run use this indicator, but there is a chance to fix this problem: ¨Repair¨ button! And I will try to fix the issue.

Please note that in case you are local user of the Solaris development machine ¨Memory usage¨ indicator will work for you just fine


http://wiki.netbeans.org/attach/CNDObservabilityTool/CNObservabilityToolGrantPriv_CNDObservabilityTool.png


If you are lucky and know the root password input it. If not... You cans ask your system administrator to grant you DTrace privileges.

DTrace privileges

To use DTrace as a Data Provide for C/C++ Observability Tool, your user account must have the dtrace_user, dtrace_proc, and dtrace_kernel privileges or your user account can be local.

To check your user privileges, type /bin/ppriv -v $$ | grep dtrace at a shell prompt. If your account doesn't have the required privileges, consult your system administrator. If you have root access to your system, you can grant your user account the required privileges.

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. Become superuser (root).
  3. Type the following:

$ usermod -K defaultpriv=basic,dtrace_kernel,dtrace_user,dtrace_proc user-name

To temporarily grant required DTrace privileges to a user account:

  1. Type the following to determint the process ID of the shell's process: $ echo $$
  2. Become superuser (root).
  3. In another shell, type the following:

$ ppriv -s I+dtrace_user,dtrace_proc,dtrace_kernel process-ID

All commands typed in the shell with the process-id inherit the required privileges.

Let's back to the NetBeans

When we have granted DTrace privileges we have seen the following picture

http://wiki.netbeans.org/attach/CNDObservabilityTool/CNDObservabilityToolWillShow_CNDObservabilityTool.png

And now let's rerun the project..


http://wiki.netbeans.org/attach/CNDObservabilityTool/CNDObservabilityToolDTraceWork_CNDObservabilityTool.png

Great!!! Everything works!

On Solaris we can use Sun Studio Compilers and Tools or DTrace

Linux as a development platform

Now let's run NetBeans on the Linux platform. We can see nice graphs for all indicators but if we will try to see details we will see the following picture


http://wiki.netbeans.org/attach/CNDObservabilityTool/CNDObservabilityToolLinixSimple_CNDObservabilityTool.png


Adding Sun Studio Compilers and Tools and selecting SunStudio as a Data Provider in the Profile Project Properties will change the picture


http://wiki.netbeans.org/attach/CNDObservabilityTool/CNDObservabilityToolLinixSS_CNDObservabilityTool.png

On Linux we can use Sun Studio Compilers and Tools or Simple (Indicators only) Data Provider which deliver information for indicators only

Windows and MacOS as a development platform

And now let's try to run C/C++ Observability Tool on Windows.

I have created new Fractal sample project and pushed Run button. The project was ran. No "Run Monitor" component was occurred.

http://wiki.netbeans.org/attach/CNDObservabilityTool/CNDObservabilityToolWindows_CNDObservabilityTool.png


I am wrong. It is here. It was just not popuped. Let's click on it..


http://wiki.netbeans.org/attach/CNDObservabilityTool/CNDObservabilityToolWindowsRunMonitor_CNDObservabilityTool.png


Does it mean I cannot use C/C++ Observability Tool on Windows or MacOS?

The answer is "It doesn't. You still can use C/C++ Observability Tool on Windows or MacOS" if you will use C/++ Remote Development feature|http://www.netbeans.org/kb/docs/cnd/remotedev-tutorial.html].

To demonstrate it I have add new Solaris x86machine to the list of my development hosts and will run ProfilingDemo on that remote Solaris x86 machine using Secure Copy as a synchronization mode (I have no SAMBA on my Windows machine)

http://wiki.netbeans.org/attach/CNDObservabilityTool/CNDObservabilityToolWindowsNewHost_1_CNDObservabilityTool.png


http://wiki.netbeans.org/attach/CNDObservabilityTool/CNDObservabilityToolWindowsRemoteRun_CNDObservabilityTool.png

Where to go

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo