diff options
author | Mark Wielaard <mjw@redhat.com> | 2009-04-19 14:24:20 +0200 |
---|---|---|
committer | Mark Wielaard <mjw@redhat.com> | 2009-04-19 14:24:20 +0200 |
commit | 62d950bbff7f29156f6dbd0bcfa1fd4ae65cca38 (patch) | |
tree | 05443dc834dacec703a6d9dde9a7f3f368de6390 | |
parent | a544586160e1a0b5bfcb7dd7abdf84dfdb0ed082 (diff) | |
download | systemtap-steved-62d950bbff7f29156f6dbd0bcfa1fd4ae65cca38.tar.gz systemtap-steved-62d950bbff7f29156f6dbd0bcfa1fd4ae65cca38.tar.xz systemtap-steved-62d950bbff7f29156f6dbd0bcfa1fd4ae65cca38.zip |
Micro-optimization: no-modules translate pass 3 case.
Saves 250ms in the unlikely case there are no modules needed.
* translate.cxx (emit_symbol_data_done): New function.
(emit_symbol_data): Call emit_symbol_data_done immediately when no
module data is needed.
-rw-r--r-- | translate.cxx | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/translate.cxx b/translate.cxx index d81287ee..46fea6e7 100644 --- a/translate.cxx +++ b/translate.cxx @@ -4818,6 +4818,7 @@ dump_unwindsyms (Dwfl_Module *m, // Emit symbol table & unwind data, plus any calls needed to register // them with the runtime. +void emit_symbol_data_done (unwindsym_dump_context*, systemtap_session&); void emit_symbol_data (systemtap_session& s) @@ -4830,6 +4831,14 @@ emit_symbol_data (systemtap_session& s) unwindsym_dump_context ctx = { s, kallsyms_out, 0, s.unwindsym_modules }; + // Micro optimization, mainly to speed up tiny regression tests + // using just begin probe. + if (s.unwindsym_modules.size () == 0) + { + emit_symbol_data_done(&ctx, s); + return; + } + // XXX: copied from tapsets.cxx dwflpp::, sadly static const char *debuginfo_path_arr = "+:.debug:/usr/lib/debug:build"; static const char *debuginfo_env_arr = getenv("SYSTEMTAP_DEBUGINFO_PATH"); @@ -4922,20 +4931,25 @@ emit_symbol_data (systemtap_session& s) dwfl_end(dwfl); } + emit_symbol_data_done (&ctx, s); +} +void +emit_symbol_data_done (unwindsym_dump_context *ctx, systemtap_session& s) +{ // Print out a definition of the runtime's _stp_modules[] globals. - kallsyms_out << "\n"; - kallsyms_out << "static struct _stp_module *_stp_modules [] = {\n"; - for (unsigned i=0; i<ctx.stp_module_index; i++) + ctx->output << "\n"; + ctx->output << "static struct _stp_module *_stp_modules [] = {\n"; + for (unsigned i=0; i<ctx->stp_module_index; i++) { - kallsyms_out << "& _stp_module_" << i << ",\n"; + ctx->output << "& _stp_module_" << i << ",\n"; } - kallsyms_out << "};\n"; - kallsyms_out << "static unsigned _stp_num_modules = " << ctx.stp_module_index << ";\n"; + ctx->output << "};\n"; + ctx->output << "static unsigned _stp_num_modules = " << ctx->stp_module_index << ";\n"; // Some nonexistent modules may have been identified with "-d". Note them. - for (set<string>::iterator it = ctx.undone_unwindsym_modules.begin(); - it != ctx.undone_unwindsym_modules.end(); + for (set<string>::iterator it = ctx->undone_unwindsym_modules.begin(); + it != ctx->undone_unwindsym_modules.end(); it ++) { s.print_warning ("missing unwind/symbol data for module '" + (*it) + "'"); |