3 #include <lttv/trace.h>
6 /* The main program maintains a few central data structures and relies
7 on modules for the rest. These data structures may be accessed by modules
8 through an exported API */
10 /* Extensible array of popt command line options. Modules add options as
11 they are loaded and initialized. */
14 lttv_attributes
*attributes_global
;
18 *hooks_program_before
,
22 // trace sets has to be put one in each new window_traceset
23 static lttv_trace_set
*traces
;
25 static char *aModule
, *aPath
, *aTrace
;
31 static void lttv_module_option(void *hook_data
);
33 static void lttv_module_path_option(void *hook_data
);
35 static void lttv_trace_option(void *hook_data
);
38 extern struct GMemVTable
*glib_mem_profiler_table
;
41 /* Since everything is done in modules, the main program only takes care
42 of the infrastructure. */
44 int main(int argc
, char **argv
) {
50 g_mem_set_vtable(glib_mem_profiler_table
);
51 g_message("Memory summary before main");
55 attributes_global
= lttv_attributes_new();
57 // traces = lttv_trace_set_new();
58 // lttv_attributes_set_pointer_pathname(attributes_global, "trace_set/default", traces);
60 /* Initialize the hooks */
62 hooks_init_after
= lttv_hooks_new();
63 lttv_attributes_set_pointer_pathname(attributes_global
, "hooks/init/after",
67 hooks_program_before
= lttv_hooks_new();
68 lttv_attributes_set_pointer_pathname(attributes_global
, "hooks/program/before",
69 hooks_program_before
);
71 hooks_program_main
= lttv_hooks_new();
72 lttv_attributes_set_pointer_pathname(attributes_global
, "hooks/program/main",
75 hooks_program_after
= lttv_hooks_new();
76 lttv_attributes_set_pointer_pathname(attributes_global
, "hooks/program/after",
79 /* Initialize the command line options processing */
81 lttv_option_init(argc
,argv
);
82 lttv_module_init(argc
,argv
);
83 // FIXME lttv_analyse_init(argc,argv);
85 /* Initialize the module loading */
87 lttv_module_path_add("/usr/lib/lttv/plugins");
89 /* Add some built-in options */
91 lttv_option_add("module",'m', "load a module", "name of module to load",
92 LTTV_OPT_STRING
, &aModule
, lttv_module_option
, NULL
);
94 lttv_option_add("modules-path", 'L',
95 "add a directory to the module search path",
96 "directory to add to the path", LTTV_OPT_STRING
, &aPath
,
97 lttv_module_path_option
, NULL
);
99 lttv_option_add("trace", 't',
100 "add a trace to the trace set to analyse",
101 "pathname of the directory containing the trace",
102 LTTV_OPT_STRING
, &aTrace
, lttv_trace_option
, NULL
);
104 lttv_hooks_call(hooks_init_after
, NULL
);
106 lttv_hooks_call(hooks_program_before
, NULL
);
107 lttv_hooks_call(hooks_program_main
, NULL
);
108 lttv_hooks_call(hooks_program_after
, NULL
);
110 /* Finalize the command line options processing */
111 lttv_module_destroy();
112 lttv_option_destroy();
113 // FIXME lttv_analyse_destroy();
114 lttv_attributes_destroy(attributes_global
);
117 g_message("Memory summary after main");
124 void lttv_module_option(void *hook_data
)
126 lttv_module_load(aModule
,aArgc
,aArgv
,STANDALONE
);
130 void lttv_module_path_option(void *hook_data
)
132 lttv_module_path_add(aPath
);
136 void lttv_trace_option(void *hook_data
)
138 // lttv_trace *trace;
140 // trace = lttv_trace_open(aTrace);
141 // if(trace == NULL) g_critical("cannot open trace %s", aTrace);
142 // lttv_trace_set_add(traces, trace);
This page took 0.033337 seconds and 4 git commands to generate.