summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Stone <jistone@redhat.com>2010-03-01 17:27:53 -0800
committerJosh Stone <jistone@redhat.com>2010-03-02 16:05:17 -0800
commit63d530ab4dacb908c7262be59098ef026e186a30 (patch)
tree8c1b6873409027d0d0ff284f6ec44b1f2a844a31
parent42f13348b90fa59532a0c8159dc390cd7a50de0f (diff)
downloadsystemtap-steved-63d530ab4dacb908c7262be59098ef026e186a30.tar.gz
systemtap-steved-63d530ab4dacb908c7262be59098ef026e186a30.tar.xz
systemtap-steved-63d530ab4dacb908c7262be59098ef026e186a30.zip
PR11246: Add more granular cache control
There are some module options that require us to disable caching for the script, but before now this had a global effect. There are some cache objects, like tracepoint and @cast query modules, which we would like to cache even when the script itself needs to be uncached. * session.h (systemtap_session): New use_script_cache flag. * main.cxx (main): -m & -k can just disable the script cache. Failure to create the cache directories still disables all caching. * hash.cxx (create_hashdir): Failure disables all caching. * cache.cxx (add_to_cache): Failure only toggles the script caching. If the stapconf fails though, we don't need to block the .ko reuse.
-rw-r--r--cache.cxx11
-rw-r--r--hash.cxx2
-rw-r--r--main.cxx15
-rw-r--r--session.h1
4 files changed, 17 insertions, 12 deletions
diff --git a/cache.cxx b/cache.cxx
index b113e019..1b083d69 100644
--- a/cache.cxx
+++ b/cache.cxx
@@ -57,15 +57,18 @@ add_to_cache(systemtap_session& s)
string stapconf_src_path = s.tmpdir + "/" + s.stapconf_name;
if (!copy_file(stapconf_src_path, s.stapconf_path, verbose))
{
- s.use_cache = false;
- return;
+ // NB: this is not so severe as to prevent reuse of the .ko
+ // already copied.
+ //
+ // s.use_script_cache = false;
+ // return;
}
string module_src_path = s.tmpdir + "/" + s.module_name + ".ko";
STAP_PROBE2(stap, cache__add__module, module_src_path.c_str(), s.hash_path.c_str());
if (!copy_file(module_src_path, s.hash_path, verbose))
{
- s.use_cache = false;
+ s.use_script_cache = false;
return;
}
// Copy the signature file, if any. It is not an error if this fails.
@@ -83,7 +86,7 @@ add_to_cache(systemtap_session& s)
// NB: this is not so severe as to prevent reuse of the .ko
// already copied.
//
- // s.use_cache = false;
+ // s.use_script_cache = false;
}
}
diff --git a/hash.cxx b/hash.cxx
index 1ebc76e5..36a71a42 100644
--- a/hash.cxx
+++ b/hash.cxx
@@ -170,7 +170,7 @@ create_hashdir (systemtap_session& s, const string& result, string& hashdir)
cerr << "Warning: failed to create cache directory (\""
<< hashdir + "\"): " << strerror(errno)
<< ", disabling cache support." << endl;
- s.use_cache = false;
+ s.use_cache = s.use_script_cache = false;
return false;
}
}
diff --git a/main.cxx b/main.cxx
index 21a4b136..5255b5bf 100644
--- a/main.cxx
+++ b/main.cxx
@@ -536,6 +536,7 @@ main (int argc, char * const argv [])
s.perfmon=0;
s.symtab = false;
s.use_cache = true;
+ s.use_script_cache = true;
s.tapset_compile_coverage = false;
s.need_uprobes = false;
s.consult_symtab = false;
@@ -584,7 +585,7 @@ main (int argc, char * const argv [])
cerr << "Warning: failed to create systemtap data directory (\""
<< s.data_path << "\"): " << e
<< ", disabling cache support." << endl;
- s.use_cache = false;
+ s.use_cache = s.use_script_cache = false;
}
if (s.use_cache)
@@ -597,7 +598,7 @@ main (int argc, char * const argv [])
cerr << "Warning: failed to create cache directory (\""
<< s.cache_path << "\"): " << e
<< ", disabling cache support." << endl;
- s.use_cache = false;
+ s.use_cache = s.use_script_cache = false;
}
}
@@ -781,7 +782,7 @@ main (int argc, char * const argv [])
}
}
- s.use_cache = false;
+ s.use_script_cache = false;
break;
case 'r':
@@ -797,7 +798,7 @@ main (int argc, char * const argv [])
case 'k':
s.keep_tmpdir = true;
- s.use_cache = false; /* User wants to keep a usable build tree. */
+ s.use_script_cache = false; /* User wants to keep a usable build tree. */
break;
case 'g':
@@ -1276,7 +1277,7 @@ main (int argc, char * const argv [])
<< endl;
// Generate hash. There isn't any point in generating the hash
// if last_pass is 2, since we'll quit before using it.
- else if (s.last_pass != 2 && s.use_cache)
+ else if (s.last_pass != 2 && s.use_script_cache)
{
ostringstream o;
unsigned saved_verbose;
@@ -1374,12 +1375,12 @@ main (int argc, char * const argv [])
else
{
// Update cache. Cache cleaning is kicked off at the beginning of this function.
- if (s.use_cache)
+ if (s.use_script_cache)
add_to_cache(s);
// We may need to save the module in $CWD if the cache was
// inaccessible for some reason.
- if (! s.use_cache && s.last_pass == 4)
+ if (! s.use_script_cache && s.last_pass == 4)
save_module = true;
// Copy module to the current directory.
diff --git a/session.h b/session.h
index 18d811e7..f45f6c77 100644
--- a/session.h
+++ b/session.h
@@ -127,6 +127,7 @@ struct systemtap_session
// Cache data
bool use_cache;
+ bool use_script_cache;
std::string cache_path;
std::string hash_path;
std::string stapconf_path;