### Usage

Category

Debugging

Function

Prints information about current use of resources.

Syntax

    Usage(what, how);

Inputs

Name | Type | Default | Description
--- | --- | --- | ---
`what` | string | none | the string to be printed
`how` | integer | 0 | level of detail

Functional Details

The output of this module appears in the Message window of the user interface. Since, the module traverses the entire memory, it can be used to check for corruption of the memory area.

`what` | specifies what resource information is to be printed. Currently, the only allowed value for this parameter is "memory."

`how`

specifies the level of detail of the printout.

`0`

Prints out a summary of the total current use of memory. A typical printout might look like:

    0: 58720256 bytes total : 1379008 in use, 57341248 free

`1`

Prints out a summary of current use of memory, both in small and in large arenas. A typical printout might look like:

    0: small: 4194304 = hdr 16472 + used 486864 +
                        free 3920 + pool 3687048 (limit 4194304)
    0: large: 2097152 = hdr 16472 + used 494656 +
                        free 29704 + pool 1558120 (limit 54525952)

where

`small` | is the total number of bytes currently managed by the memory manager for the small arena.
`large` | is the total number of bytes currently managed by the memory manager for the large arena.
`hdr` | is the amount of memory space used by internal data structures.
`used` | is the amount of memory space allocated for use.
`free` | is the amount of memory previously used and available for reuse.
`pool` | is the amount of memory space allocated to Data Explorer but not yet used.
`limit` | is the largest amount of memory that can be managed by the memory manager.

`2` | lists the number of blocks on each free list
`3` | lists the number of blocks on each free list plus the actual blocks on each free list
`4` | lists addresses of all allocated blocks (warning: very long)
`5` | lists addresses of all allocated and all freed blocks (warning: very long)

Note: You can easily specify Usage("memory", 0) by using the Show Memory Use button in the `Commands` menu of the Message window. The information provided by this module applies to memory use at the time of execution and should be interpreted with that restriction in mind. See DXPrintAlloc in IBM Visualization Data Explorer Programmer's Reference for more information.

Script Language Example

This example shows the use of memory before and after the Isosurface module is printed. (For this example, Data Explorer should be started with the `-readahead off` option.)

    electrondensity = Import("/usr/share/dx/samples/data/watermolecule");
    camera = AutoCamera(electrondensity,width=5);
    Usage("memory", 1);
    isosurface = Isosurface(electrondensity,0.3);
    Usage("memory", 1);
    Display(isosurface,camera);

See Also

Trace

[ OpenDX Home at IBM | OpenDX.org ]