/* This file is part of odin, a memory profiler with fragmentation analysis. Copyright (C) 2007 Chris Wilson odin is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. odin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with odin. If not, see / The GNU General Public License is contained in the file COPYING. */ #ifndef CALLGRAPH_H #define CALLGRAPH_H G_BEGIN_DECLS typedef struct _tree_node TreeNode; struct _tree_node { TreeNode *left, *right; guint left_child:1; guint right_child:1; gint balance:30; /* height (left) - height (right) */ }; typedef struct _simple_hash_table SimpleHashTable; struct _simple_hash_table { guint size; CallGraphFrame **nodes; }; struct _call_graph_frame { Frame *frame; gboolean is_alloc_fn; const Allocator *allocator; guint depth; guint64 bytes; guint allocs; guint frees; guint size_allocs[32]; CallGraphFrame *parent; TreeNode node, *children; guint stamp; guint flags; guint index, old_index; CallGraphFrame **filter, **old_filter; guint n_filter, old_n_filter; CallGraphFrame *filter_parent; CallGraphFrame *next_by_ip, *next_by_fn; CallGraphFrame *ht_next_by_ip, *ht_next_by_fn; CallGraphFrame *next; }; struct _call_graph_store { GObject object; guint max_size_alloc; guint stamp; CallGraphFrame root, *frames; SimpleHashTable frames_by_ip; SimpleHashTable frames_by_fn; Chunk *frame_chunks; guint alloc_fns_serial; CallGraphFrame **nodes, **old_nodes; guint n_frames; }; struct _call_graph_store_class { GObjectClass parent_class; }; enum { CG_FRAME, CG_BYTES, CG_ALLOCS, CG_FREES, CG_DATA, CG_N_COLUMNS, }; CallGraphStore * call_graph_store_new (void); void call_graph_store_update (CallGraphStore *store, App *app, Allocator *allocators, guint since); void call_graph_store_update_tree_model (CallGraphStore *store); void call_graph_store_sort (CallGraphStore *store); void call_graph_store_filter (CallGraphStore *store, App *app); CallGraphFrame * call_graph_store_lookup_by_frame (CallGraphStore *store, const Frame *frame); CallGraphFrame * call_graph_store_lookup_by_fn (CallGraphStore *store, const gchar *function); GList * call_graph_store_get_parents (CallGraphStore *store, const Frame *frame); GList * call_graph_store_get_children (CallGraphStore *store, const Frame *frame); gboolean call_graph_store_get_iter (CallGraphStore *store, CallGraphFrame *frame, GtkTreeIter *iter); G_END_DECLS #endif /* CALLGRAPH_H */