summaryrefslogtreecommitdiffstats
path: root/hash.h
diff options
context:
space:
mode:
authorWenji Huang <wenji.huang@oracle.com>2010-02-03 10:21:24 +0800
committerWenji Huang <wenji.huang@oracle.com>2010-02-03 10:21:24 +0800
commit0d1ad607311857dc0b4666ce8a84c1a59c615ab9 (patch)
tree57aaf3d3eadbe75cd22be6e073c8d17f3801392f /hash.h
parentfff4e6c6e4bb5bd1046164d697872f0bc1a48f4c (diff)
downloadsystemtap-steved-0d1ad607311857dc0b4666ce8a84c1a59c615ab9.tar.gz
systemtap-steved-0d1ad607311857dc0b4666ce8a84c1a59c615ab9.tar.xz
systemtap-steved-0d1ad607311857dc0b4666ce8a84c1a59c615ab9.zip
PR9931: generate log to help diagnosing occasional cache hash collisions
Ideas from Frank Ch. Eigler: - extending the hash.add() function to pass names along with the hash-mix values, so that class hash can internally track the hash-report string - storing the reports themselves in the cache, beside the .ko / .c files, and changing the cache-size-limit logic to delete these .txt files upon garbage collection * hash.h : New member parm_stream. * hash.cxx (get_parms): New function to convert parms stream to string. (hash::add): Aggregrate parms stream. (create_hash_log): New function to log hash operation. (find_*_hash): Log hash at the end of function. * cache.cxx (clean_cache): Remove log when cache reaches limitation.
Diffstat (limited to 'hash.h')
-rw-r--r--hash.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/hash.h b/hash.h
index 6bb1c78a..173f8e51 100644
--- a/hash.h
+++ b/hash.h
@@ -1,5 +1,7 @@
#include <string>
#include <vector>
+#include <sstream>
+#include <fstream>
extern "C" {
#include <string.h>
@@ -13,9 +15,11 @@ class hash
{
private:
struct mdfour md4;
+ std::ostringstream parm_stream;
public:
hash() { start(); }
+ hash(const hash &base) { start(); parm_stream << base.parm_stream.str();}
void start();
@@ -34,6 +38,7 @@ public:
void add_file(const std::string& filename);
void result(std::string& r);
+ std::string get_parms();
};
void find_hash (systemtap_session& s, const std::string& script);