MassifG Parser

MassifG Parser — Functions for parsing massif output files

Synopsis

                    MassifgHeapTreeNode;
                    MassifgSnapshot;
                    MassifgOutputData;
MassifgOutputData * massifg_parse_file                  (gchar *filename,
                                                         GError **error);
MassifgOutputData * massifg_parse_iochannel             (GIOChannel *io_channel,
                                                         GError **error);
void                massifg_output_data_free            (MassifgOutputData *data);

Description

These functions builds up a datastructure that represents the output from massif

Details

MassifgHeapTreeNode

typedef struct {
	gint num_children;
	glong total_mem_B;
	GString *label;

	/* Only used while parsing */
	gint parsing_remaining_children;
	gint parsing_depth; 
} MassifgHeapTreeNode;

Represents one node in the heap tree.

gint num_children;

The number of children this node has.

glong total_mem_B;

Memory usage under this node.

GString *label;

String label identifying which function this is.

gint parsing_remaining_children;

Used internally by the parser. Should be 0 after correct parsing.

gint parsing_depth;

Used internally by the parser. Should be equal to the depth of the tree.

MassifgSnapshot

typedef struct {
	gint snapshot_no;

	gint64 time;
	gint64 mem_heap_B;
	gint64 mem_heap_extra_B;
	gint64 mem_stacks_B;

	GString *heap_tree_desc;
	GNode *heap_tree;
} MassifgSnapshot;

Represents a single massif snapshot.

gint snapshot_no;

The number of this snapshot.

gint64 time;

Time this snapshot was taken. This can have different units, see MassifgOutputData

gint64 mem_heap_B;

Heap memory usage in bytes.

gint64 mem_heap_extra_B;

Heap overhead in bytes.

gint64 mem_stacks_B;

Stack memory usage in bytes.

GString *heap_tree_desc;

String describing what kind of heap tree we have.

GNode *heap_tree;

The heap tree as a tree of MassifgHeapTreeNode objects.

MassifgOutputData

typedef struct {
	GList *snapshots;

	GString *desc;
	GString *cmd;
	GString *time_unit;

	gint64 max_time;
	gint64 max_mem_allocation;
} MassifgOutputData;

Represents all the data massif outputs.

Note: max_time and max_mem_allocation is not provided by the massif output format directly but is provided by the parser. These attributes might go away in a future version.

GList *snapshots;

List of MassifgSnapshot objects representing the snapshots.

GString *desc;

Description string. Can be set by the user when running massif.

GString *cmd;

The command massif executed.

GString *time_unit;

The time unit massif used. Possible values are "i"|"ms"|"b".

gint64 max_time;

The maximum value of the time.

gint64 max_mem_allocation;

The maximum value of total memory allocation.

massifg_parse_file ()

MassifgOutputData * massifg_parse_file                  (gchar *filename,
                                                         GError **error);

Parse massif output data from file. See also massifg_parse_iochannel()

filename :

Path to file to parse. NULL is invalid

error :

Location to store a GError or NULL

Returns :

a MassifgOutputData that represents this data, or NULL on failure.

massifg_parse_iochannel ()

MassifgOutputData * massifg_parse_iochannel             (GIOChannel *io_channel,
                                                         GError **error);

Parse massif output data from a GIOChannel

io_channel :

GIOChannel to parse the data from

error :

Location to store a GError or NULL

Returns :

a MassifgOutputData that represents this data, or NULL on failure. Use massifg_output_data_free() to free

massifg_output_data_free ()

void                massifg_output_data_free            (MassifgOutputData *data);

Free a MassifgOutputData

data :

the MassifgOutputData to free