summaryrefslogtreecommitdiff
path: root/simpleperf/utils.h
diff options
context:
space:
mode:
authorYabin Cui <yabinc@google.com>2019-09-18 16:05:51 -0700
committerYabin Cui <yabinc@google.com>2019-09-19 13:04:55 -0700
commitfad7bbea296a376139bddf8d3991a41b9d763409 (patch)
treefe4c4e85af51ea3445c505e29a32342be5325d46 /simpleperf/utils.h
parent939a46d25c6e64f2acb9790c942a2c026557f912 (diff)
downloadextras-fad7bbea296a376139bddf8d3991a41b9d763409.tar.gz
simpleperf: output text format for autofdo in inject cmd.
Also add --binary option to selected binaries for generating data. Because AutoFDO only accepts one binary input. Test it manually with a simple example as below: 1. on device, run `./simpleperf record -e cs-etm:u ./etm_test_multi_thread`. 2. on device, run `./simpleperf inject --binary test_loop_b`. 3. on host, run `adb pull /data/local/tmp/perf_inject.data`. 4. on host, run `./create_llvm_prof -binary=libetm_test_loop_b.so -profile=perf_inject.data -profiler=text -out=a`. And create_llvm_prof can generate output successfully. Bug: 141013987 Test: run simpleperf_unit_test. Change-Id: Iacc0e3ed4cc47c91d5764e7b0394718436211514
Diffstat (limited to 'simpleperf/utils.h')
-rw-r--r--simpleperf/utils.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/simpleperf/utils.h b/simpleperf/utils.h
index 3ca8f5cf..872e191d 100644
--- a/simpleperf/utils.h
+++ b/simpleperf/utils.h
@@ -163,4 +163,14 @@ timeval SecondToTimeval(double time_in_sec);
std::string GetSimpleperfVersion();
+namespace {
+
+// from boost::hash_combine
+template <typename T>
+void HashCombine(size_t& seed, const T& val) {
+ seed ^= std::hash<T>()(val) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
+}
+
+} // namespace
+
#endif // SIMPLE_PERF_UTILS_H_