diff options
author | fche <fche> | 2006-01-28 02:42:08 +0000 |
---|---|---|
committer | fche <fche> | 2006-01-28 02:42:08 +0000 |
commit | b0ee93c4ceec6ee4d44c611cd968386faa233c1c (patch) | |
tree | 2bf71dc5e9cddd931fda85d8531f5a8e1cffba0a | |
parent | 5ee1c56b3508b67910a8196724f3df2182d55efd (diff) | |
download | systemtap-steved-b0ee93c4ceec6ee4d44c611cd968386faa233c1c.tar.gz systemtap-steved-b0ee93c4ceec6ee4d44c611cd968386faa233c1c.tar.xz systemtap-steved-b0ee93c4ceec6ee4d44c611cd968386faa233c1c.zip |
2006-01-27 Frank Ch. Eigler <fche@elastic.org>
* main.cxx: Make "-v" (verbose) flag a counter.
* stap.1.in: Document this.
* session.h: Corresponding changes.
* {elaborate,buildrun,tapsets,translate}.cxx: Update all uses of
verbose flag to compare it to sensible level for value of message.
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | buildrun.cxx | 8 | ||||
-rw-r--r-- | elaborate.cxx | 12 | ||||
-rw-r--r-- | main.cxx | 16 | ||||
-rw-r--r-- | session.h | 2 | ||||
-rw-r--r-- | stap.1.in | 12 | ||||
-rw-r--r-- | tapsets.cxx | 57 | ||||
-rw-r--r-- | translate.cxx | 10 |
8 files changed, 61 insertions, 64 deletions
@@ -1,5 +1,13 @@ 2006-01-27 Frank Ch. Eigler <fche@elastic.org> + * main.cxx: Make "-v" (verbose) flag a counter. + * stap.1.in: Document this. + * session.h: Corresponding changes. + * {elaborate,buildrun,tapsets,translate}.cxx: Update all uses of + verbose flag to compare it to sensible level for value of message. + +2006-01-27 Frank Ch. Eigler <fche@elastic.org> + * main.cxx (main): In verbose mode, print user+sys times after each pass. * buildrun.cxx (compile_pass): Move success message back to main(). diff --git a/buildrun.cxx b/buildrun.cxx index 0ed3a3d5..535e31bc 100644 --- a/buildrun.cxx +++ b/buildrun.cxx @@ -84,12 +84,12 @@ compile_pass (systemtap_session& s) + string (" -C \"") + module_dir + string("\""); make_cmd += string(" M=\"") + s.tmpdir + string("\" modules"); - if (s.verbose) + if (s.verbose > 1) make_cmd += " V=1"; else make_cmd += " -s >/dev/null 2>&1"; - if (s.verbose) clog << "Running " << make_cmd << endl; + if (s.verbose > 1) clog << "Running " << make_cmd << endl; rc = system (make_cmd.c_str()); return rc; @@ -105,7 +105,7 @@ run_pass (systemtap_session& s) string stpd_cmd = string("sudo ") + string(PKGLIBDIR) + "/stpd " + (s.bulk_mode ? "" : "-r ") - + (s.verbose ? "" : "-q ") + + (s.verbose>1 ? "" : "-q ") + (s.output_file.empty() ? "" : "-o " + s.output_file + " "); stpd_cmd += "-d " + stringify(getpid()) + " "; @@ -121,7 +121,7 @@ run_pass (systemtap_session& s) stpd_cmd += s.tmpdir + "/" + s.module_name + ".ko"; - if (s.verbose) clog << "Running " << stpd_cmd << endl; + if (s.verbose>1) clog << "Running " << stpd_cmd << endl; signal (SIGHUP, SIG_IGN); signal (SIGINT, SIG_IGN); diff --git a/elaborate.cxx b/elaborate.cxx index b0f784d4..ce8844ce 100644 --- a/elaborate.cxx +++ b/elaborate.cxx @@ -1190,7 +1190,7 @@ void semantic_pass_opt1 (systemtap_session& s, bool& relaxed_p) { if (ftv.traversed.find(s.functions[i]) == ftv.traversed.end()) { - if (s.verbose) + if (s.verbose>2) clog << "Eliding unused function " << s.functions[i]->name << endl; s.functions.erase (s.functions.begin() + i); @@ -1230,7 +1230,7 @@ void semantic_pass_opt2 (systemtap_session& s, bool& relaxed_p) if (vut.read.find (l) == vut.read.end() && vut.written.find (l) == vut.written.end()) { - if (s.verbose) + if (s.verbose>2) clog << "Eliding unused local variable " << l->name << " in probe #" << i << endl; s.probes[i]->locals.erase(s.probes[i]->locals.begin() + j); @@ -1247,7 +1247,7 @@ void semantic_pass_opt2 (systemtap_session& s, bool& relaxed_p) if (vut.read.find (l) == vut.read.end() && vut.written.find (l) == vut.written.end()) { - if (s.verbose) + if (s.verbose>2) clog << "Eliding unused local variable " << l->name << " in function " << s.functions[i]->name << endl; @@ -1264,7 +1264,7 @@ void semantic_pass_opt2 (systemtap_session& s, bool& relaxed_p) if (vut.read.find (l) == vut.read.end() && vut.written.find (l) == vut.written.end()) { - if (s.verbose) + if (s.verbose>2) clog << "Eliding unused global variable " << l->name << endl; s.globals.erase(s.globals.begin() + i); @@ -1318,7 +1318,7 @@ dead_assignment_remover::visit_assignment (assignment* e) // clog << "Checking assignment to " << leftvar->name << " at " << *e->tok << endl; if (vut.read.find(leftvar) == vut.read.end()) // var never read? { - if (session.verbose) + if (session.verbose>2) clog << "Eliding assignment to " << leftvar->name << " at " << *e->tok << endl; *current_expr = e->right; // goodbye assignment* @@ -1403,7 +1403,7 @@ dead_stmtexpr_remover::visit_expr_statement (expr_statement *s) s->value->visit (& vut); if (vut.written.empty() && !vut.embedded_seen) { - if (session.verbose) + if (session.verbose>2) clog << "Eliding side-effect-free expression " << *s->tok << endl; @@ -57,7 +57,7 @@ usage (systemtap_session& s) << endl << "Options:" << endl << " -- no more options after this" << endl - << " -v verbose" << (s.verbose ? " [set]" : "") << endl + << " -v increase verbosity [" << s.verbose << "]" << endl << " -h show help" << endl << " -V show version" << endl << " -k keep temporary directory" << endl @@ -120,7 +120,7 @@ main (int argc, char * const argv []) (void) uname (& buf); s.kernel_release = string (buf.release); s.architecture = string (buf.machine); - s.verbose = false; + s.verbose = 0; s.guru_mode = false; s.bulk_mode = false; s.unoptimized = false; @@ -156,7 +156,7 @@ main (int argc, char * const argv []) exit (0); case 'v': - s.verbose = true; + s.verbose ++; break; case 'p': @@ -284,7 +284,7 @@ main (int argc, char * const argv []) else s.tmpdir = tmpdir; - if (s.verbose) + if (s.verbose>1) clog << "Created temporary directory \"" << s.tmpdir << "\"" << endl; } @@ -345,7 +345,7 @@ main (int argc, char * const argv []) rc ++; // GLOB_NOMATCH is acceptable - if (s.verbose) + if (s.verbose>1) clog << "Searched '" << dir << "', " << "match count " << globbuf.gl_pathc << endl; @@ -467,7 +467,7 @@ main (int argc, char * const argv []) } times (& tms_after); - if (s.verbose) clog << "Pass 2: analyzed user script. " + if (s.verbose) clog << "Pass 2: analyzed script: " << s.probes.size() << " probe(s), " << s.functions.size() << " function(s), " << s.globals.size() << " global(s) in " @@ -554,9 +554,9 @@ main (int argc, char * const argv []) { string cleanupcmd = "rm -rf "; cleanupcmd += s.tmpdir; - if (s.verbose) clog << "Running " << cleanupcmd << endl; + if (s.verbose>1) clog << "Running " << cleanupcmd << endl; int status = system (cleanupcmd.c_str()); - if (status != 0 && s.verbose) + if (status != 0 && s.verbose>1) clog << "Cleanup command failed, status: " << status << endl; } } @@ -69,7 +69,7 @@ struct systemtap_session std::string cmd; int target_pid; int last_pass; - bool verbose; + unsigned verbose; bool keep_tmpdir; bool guru_mode; bool bulk_mode; @@ -72,7 +72,7 @@ prints a list of supported options. .\" -t test mode .TP .B \-v -Verbose mode. Produce more informative output. +Increase verbosity. Produce more informative output. .TP .B \-h Show help message. @@ -473,10 +473,10 @@ fully type-checked by the translator. .SS STATISTICS It is often desirable to collect statistics in a way that avoids the -penalties of repeatedly locking the global variables those numbers are -being put into. Systemtap provides a solution using a special -operator to accumulate values, and several pseudo-functions to extract -the statistical aggregates. +penalties of repeatedly exclusive locking the global variables those +numbers are being put into. Systemtap provides a solution using a +special operator to accumulate values, and several pseudo-functions to +extract the statistical aggregates. .PP The aggregation operator is .IR <<< , @@ -710,7 +710,7 @@ Maximum length of strings. .TP MAXTRYLOCK Maximum number of iterations to wait for locks on global variables -before declaring possible deadlock. +before declaring possible deadlock and skipping the probe. .TP MAXACTION Maximum number of statements to execute during any single probe hit. diff --git a/tapsets.cxx b/tapsets.cxx index 91740520..7705711e 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -455,8 +455,6 @@ dwflpp { if (in) return in; - if (false && sess.verbose) - clog << "WARNING: no name found for " << type << "\n"; return string(""); } @@ -580,11 +578,6 @@ dwflpp get_module_dwarf(); if (module_name == TOK_KERNEL) return a; - - if (false && sess.verbose) - clog << "module addr " << hex << a - << " + module start " << module_start - << " -> global addr " << (a + module_start) << dec << "\n"; return a + module_start; } @@ -593,10 +586,6 @@ dwflpp { assert(module); get_module_dwarf(); - if (false && sess.verbose) - clog << "global addr " << a - << " - module start " << hex << module_start - << " -> module addr " << (a - module_start) << dec << "\n"; return a - module_bias; } @@ -605,7 +594,7 @@ dwflpp { assert(module); bool t = (fnmatch(pattern.c_str(), module_name.c_str(), 0) == 0); - if (t && sess.verbose) + if (t && sess.verbose>2) clog << "pattern '" << pattern << "' " << "matches " << "module '" << module_name << "'" << "\n"; @@ -617,7 +606,7 @@ dwflpp { assert(function); bool t = (fnmatch(pattern.c_str(), function_name.c_str(), 0) == 0); - if (t && sess.verbose) + if (t && sess.verbose>2) clog << "pattern '" << pattern << "' " << "matches " << "function '" << function_name << "'" << "\n"; @@ -629,7 +618,7 @@ dwflpp { assert(cu); bool t = (fnmatch(pattern.c_str(), cu_name.c_str(), 0) == 0); - if (t && sess.verbose) + if (t && sess.verbose>2) clog << "pattern '" << pattern << "' " << "matches " << "CU '" << cu_name << "'" << "\n"; @@ -890,7 +879,7 @@ dwflpp if (fnmatch (pattern.c_str(), fname, 0) == 0) { filtered_srcfiles.insert (fname); - if (sess.verbose) + if (sess.verbose>2) clog << "selected source file '" << fname << "'\n"; } } @@ -987,7 +976,7 @@ dwflpp if (addr0 != addr) { last_function->prologue_end = addr; - if (sess.verbose) + if (sess.verbose>2) clog << "prologue disagreement (tail call): " << last_function->name << " heur0=" << hex << addr0 @@ -1011,7 +1000,7 @@ dwflpp if (addr0 != addr) { last_function->prologue_end = addr; - if (sess.verbose) + if (sess.verbose>2) clog << "prologue disagreement: " << last_function->name << " heur0=" << hex << addr0 << " heur1=" << addr << dec @@ -1036,7 +1025,7 @@ dwflpp dwarf_highpc (& last_function->die, & last_function_highpc)); - if (sess.verbose) + if (sess.verbose>2) clog << "finding prologue for '" << last_function->name << "' entrypc=0x" << hex << addr @@ -1431,7 +1420,7 @@ dwflpp fb_attr = find_variable_and_frame_base (scope_die, pc, local, &vardie, &fb_attr_mem); - if (sess.verbose) + if (sess.verbose>2) clog << "finding location for local '" << local << "' near address " << hex << pc << ", module bias " << module_bias << dec @@ -1789,7 +1778,7 @@ dwarf_query::parse_function_spec(string & spec) if (i == e) { - if (sess.verbose) + if (sess.verbose>2) clog << "parsed '" << spec << "' -> func '" << function << "'\n"; @@ -1804,7 +1793,7 @@ dwarf_query::parse_function_spec(string & spec) if (i == e) { - if (sess.verbose) + if (sess.verbose>2) clog << "parsed '" << spec << "' -> func '"<< function << "', file '" << file @@ -1818,7 +1807,7 @@ dwarf_query::parse_function_spec(string & spec) try { line = lex_cast<int>(string(i, e)); - if (sess.verbose) + if (sess.verbose>2) clog << "parsed '" << spec << "' -> func '"<< function << "', file '" << file @@ -1932,7 +1921,7 @@ dwarf_query::blacklisted_p(string const & funcname, const char *name = dwfl_module_relocation_info (dw.module, idx, NULL); if (name && strncmp (name, ".init.", 6) == 0) { - if (sess.verbose) + if (sess.verbose>1) clog << "skipping function '" << funcname << "' base 0x" << hex << addr << dec << " is within section '" << name << "'\n"; @@ -1967,7 +1956,7 @@ dwarf_query::blacklisted_p(string const & funcname, const char* name = elf_strptr (elf, shstrndx, shdr->sh_name); if (name && strncmp (name, ".init.", 6) == 0) { - if (sess.verbose) + if (sess.verbose>1) clog << "skipping function '" << funcname << "' base 0x" << hex << addr << dec << " is within section '" << name << "'\n"; @@ -1990,7 +1979,7 @@ dwarf_query::blacklisted_p(string const & funcname, (has_return && (funcname == "sys_exit" || funcname == "sys_groupexit"))) { - if (sess.verbose) + if (sess.verbose>1) clog << "skipping function '" << funcname << "' file '" << filename << "' is blacklisted\n"; return true; @@ -2109,7 +2098,7 @@ query_inline_instance_info (Dwarf_Addr entrypc, } else { - if (q->sess.verbose) + if (q->sess.verbose>2) clog << "querying entrypc " << hex << entrypc << dec << " of instance of inline '" << ii.name << "'\n"; @@ -2174,7 +2163,7 @@ query_srcfile_line (Dwarf_Line * line, void * arg) { if (q->dw.die_has_pc (&(i->second.die), addr)) { - if (q->sess.verbose) + if (q->sess.verbose>3) clog << "function DIE lands on srcfile\n"; if (q->has_statement_str) query_statement (i->second.name, i->second.decl_file, @@ -2190,7 +2179,7 @@ query_srcfile_line (Dwarf_Line * line, void * arg) { if (q->dw.die_has_pc (&(i->second.die), addr)) { - if (q->sess.verbose) + if (q->sess.verbose>3) clog << "inline instance DIE lands on srcfile\n"; if (q->has_statement_str) query_statement (i->second.name, i->second.decl_file, @@ -2213,7 +2202,7 @@ query_dwarf_inline_instance (Dwarf_Die * die, void * arg) bool record_this_inline = false; - if (q->sess.verbose) + if (q->sess.verbose>2) clog << "examining inline instance of " << q->dw.function_name << "\n"; if (q->has_inline_str || q->has_statement_str) @@ -2232,7 +2221,7 @@ query_dwarf_inline_instance (Dwarf_Die * die, void * arg) if (record_this_inline) { - if (q->sess.verbose) + if (q->sess.verbose>2) clog << "selected inline instance of " << q->dw.function_name << "\n"; @@ -2280,7 +2269,7 @@ query_dwarf_func (Dwarf_Die * func, void * arg) && q->dw.function_name_matches(q->function)) || q->has_inline_num)) { - if (q->sess.verbose) + if (q->sess.verbose>3) clog << "checking instances of inline " << q->dw.function_name << "\n"; q->dw.iterate_over_inline_instances (query_dwarf_inline_instance, arg); @@ -2310,7 +2299,7 @@ query_dwarf_func (Dwarf_Die * func, void * arg) if (record_this_function) { - if (q->sess.verbose) + if (q->sess.verbose>2) clog << "selected function " << q->dw.function_name << "\n"; Dwarf_Addr entrypc; @@ -2346,7 +2335,7 @@ query_cu (Dwarf_Die * cudie, void * arg) { q->dw.focus_on_cu (cudie); - if (false && q->sess.verbose) + if (false && q->sess.verbose>2) clog << "focused on CU '" << q->dw.cu_name << "', in module '" << q->dw.module_name << "'\n"; @@ -2471,7 +2460,7 @@ query_module (Dwfl_Module *mod __attribute__ ((unused)), if (q->has_module && !q->dw.module_name_matches(q->module_val)) return DWARF_CB_OK; - if (q->sess.verbose) + if (q->sess.verbose>2) clog << "focused on module '" << q->dw.module_name << "' = [" << hex << q->dw.module_start << "-" << q->dw.module_end diff --git a/translate.cxx b/translate.cxx index 36504a2d..9aa4180b 100644 --- a/translate.cxx +++ b/translate.cxx @@ -1339,7 +1339,7 @@ c_unparser::emit_unlocks(const varuse_collecting_visitor& vut) { unsigned numvars = 0; - if (session->verbose) + if (session->verbose>1) clog << "Probe #" << current_probenum << " locks "; for (int i = session->globals.size()-1; i>=0; i--) // in reverse order! @@ -1360,7 +1360,7 @@ c_unparser::emit_unlocks(const varuse_collecting_visitor& vut) else if (read_p && !write_p) { read_p = false; write_p = true; } } - if (session->verbose) + if (session->verbose>1) clog << v->name << "[" << (read_p ? "r" : "") << (write_p ? "w" : "") << "] "; @@ -1385,10 +1385,10 @@ c_unparser::emit_unlocks(const varuse_collecting_visitor& vut) o->newline() << "_stp_exit();"; o->newline(-1) << "}"; - if (session->verbose) + if (session->verbose>1) clog << endl; } - else if (session->verbose) + else if (session->verbose>1) clog << "nothing" << endl; } @@ -3759,7 +3759,7 @@ emit_symbol_data (systemtap_session& s) #endif sortcmd += "-s -o " + sorted_kallsyms; - if (s.verbose) clog << "Running " << sortcmd << endl; + if (s.verbose>1) clog << "Running " << sortcmd << endl; rc = system(sortcmd.c_str()); if (rc == 0) { |