Miscellaneous stuff


Detailed Description

It is possible to use a simple form of memory profiling by configuring libfid with option --enable-memprof. If this option is given to the configure script, then the fid_ENABLE_MEMORY_PROFILING proprocessor symbols gets defined; the effect is that functions such as malloc() or strdup() get replaced by macros that call internal functions such as fid_memory_malloc() or fid_memory_strdup(). These replacement functions count the number of bytes allocated and deallocated, the number of (de-)allocations, and store the peak memory usage. The collected values can be obtained via functions fid_memory_query() or printed to some FILE pointer via fid_memory_show_usage(). These two names refer to real functions only if fid_ENABLE_MEMORY_PROFILING is defined, otherwise they are macros that expand to nothing.

There are, however, a few issues with this kind of memory profiling:

Despite the drawbacks sketched above, the memory profiling facilities built into libfid are advantageous if you don't want to see the memory overhead imposed by your system's libraries and heap manager, but only the amount of memory explicitly used by your program. Additionally, keeping track of allocations inside libfid is usally much more accurate than using sampling-based methods such as utilized by memtime for short running programs.

Defines

#define fid_NOTIMPLEMENTED_STDERR
 Print message to stderr, return with return value -1.
#define fid_NOTIMPLEMENTED(ERR)
 Put error into fid_Error ERR, return with return value -1.
#define fid_memory_query(P, C, A, F, T)
 Macro that expands to nothing.
#define fid_memory_show_usage(S)
 Macro that expands to nothing.

Functions

int fid_utils_parse_uint_32 (const char *string, fid_Uint32 *ui, fid_Error *error)
 Parse a 32 bit unsigned integer from string.
int fid_utils_parse_uint_64 (const char *string, fid_Uint64 *ui, fid_Error *error)
 Parse a 64 bit unsigned integer from string.


Define Documentation

#define fid_NOTIMPLEMENTED_STDERR

Value:

fprintf(stderr,"%s() [%s:%d]: not implemented yet\n",\
          __func__,__FILE__,__LINE__);\
  return -1
Print message to stderr, return with return value -1.

Definition at line 71 of file libdefs.h.

#define fid_NOTIMPLEMENTED ( ERR   ) 

Value:

fid_error_throw(ERR,"%s() [%s:%d]: not implemented yet",\
                  __func__,__FILE__,__LINE__);\
  return -1
Put error into fid_Error ERR, return with return value -1.

Definition at line 77 of file libdefs.h.

#define fid_memory_query ( P,
C,
A,
F,
 ) 

Macro that expands to nothing.

Definition at line 62 of file memory.h.

#define fid_memory_show_usage (  ) 

Macro that expands to nothing.

Definition at line 64 of file memory.h.


Function Documentation

int fid_utils_parse_uint_32 ( const char *  string,
fid_Uint32 ui,
fid_Error error 
)

Parse a 32 bit unsigned integer from string.

This function performs good error checking.

Parameters:
string Textual representation of an integer.
ui The parsed value as binary 32 bit value.
error Error messages go here.
Returns:
0 on success, -1 on error.

Definition at line 44 of file utilities.c.

References fid_error_throw(), and fid_utils_parse_uint_64().

int fid_utils_parse_uint_64 ( const char *  string,
fid_Uint64 ui,
fid_Error error 
)

Parse a 64 bit unsigned integer from string.

This function performs good error checking.

Parameters:
string Textual representation of an integer.
ui The parsed value as binary 64 bit value.
error Error messages go here.
Returns:
0 on success, -1 on error.

Definition at line 85 of file utilities.c.

References fid_error_throw().

Referenced by fid_utils_parse_uint_32().


Generated on Wed Jul 8 17:21:16 2009 for Full-text Index Data structure library by  doxygen 1.5.9