aboutsummaryrefslogtreecommitdiff
path: root/catapult/systrace/atrace_helper/jni/file_utils.cc
diff options
context:
space:
mode:
authorWei Wang <wvw@google.com>2018-02-26 14:02:53 -0800
committerWei Wang <wvw@google.com>2018-02-26 14:13:51 -0800
commitb2cf025c7d5cebd43084f38c6c7ff9cc17da428a (patch)
tree06e286adf2a464b39cf69d9ff9c91cad60d79772 /catapult/systrace/atrace_helper/jni/file_utils.cc
parent3e601f2c29e63f5151aa982790deea52645bc6ea (diff)
downloadchromium-trace-b2cf025c7d5cebd43084f38c6c7ff9cc17da428a.tar.gz
Notable changes: Add clk_set_rate support Add clock state support Bug: 73775767 Bug: 73795364 Test: ./systrace.py Change-Id: Iafb25ba9750f0e4cea6c8278788d8837e4a8776a
Diffstat (limited to 'catapult/systrace/atrace_helper/jni/file_utils.cc')
-rw-r--r--catapult/systrace/atrace_helper/jni/file_utils.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/catapult/systrace/atrace_helper/jni/file_utils.cc b/catapult/systrace/atrace_helper/jni/file_utils.cc
index 9ebec2da..7d122d6b 100644
--- a/catapult/systrace/atrace_helper/jni/file_utils.cc
+++ b/catapult/systrace/atrace_helper/jni/file_utils.cc
@@ -93,4 +93,25 @@ bool ReadProcFileTrimmed(int pid,
return ReadFileTrimmed(proc_path, buf, length);
}
+LineReader::LineReader(char* buf, size_t size)
+ : ptr_(buf), end_(buf + size) {
+}
+
+LineReader::~LineReader() {
+}
+
+const char* LineReader::NextLine() {
+ if (ptr_ >= end_)
+ return nullptr;
+ const char* cur = ptr_;
+ char* next = strchr(ptr_, '\n');
+ if (next) {
+ *next = '\0';
+ ptr_ = next + 1;
+ } else {
+ ptr_ = end_;
+ }
+ return cur;
+}
+
} // namespace file_utils