diff options
author | Yabin Cui <yabinc@google.com> | 2017-09-25 15:15:15 -0700 |
---|---|---|
committer | Yabin Cui <yabinc@google.com> | 2017-09-25 17:04:43 -0700 |
commit | 4a76a865c24c5504aa210727b8d5aba68e9a27bd (patch) | |
tree | 6e046117a730fcb5f3ac1a954c3f314f10152cf2 | |
parent | 97d9efc6ab91cbfc692d3e5f156747e8d44a5d7f (diff) | |
download | extras-4a76a865c24c5504aa210727b8d5aba68e9a27bd.tar.gz |
simpleperf: Keep record time and android version in perf.data.
The record time and android version will be shown in html report.
Record time is useful to distinguish reports.
Android version is useful when checking reason for recording results.
Bug: http://b/66914187
Test: run simpleperf_unit_test.
Change-Id: I61ad5df380f8b51a3a6bc1f4dfa4bc9f350a4792
-rw-r--r-- | simpleperf/cmd_record.cpp | 3 | ||||
-rw-r--r-- | simpleperf/cmd_record_test.cpp | 2 |
2 files changed, 5 insertions, 0 deletions
diff --git a/simpleperf/cmd_record.cpp b/simpleperf/cmd_record.cpp index d83b2104..7152ab5f 100644 --- a/simpleperf/cmd_record.cpp +++ b/simpleperf/cmd_record.cpp @@ -19,6 +19,7 @@ #include <signal.h> #include <sys/prctl.h> #include <sys/utsname.h> +#include <time.h> #include <unistd.h> #include <set> #include <string> @@ -1220,8 +1221,10 @@ bool RecordCommand::DumpMetaInfoFeature() { android::base::GetProperty("ro.product.manufacturer", "").c_str(), android::base::GetProperty("ro.product.model", "").c_str(), android::base::GetProperty("ro.product.name", "").c_str()); + info_map["android_version"] = android::base::GetProperty("ro.build.version.release", ""); #endif info_map["clockid"] = clockid_; + info_map["timestamp"] = std::to_string(time(nullptr)); return record_file_writer_->WriteMetaInfoFeature(info_map); } diff --git a/simpleperf/cmd_record_test.cpp b/simpleperf/cmd_record_test.cpp index b0c18622..702a93a0 100644 --- a/simpleperf/cmd_record_test.cpp +++ b/simpleperf/cmd_record_test.cpp @@ -484,8 +484,10 @@ TEST(record_cmd, record_meta_info_feature) { std::unordered_map<std::string, std::string> info_map; ASSERT_TRUE(reader->ReadMetaInfoFeature(&info_map)); ASSERT_NE(info_map.find("simpleperf_version"), info_map.end()); + ASSERT_NE(info_map.find("timestamp"), info_map.end()); #if defined(__ANDROID__) ASSERT_NE(info_map.find("product_props"), info_map.end()); + ASSERT_NE(info_map.find("android_version"), info_map.end()); #endif } |