diff options
author | Chenjie Yu <cjyu@google.com> | 2018-11-01 07:15:12 -0700 |
---|---|---|
committer | Chenjie Yu <cjyu@google.com> | 2018-11-20 16:15:31 -0800 |
commit | ce8e4dce609541f90c444f27250a6a341b3f1d23 (patch) | |
tree | 31e74ea751487c29bb2453b82f1b322cd87be936 /libs | |
parent | f66699ae165ce30f1cda1cfd704027a75bf457d2 (diff) |
support work chain in pulled atoms
+ also rewrite map and merge isolated uid to host uid.
output:
Pull from 10014: { 1541137009000000000 10430748770707
(10014)0x2010101->1[I] 0x2010182->lala1[S] 0x2010201->2[I]
0x2018282->lala2[S] 0x20000->10430750[L] }
Bug: 119043339
Bug: 117975376
Test: unit test
Change-Id: Ib6e3ea0f76594438ee1b3e12e965d85fefb405d7
Diffstat (limited to 'libs')
-rw-r--r-- | libs/services/include/android/os/StatsLogEventWrapper.h | 11 | ||||
-rw-r--r-- | libs/services/src/os/StatsLogEventWrapper.cpp | 25 |
2 files changed, 35 insertions, 1 deletions
diff --git a/libs/services/include/android/os/StatsLogEventWrapper.h b/libs/services/include/android/os/StatsLogEventWrapper.h index f60c338bf9c4..8de2ab49f42b 100644 --- a/libs/services/include/android/os/StatsLogEventWrapper.h +++ b/libs/services/include/android/os/StatsLogEventWrapper.h @@ -82,6 +82,11 @@ struct StatsLogValue { STATS_LOG_VALUE_TYPE type; }; +struct WorkChain { + std::vector<int32_t> uids; + std::vector<std::string> tags; +}; + // Represents a parcelable object. Only used to send data from Android OS to statsd. class StatsLogEventWrapper : public android::Parcelable { public: @@ -99,7 +104,9 @@ class StatsLogEventWrapper : public android::Parcelable { int64_t getWallClockTimeNs() const { return mWallClockTimeNs; } - std::vector<StatsLogValue> getElements() const { return mElements; } + const std::vector<StatsLogValue>& getElements() const { return mElements; } + + const std::vector<WorkChain>& getWorkChains() const { return mWorkChains; } private: int mTagId; @@ -109,6 +116,8 @@ class StatsLogEventWrapper : public android::Parcelable { int64_t mWallClockTimeNs; std::vector<StatsLogValue> mElements; + + std::vector<WorkChain> mWorkChains; }; } // Namespace os } // Namespace android diff --git a/libs/services/src/os/StatsLogEventWrapper.cpp b/libs/services/src/os/StatsLogEventWrapper.cpp index 04c4629b5432..f6dfdef16e19 100644 --- a/libs/services/src/os/StatsLogEventWrapper.cpp +++ b/libs/services/src/os/StatsLogEventWrapper.cpp @@ -58,6 +58,31 @@ status_t StatsLogEventWrapper::readFromParcel(const Parcel* in) { ALOGE("statsd could not read wall clock time from parcel"); return res; } + int numWorkChain = 0; + if ((res = in->readInt32(&numWorkChain)) != OK) { + ALOGE("statsd could not read number of work chains from parcel"); + return res; + } + if (numWorkChain > 0) { + for (int i = 0; i < numWorkChain; i++) { + int numNodes = 0; + if ((res = in->readInt32(&numNodes)) != OK) { + ALOGE( + "statsd could not read number of nodes in work chain from parcel"); + return res; + } + if (numNodes == 0) { + ALOGE("empty work chain"); + return BAD_VALUE; + } + WorkChain wc; + for (int j = 0; j < numNodes; j++) { + wc.uids.push_back(in->readInt32()); + wc.tags.push_back(std::string(String8(in->readString16()).string())); + } + mWorkChains.push_back(wc); + } + } int dataSize = 0; if ((res = in->readInt32(&dataSize)) != OK) { ALOGE("statsd could not read data size from parcel"); |