X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=ltt%2Fbranches%2Fpoly%2Flttv%2Fmain.c;h=7b6f7153c39a6545c6226079ea07f616e82d0d12;hb=8a9490128c708275a242badad25527fba94f6a51;hp=ec131915dfd59a37c87fa8a59c3463f91a335c10;hpb=c432246e06bb83a3d43a6668517486fb6b4b959d;p=lttv.git diff --git a/ltt/branches/poly/lttv/main.c b/ltt/branches/poly/lttv/main.c index ec131915..7b6f7153 100644 --- a/ltt/branches/poly/lttv/main.c +++ b/ltt/branches/poly/lttv/main.c @@ -7,6 +7,8 @@ #include #include #include +#include + void lttv_option_init(int argc, char **argv); void lttv_option_destroy(); @@ -17,6 +19,9 @@ void lttv_module_destroy(); void lttv_state_init(int argc, char **argv); void lttv_state_destroy(); +void lttv_stats_init(int argc, char **argv); +void lttv_stats_destroy(); + /* The main program maintains a few central data structures and relies on modules for the rest. These data structures may be accessed by modules through an exported API */ @@ -33,6 +38,10 @@ static char *a_module, *a_module_path; +static gboolean + a_verbose, + a_debug; + static int a_argc; static char **a_argv; @@ -41,10 +50,11 @@ static void lttv_module_option(void *hook_data); static void lttv_module_path_option(void *hook_data); -#ifdef MEMDEBUG -extern struct GMemVTable *glib_mem_profiler_table; -#endif +static void lttv_verbose(void *hook_data); + +static void lttv_debug(void *hook_data); +static void lttv_help(void *hook_data); /* Since everything is done in modules, the main program only takes care of the infrastructure. */ @@ -59,6 +69,9 @@ int main(int argc, char **argv) { g_mem_profile(); #endif + g_type_init(); + //g_type_init_with_debug_flags (G_TYPE_DEBUG_OBJECTS | G_TYPE_DEBUG_SIGNALS); + attributes = LTTV_IATTRIBUTE(g_object_new(LTTV_ATTRIBUTE_TYPE, NULL)); before_options = lttv_hooks_new(); @@ -82,9 +95,12 @@ int main(int argc, char **argv) { /* Initialize the command line options processing */ + a_argc = argc; + a_argv = argv; lttv_option_init(argc,argv); lttv_module_init(argc,argv); lttv_state_init(argc,argv); + lttv_stats_init(argc,argv); /* Initialize the module loading */ @@ -99,7 +115,19 @@ int main(int argc, char **argv) { "add a directory to the module search path", "directory to add to the path", LTTV_OPT_STRING, &a_module_path, lttv_module_path_option, NULL); + + lttv_option_add("help",'h', "basic help", "none", + LTTV_OPT_NONE, NULL, lttv_help, NULL); + a_verbose = FALSE; + lttv_option_add("verbose",'v', "print information messages", "none", + LTTV_OPT_NONE, NULL, lttv_verbose, NULL); + + a_debug = FALSE; + lttv_option_add("debug",'d', "print debugging messages", "none", + LTTV_OPT_NONE, NULL, lttv_debug, NULL); + + lttv_hooks_call(before_options, NULL); lttv_option_parse(argc, argv); lttv_hooks_call(after_options, NULL); @@ -107,6 +135,7 @@ int main(int argc, char **argv) { lttv_hooks_call(before_main, NULL); lttv_hooks_call(after_main, NULL); + lttv_stats_destroy(); lttv_state_destroy(); lttv_module_destroy(); lttv_option_destroy(); @@ -126,7 +155,7 @@ int main(int argc, char **argv) { LttvAttribute *lttv_global_attributes() { - return attributes; + return (LttvAttribute*)attributes; } @@ -140,3 +169,53 @@ void lttv_module_path_option(void *hook_data) { lttv_module_path_add(a_module_path); } + +void lttv_verbose(void *hook_data) +{ + g_log_set_handler(NULL, G_LOG_LEVEL_INFO, g_log_default_handler, NULL); + g_info("Logging set to include INFO level messages"); +} + +void lttv_debug(void *hook_data) +{ + g_log_set_handler(NULL, G_LOG_LEVEL_DEBUG, g_log_default_handler, NULL); + g_info("Logging set to include DEBUG level messages"); +} + +void lttv_help(void *hook_data) +{ + printf("Linux Trace Toolkit Visualizer\n"); + printf("\n"); + lttv_option_show_help(); + printf("\n"); +} + +/* + +- Make it easier to change modules from builtin to externally loaded. + + have: MODULE_INFO(name, init, destroy, { require} ) in each module. + Maintain the list of builtin modules and search these first (or + optionally last). Add the lib prefix if needed to avoid having to + specify libbatchAnalysis instead of batchAnalysis. + +- Define formally traceset/trace in the GUI for the user and decide how + trace/traceset sharing goes in the application. + +- Use appropriately the new functions in time.h + +- remove the separate tracefiles (control/per cpu) arrays/loops in context. + +- split processTrace into context.c and processTrace.c + +- check spelling conventions. + +- get all the copyright notices. + +- remove all the warnings. + +- get all the .h files properly doxygen commented to produce useful documents. + +- have an intro/architecture document. + +- write a tutorial */