diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2017-09-26 00:13:57 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-09-26 00:13:57 +0000 |
commit | c34215a7714d566b8987a9c6a4c836bf4ac949bc (patch) | |
tree | 6e046117a730fcb5f3ac1a954c3f314f10152cf2 | |
parent | 97d9efc6ab91cbfc692d3e5f156747e8d44a5d7f (diff) | |
parent | 4a76a865c24c5504aa210727b8d5aba68e9a27bd (diff) | |
download | extras-c34215a7714d566b8987a9c6a4c836bf4ac949bc.tar.gz |
Merge "simpleperf: Keep record time and android version in perf.data."
-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 } |