summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWei Wang <wvw@google.com>2020-03-12 14:13:33 -0700
committerWei Wang <wvw@google.com>2020-03-12 14:16:26 -0700
commite7cb330bf9c57da1c547550b5b0599c92744028e (patch)
tree368c8e47bd6c44d6194073495e39b4b2a1ff8e53
parentbcfbb47662058f07ea675a110dde25163fec5729 (diff)
downloadextras-e7cb330bf9c57da1c547550b5b0599c92744028e.tar.gz
libperfmgr: change slow node warning to 5ms in userdebug build
Bug: 134845490 Test: boot Change-Id: I301020bb988ee53c756e176e97f604b9d16be42d
-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_;
};