screenshot

My company introduced a new data visualization product called NZR earlier this year. It has since been downloaded and used by hundreds of programmers around the world. This is an unashamed plug for that product.

Printf has been a very useful function in debugging and visualizing the program flow and the data in every conceivable application. As the applications have grown in sophistication and speed, there has been an ever widening gap between the tools necessary to debug and what has been available. A new tool, called NZR, acts as a standalone application that is used to provide insights into the inner working of a program. It provides a real time 3D space to render different types of data that are being manipulated. It does so in a minimally invasive way, which helps in the debugging of real time systems. Real time systems are notorious for changing their behavior as increased instrumentation is used to expose the behavior and problems.


NZR is a Window’s tm application that exposes a 3D space to other window’s applications. A C++ library with an associated application programmers interface (API) exposes a simple interface to an application, enabling it to place a variety of objects in the NZR’s space. These objects are:

Displayable Objects
Each displayable object has two verbs that allow inserting and removing it from the NZR’s 3D space. They are “place” and “remove”.

• nzrText: Used for displaying text.
• nzrImage: Used for displaying images or other two dimensional data.
• nzrPoints: For displaying points.
• nzrGraphs: Used for displaying one dimensional data.
• nzrVolume: Used for displaying three dimensional data.
• nzrSphere: For displaying spheres.
• nzrPolyline: Used for displaying an arbitrarily shaped line in three dimensions.
• nzrOutline: Used for displaying a three dimensional outline.
• nzrFile: Used to insert a jpeg or 3ds file into the NZR space.

Support Objects
• nzrDisplay: This object allows the control of display attributes of objects that can be rendered. These attributes are Position, Color, scale, opacity, lighting model and orientation
• nzrLocalServer: Every application needs to instantiate this object. It moves the data from the server application to NZR. NZR is considered a visualization client and the nzr application is considered a data server. The server pushes the data to the client. nzrLocalServer has two useful member functions. The first one is “clearAll()” which clears all objects in the NZR space. The second is “render()” which makes all that has been placed, visible in the NZR space.
• nzrCamera: This object is used to set the viewpoint in the NZR space. The optimal values can be interactively established by setting the viewpoint and then reading the camera values from the dialog box in the scDoc window in NZR.
• nzrBackground: Used to set the back ground color.
• nzrLight: Used for setting the lights in the scene. The color, intensity, focal point and position can be selected. There are three types of lights available, namely headlight, scenelight and cameralight.

Code Flow
The typical code flow for using a nzr object is as follows:

• Instantiate the object and connect it with the nzrLocalServer object.
• Set the display attributes using the nzrDisplay object.
• Set the object specific attributes.
• Place the object in the NZR’s 3D space using the place function associated with each object.
• The object can be selectively removed from the scene by calling the remove function associated with it.

Sample Application

The System Monitor application is available on line that shows the real time behavior. This application visualizes the CPU usage and IP traffic on a PC. It also captures the desktop window. The CPU usage of four processes is displayed using nzrVolume object. Color and opacity mapping is used to highlight the CPU usage by different processes. The IP traffic on the wire is shown in two ways. The packet length vs. time is graphed using nzrGraph object. The IP source and destination addresses are mapped as points in a 3D space. The first three octets are mapped as x, y and z positions. The fourth octet is used to color the associated glyph and text. This program displays every packet that is on the wire connected to the PC.
As the call to detecting packets is a blocking call, a separate thread is used to handle it. A simple mutex is used to ensure that only one thread is sending data to NZR at any one time.
This application called SystemMonitorII ,along with a number of simpler tutorials can be downloaded from

www.softserv-intl.us

This example is described in greater detail at the codeproject site.

Views: 2045Share

Post to Twitter Tweet This Post

Comments

Leave a Reply




Spam Protection by WP-SpamFree