summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-03-12 23:26:14 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-03-12 23:26:14 +0000
commitab21fa60a3fddd9891bf4d57e19889bc882870e4 (patch)
tree368c8e47bd6c44d6194073495e39b4b2a1ff8e53
parente48847ea6e58173ed3a303faec5f0e964cfe8923 (diff)
parente7cb330bf9c57da1c547550b5b0599c92744028e (diff)
downloadextras-ab21fa60a3fddd9891bf4d57e19889bc882870e4.tar.gz
libperfmgr: change slow node warning to 5ms in userdebug build am: e7cb330bf9
Change-Id: Ic482e27b3a7a7d1746066c4f982ea93d9f55f7eb
-rw-r--r--libperfmgr/FileNode.cc5
-rw-r--r--libperfmgr/include/perfmgr/FileNode.h1
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_;
};