- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Examples

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | Public Attributes

# Footprint Class Reference

Search for all occurrences

## Detailed Description

Class implementing the gathering of data footprint information.

It's always useful to know how much space your data occupies and how spread out it is. This class provides a simple method to gather that information for reporting and analysis. It's set up to accumulate data of interest recursively from a set of root objects.

This base implementation just collects total sizes. More complex implementations could gather size bucketing information, avoid collecting duplicates, track memory fragmentation, etc.

By putting it into a hierarchy you can choose how efficient the collection will be by the footprint object type you instantiate.

`#include <adskDebugFootprint.h>`

List of all members.

## Public Member Functions
| Footprint ()
| Default constructor - does nothing.
virtual | ~Footprint ()
| Default destructor - does nothing.
size_t | totalSize () const
| Return the total size of objects collected for.
size_t | totalFragments () const
| Return the total number of objects collected for.
virtual void | clear ()
| Clear out current footprint information.
virtual void | addMember (const void *where, size_t howBig)
| Use to add members of an object (e.g. strlen of a char*)
virtual void | addObject (const void *where, size_t howBig)
| Use to add real objects (e.g. "this" in a class)
## Static Public Member Functions
static bool | Debug (const Footprint *me, Print &request)
| Answer a Print request for a Footprint object.
static bool | Debug (const Footprint *me, Footprint &request)
| Answer a footprint request for a Footprint object.
## Public Attributes Search for all occurrences
bool | fSkipObject
| Count of objects in distinct locations. Search for all occurrences

## Member Function Documentation

size_t totalSize | ( |  | ) | const

Search for all occurrences

Return the total size of objects collected for.

Returns:
  Number of bytes reported for objects so far

size_t totalFragments | ( |  | ) | const

Search for all occurrences

Return the total number of objects collected for.

This count is useful for determining a rough estimate of fragmentation. The more objects there are the greater the possibility of fragmentation.

Returns:
  Number of objects so far

void addMember | ( | const void * | obj,
|  | size_t | howBig
| ) |  | `[virtual]`

Search for all occurrences

Use to add members of an object (e.g. strlen of a char*)

Add a new object to the footprint statistics.

Don't use this for real class objects, only native types. e.g. for a char* member in a class you'd use addMember(me->myStr, strlen(me->myStr))

Parameters:

  [in] | obj | Pointer to the object being collected
  [in] | howBig | Number of bytes the object occupies (including padding)

void addObject | ( | const void * | where,
|  | size_t | howBig
| ) |  | `[virtual]`

Search for all occurrences

Use to add real objects (e.g. "this" in a class)

Add a class object to the footprint statistics.

Use this version when adding real class objects. See the ParentFootprint macro in adskFootprint.h for information on collecting footprint information in a class hierarchy using this method.

Parameters:

  [in] | where | Pointer to the class object being added
  [in] | howBig | Size of the class object

bool Debug | ( | const Footprint * | me,
|  | Print & | request
| ) |  | `[static]`

Search for all occurrences

Answer a Print request for a Footprint object.

Use the request object to dump all information on the "me" Footprint, or all static Footprint information if "me" is NULL.

Parameters:

  [in] | me | Pointer to object to debug, NULL means class static
  [out] | request | Print request object

Returns:
  True if the request was successfully processed.

bool Debug | ( | const Footprint * | me,
|  | Footprint & | request
| ) |  | `[static]`

Search for all occurrences

Answer a footprint request for a Footprint object.

Populate the Footprint request with the information on all data stored within this class if "me" is NULL, otherwise the information stored in the Footprint object pointed at by "me".

Parameters:

  [in] | me | Pointer to object to footprint, NULL means class static
  [out] | request | Footprint object to populate

Returns:
  True if the request was successfully processed. The Footprint object will have all information added to it.

Footprint Footprint Footprint Footprint Footprint Footprint Footprint Footprint Footprint Footprint
Footprint Footprint Footprint Footprint Footprint Footprint Footprint Footprint Footprint Footprint