Main Page   Reference Manual   Namespace List   Compound List   Namespace Members   Compound Members   File Members  

Public Member Functions | Static Public Attributes | Friends | List of all members
libcwd::alloc_filter_ct Class Reference

An allocated-memory filter class.An object of this type can be passed to list_allocations_on containing formatting information for the Overview Of Allocated Memory . It can also be passed as argument to the constructor of a marker_ct object in order to specify which allocations should not be capatured by the marker (and optionally made invisible). More...

#include <libcwd/debug.h>

Public Member Functions

 alloc_filter_ct (alloc_format_t flags=0)
 Construct a formatting object.
 
void set_flags (alloc_format_t flags)
 Set the general formatting flags.
 
alloc_format_t get_flags (void) const
 Returns the flags as set with set_flags.
 
struct timeval get_time_start (void) const
 Returns the start time as passed with set_time_interval.
 
struct timeval get_time_end (void) const
 Returns the end time as passed with set_time_interval.
 
std::vector< std::string > get_objectfile_list (void) const
 Returns a copy of the list of object file masks. More...
 
std::vector< std::string > get_sourcefile_list (void) const
 Returns a copy of the list of source file masks. More...
 
std::vector< std::pair
< std::string, std::string > > 
get_function_list (void) const
 Return a copy of the list of object-file/function pair masks. More...
 
void set_time_interval (struct timeval const &start, struct timeval const &end)
 Select the time interval that should be shown. More...
 
void hide_objectfiles_matching (std::vector< std::string > const &masks)
 Select which object files to hide in the Allocated Memory Overview. More...
 
void hide_sourcefiles_matching (std::vector< std::string > const &masks)
 Select which source files to hide in the Allocated Memory Overview. More...
 
void hide_functions_matching (std::vector< std::pair< std::string, std::string > > const &masks)
 Select which object-file/function pairs to hide in the Allocator Memory Overview. More...
 
void hide_untagged_allocations (bool hide=true)
 Only show the allocations for which a AllocTag was added in the code. More...
 
void hide_unknown_locations (bool hide=true)
 Only show the allocations for which a source file and line number could be found. More...
 

Static Public Attributes

static struct timeval const no_time_limit
 

Friends

unsigned long list_allocations_on (debug_ct &, alloc_filter_ct const &)
 List all current allocations to a given debug object using a specified format.With CWDEBUG_ALLOC set to 1, it is possible to write the overview of allocated memory to a Debug Object. More...
 

Detailed Description

An allocated-memory filter class.

An object of this type can be passed to list_allocations_on containing formatting information for the Overview Of Allocated Memory . It can also be passed as argument to the constructor of a marker_ct object in order to specify which allocations should not be capatured by the marker (and optionally made invisible).

Member Function Documentation

std::vector<std::pair<std::string, std::string> > libcwd::alloc_filter_ct::get_function_list ( void  ) const

Return a copy of the list of object-file/function pair masks.

Don't use this function in a loop.

std::vector<std::string> libcwd::alloc_filter_ct::get_objectfile_list ( void  ) const

Returns a copy of the list of object file masks.

Don't use this function in a loop.

std::vector<std::string> libcwd::alloc_filter_ct::get_sourcefile_list ( void  ) const

Returns a copy of the list of source file masks.

Don't use this function in a loop.

void libcwd::alloc_filter_ct::hide_functions_matching ( std::vector< std::pair< std::string, std::string > > const &  masks)

Select which object-file/function pairs to hide in the Allocator Memory Overview.

masks is a list of pairs of masks. The first mask is matched against the object-file name of the location of the allocation, while the second mask is matched against the mangled function name of that location.  An unknown object-file or function does not cause a match.  If the object-file mask start with a '/' or with a '*' then it is matched against the full path of the object file (including possible "<tt>../</tt>" parts, it is matched against what is returned by location_ct::objectfile()->filepath().  Otherwise it is matched against just the name of the loaded executable or shared library (with path stripped off).

See Also
libcwd::location_ct::mangled_function_name, libcwd::location_ct::object_file, libcwd::object_file_ct
void libcwd::alloc_filter_ct::hide_objectfiles_matching ( std::vector< std::string > const &  masks)

Select which object files to hide in the Allocated Memory Overview.

masks is a list of wildcard expressions ('*' matches anything) that are matched against the name of the executable and all the shared library names (without their path). Object files that match will be hidden from the overview of allocated memory .

See Also
Format Of The Overview Of Allocated Memory
void libcwd::alloc_filter_ct::hide_sourcefiles_matching ( std::vector< std::string > const &  masks)

Select which source files to hide in the Allocated Memory Overview.

masks is a list of wildcard expressions ('*' matches anything) that are matched against the source file, including path, of the location where the allocation took place. Locations that match will be hidden from the overview of allocated memory .

See Also
Format Of The Overview Of Allocated Memory
void libcwd::alloc_filter_ct::hide_unknown_locations ( bool  hide = true)
inline

Only show the allocations for which a source file and line number could be found.

When hide is true, only allocations for which a location could be resolved are shown. This is the only way to get rid of allocations done in libraries without debugging information like a stripped glibc.

void libcwd::alloc_filter_ct::hide_untagged_allocations ( bool  hide = true)
inline

Only show the allocations for which a AllocTag was added in the code.

When hide is true, only allocations for which an AllocTag was seen are showed in the overview of allocated memory otherwise all allocations are being showed.

void libcwd::alloc_filter_ct::set_time_interval ( struct timeval const &  start,
struct timeval const &  end 
)

Select the time interval that should be shown.

The time interval outside of which allocations will not be shown in the allocated memory overview. start is the earliest time shown while end is the last time shown.

See Also
Format Of The Overview Of Allocated Memory

Friends And Related Function Documentation

unsigned long list_allocations_on ( debug_ct ,
alloc_filter_ct const &   
)
friend

List all current allocations to a given debug object using a specified format.With CWDEBUG_ALLOC set to 1, it is possible to write the overview of allocated memory to a Debug Object.

For example:

std::vector<std::string> masks;
masks.push_back("libc.so*");
masks.push_back("libstdc++*");
alloc_filter.hide_objectfiles_matching(masks);
alloc_filter.hide_unknown_locations();
);

which would print on libcw_do using debug channel dc::malloc , not showing allocations that belong to shared libraries matching "libc.so*" or "libstdc++*". The remaining items would show which object file (shared library name or the executable name) they belong to, because we used show_objectfile as flag.

Returns
the number of unfiltered (listed) allocations.
See Also
Format Of The Overview Of Allocated Memory

Member Data Documentation

struct timeval const libcwd::alloc_filter_ct::no_time_limit
static

The timeval used when there is no actual limit set, either start or end.

Copyright © 2001 - 2004 Carlo Wood.  All rights reserved.