diff options
author | Niranjan Pendharkar <npendhar@codeaurora.org> | 2017-08-15 21:54:41 -0700 |
---|---|---|
committer | Erik Kline <ek@google.com> | 2017-08-21 17:39:47 -0700 |
commit | 3493acab586c35a9cf9baffd027950d2413d936c (patch) | |
tree | 1c846f4ff7a97cc8743b9a5503d2fff234a4edc9 /msm8998 | |
parent | ec5a83ab38a41ea3f0af08c45276900e6d26cc39 (diff) | |
download | ipacfg-mgr-3493acab586c35a9cf9baffd027950d2413d936c.tar.gz |
print local log buffer to debug
Bug: 34361337
Test: manual
Change-Id: I2786eff206412871161512d675b183fa04d6ada9
(cherry picked from commit 89455fd63333f7a349de4baf3d432d2cc37750d9)
Diffstat (limited to 'msm8998')
-rw-r--r-- | msm8998/hal/inc/HAL.h | 3 | ||||
-rw-r--r-- | msm8998/hal/inc/LocalLogBuffer.h | 3 | ||||
-rw-r--r-- | msm8998/hal/src/HAL.cpp | 11 | ||||
-rw-r--r-- | msm8998/hal/src/LocalLogBuffer.cpp | 9 |
4 files changed, 24 insertions, 2 deletions
diff --git a/msm8998/hal/inc/HAL.h b/msm8998/hal/inc/HAL.h index 24761dd..c7b7817 100644 --- a/msm8998/hal/inc/HAL.h +++ b/msm8998/hal/inc/HAL.h @@ -161,6 +161,9 @@ public: const hidl_string& /* prefix */, removeDownstream_cb /* hidl_cb */); + /* Common */ + Return<void> debug(const hidl_handle& /* fd */, const hidl_vec<hidl_string>& /* options */); + private: typedef struct BoolResult { bool success; diff --git a/msm8998/hal/inc/LocalLogBuffer.h b/msm8998/hal/inc/LocalLogBuffer.h index c23ef7d..7cefe64 100644 --- a/msm8998/hal/inc/LocalLogBuffer.h +++ b/msm8998/hal/inc/LocalLogBuffer.h @@ -65,9 +65,10 @@ public: LocalLogBuffer(string /* name */, int /* maxLogs */); void addLog(FunctionLog /* log */); void toLogcat(); + void toFd(int fd); private: deque<FunctionLog> mLogs; const string mName; const size_t mMaxLogs; }; /* LocalLogBuffer */ -#endif /* _LOCAL_LOG_BUFFER_H_ */
\ No newline at end of file +#endif /* _LOCAL_LOG_BUFFER_H_ */ diff --git a/msm8998/hal/src/HAL.cpp b/msm8998/hal/src/HAL.cpp index 22aff0f..d722e78 100644 --- a/msm8998/hal/src/HAL.cpp +++ b/msm8998/hal/src/HAL.cpp @@ -77,7 +77,7 @@ HAL* HAL::makeIPAHAL(int version, IOffloadManager* mgr) { /* ------------------------------ PRIVATE ----------------------------------- */ -HAL::HAL(IOffloadManager* mgr) : mLogs("HAL Function Calls", 50) { +HAL::HAL(IOffloadManager* mgr) : mLogs("HAL Function Calls", 100) { mIPA = mgr; mCb.clear(); mCbIpa = nullptr; @@ -594,3 +594,12 @@ Return<void> HAL::removeDownstream mLogs.addLog(fl); return Void(); } /* removeDownstream */ + +Return<void> HAL::debug +( + const hidl_handle& fd, + const hidl_vec<hidl_string>& /* options */ +) { + mLogs.toFd(fd->data[0]); + return Void(); +} /* debug */ diff --git a/msm8998/hal/src/LocalLogBuffer.cpp b/msm8998/hal/src/LocalLogBuffer.cpp index f556e40..5e89557 100644 --- a/msm8998/hal/src/LocalLogBuffer.cpp +++ b/msm8998/hal/src/LocalLogBuffer.cpp @@ -33,6 +33,7 @@ #include <deque> #include <string> #include <sys/types.h> +#include <unistd.h> #include <vector> /* Internal Includes */ @@ -124,3 +125,11 @@ void LocalLogBuffer::toLogcat() { for (size_t i = 0; i < mLogs.size(); i++) ALOGD("%s: %s", mName.c_str(), mLogs[i].toString().c_str()); } /* toLogcat */ + +void LocalLogBuffer::toFd(int fd) { + for (size_t i = 0; i < mLogs.size(); i++) { + string line = mName + " " + mLogs[i].toString(); + write(fd, line.c_str(), line.size()); + write(fd, "\n", 1); + } +} /* toFd */ |