From aca66a36681ac7cbf7fcc2eac4dafc83d6559ef9 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Wed, 2 Sep 2009 16:14:08 -0700 Subject: Unify lex_cast* and avoid string copies We always use lex_cast either to string or from string, so I made that explicit, and got rid of some string copies in the process. There was also stringify(), which was redundant to lex_cast. We also always used lex_cast_hex to string, so that's now hard-coded and again eliminated a string copy. For lex_cast_qstring, there's no need to write the streamify the input, so a specialization now operates directly on the input. Hopefully this is a bit cleaner, and I do measure it to be a little faster on scripts with many probes. --- buildrun.cxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'buildrun.cxx') diff --git a/buildrun.cxx b/buildrun.cxx index a40dab15..6bef4095 100644 --- a/buildrun.cxx +++ b/buildrun.cxx @@ -363,10 +363,10 @@ run_pass (systemtap_session& s) staprun_cmd += "-c " + cmdstr_quoted(s.cmd) + " "; if (s.target_pid) - staprun_cmd += "-t " + stringify(s.target_pid) + " "; + staprun_cmd += "-t " + lex_cast(s.target_pid) + " "; if (s.buffer_size) - staprun_cmd += "-b " + stringify(s.buffer_size) + " "; + staprun_cmd += "-b " + lex_cast(s.buffer_size) + " "; if (s.need_uprobes) staprun_cmd += "-u "; @@ -390,7 +390,7 @@ make_tracequery(systemtap_session& s, string& name, const vector& extra_headers) { static unsigned tick = 0; - string basename("tracequery_kmod_" + lex_cast(++tick)); + string basename("tracequery_kmod_" + lex_cast(++tick)); // create a subdirectory for the module string dir(s.tmpdir + "/" + basename); @@ -461,7 +461,7 @@ static int make_typequery_kmod(systemtap_session& s, const string& header, string& name) { static unsigned tick = 0; - string basename("typequery_kmod_" + lex_cast(++tick)); + string basename("typequery_kmod_" + lex_cast(++tick)); // create a subdirectory for the module string dir(s.tmpdir + "/" + basename); @@ -519,7 +519,7 @@ make_typequery_umod(systemtap_session& s, const string& header, string& name) { static unsigned tick = 0; - name = s.tmpdir + "/typequery_umod_" + lex_cast(++tick) + ".so"; + name = s.tmpdir + "/typequery_umod_" + lex_cast(++tick) + ".so"; // make the module // -- cgit