diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2020-03-13 02:10:09 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2020-03-13 02:10:09 +0000 |
commit | 115d065bf166350ecf2a753c5a01a5b766634ad7 (patch) | |
tree | 368c8e47bd6c44d6194073495e39b4b2a1ff8e53 | |
parent | 2f23c4c428eb8d1c306c7fa41e7e9f52a1a47897 (diff) | |
parent | e7cb330bf9c57da1c547550b5b0599c92744028e (diff) | |
download | extras-115d065bf166350ecf2a753c5a01a5b766634ad7.tar.gz |
Snap for 6291259 from e7cb330bf9c57da1c547550b5b0599c92744028e to rvc-release
Change-Id: Id82d7ec4d628b22d50ac818a1d69805ee844550e
-rw-r--r-- | libperfmgr/FileNode.cc | 5 | ||||
-rw-r--r-- | libperfmgr/include/perfmgr/FileNode.h | 1 |
2 files changed, 4 insertions, 2 deletions
diff --git a/libperfmgr/FileNode.cc b/libperfmgr/FileNode.cc index bc2b8a67..060b3090 100644 --- a/libperfmgr/FileNode.cc +++ b/libperfmgr/FileNode.cc @@ -19,6 +19,7 @@ #include <android-base/chrono_utils.h> #include <android-base/file.h> #include <android-base/logging.h> +#include <android-base/properties.h> #include <android-base/stringprintf.h> #include <android-base/strings.h> @@ -33,7 +34,7 @@ FileNode::FileNode(std::string name, std::string node_path, bool hold_fd) : Node(std::move(name), std::move(node_path), std::move(req_sorted), default_val_index, reset_on_init), - hold_fd_(hold_fd) { + hold_fd_(hold_fd), warn_timeout_(android::base::GetBoolProperty("ro.debuggable", false) ? 5ms : 50ms) { if (reset_on_init) { Update(false); } @@ -79,7 +80,7 @@ std::chrono::milliseconds FileNode::Update(bool log_error) { fd_.reset(); } auto duration = t.duration(); - if (duration > 50ms) { + if (duration > warn_timeout_) { LOG(WARNING) << "Slow writing to file: '" << node_path_ << "' with value: '" << req_value << "' took: " << duration.count() << " ms"; diff --git a/libperfmgr/include/perfmgr/FileNode.h b/libperfmgr/include/perfmgr/FileNode.h index 1365df17..34dbfc0c 100644 --- a/libperfmgr/include/perfmgr/FileNode.h +++ b/libperfmgr/include/perfmgr/FileNode.h @@ -46,6 +46,7 @@ class FileNode : public Node { FileNode& operator=(Node const&) = delete; const bool hold_fd_; + const std::chrono::milliseconds warn_timeout_; android::base::unique_fd fd_; }; |