3.3   Instrumented Objects

In order to generate the level of detail you need to solve your problem, you may need to instrument some or all kernel libraries. You may also need to collect data from one or more additional libraries.

 


*

NOTE: The kernel library sigLib and the additional non-kernel library memLib are not selected by default.

The Selection Screen

Once you have selected Additional Instrumentation, you must decide which objects to log. The kernel objects that can be selected for logging from the Collection Configuration dialog box are tasks, semaphores, watchdog timers, message queues, and signals. Memory objects can also be selected. Select the libraries containing the objects you want to log by checking the box in front of the library name.

For all kernel objects except signals, you can enable instrumentation for a particular object, such as task t1, within your application code. You can also enable instrumentation for whole libraries programmatically if you wish. For information on how to specify data collection for AIL level logging in your code, see 7.3 Selecting Additional Libraries.

The Memory Library

When you select memLib, WindView logs the following events:

For detailed information about what parameters are logged for each event, which routines call them, and so on, see memLib.

Memory Analysis Pack

The view graph shows you when memory events occur, but the most interesting thing about your application's use of memory is how much is allocated at any time. WindView provides an analysis pack to calculate and display this information. To run it, display your log in the view graph and click . Select Memory Usage in the Analysis dialog box. To display the results of the calculation, click Export to Graph; the view graph displays the memUsage analog graph. (See Figure 3-7.)  

Memory Example

To see how WindView can find memory leaks, compile and load this example:

void func1 (int loopcnt) 
    { 
    int i; 
 
    for (i = 0; i < loopcnt; i++) 
        { 
        char *p1 = (char *)malloc (1023); 
        char *p2 = (char *)malloc (1017); 
        free ((void *)p1); 
 
        /* note: p2 points at an unreturned piece of system memory.  */ 
        } 
    exit (0); 
    }

Start WindView in additional instrumentation logging level with memLib selected. Run func1 from the shell with a parameter of 5. When func1 returns, stop WindView and display the view graph. Select the Memory Usage analysis pack, click Select All to calculate memory usage for all tasks, select Perform, and click Export to Graph to display the analog graph. The analog graph allows you to quickly identify when func1 was running, and to see that not all the memory it allocated was returned to the system memory pool. (See Figure 3-7.)