diff options
Diffstat (limited to 'cmds/statsd/src/external/KernelUidCpuActiveTimeReader.cpp')
-rw-r--r-- | cmds/statsd/src/external/KernelUidCpuActiveTimeReader.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/cmds/statsd/src/external/KernelUidCpuActiveTimeReader.cpp b/cmds/statsd/src/external/KernelUidCpuActiveTimeReader.cpp index 7a2d1991a538..0b545ccb3658 100644 --- a/cmds/statsd/src/external/KernelUidCpuActiveTimeReader.cpp +++ b/cmds/statsd/src/external/KernelUidCpuActiveTimeReader.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -#define DEBUG true // STOPSHIP if true +#define DEBUG false // STOPSHIP if true #include "Log.h" #include <fstream> @@ -23,6 +23,7 @@ #include "guardrail/StatsdStats.h" #include "logd/LogEvent.h" #include "statslog.h" +#include "stats_log_util.h" using std::make_shared; using std::shared_ptr; @@ -57,7 +58,9 @@ bool KernelUidCpuActiveTimeReader::PullInternal(vector<shared_ptr<LogEvent>>* da return false; } - uint64_t timestamp = time(nullptr) * NS_PER_SEC; + int64_t wallClockTimestampNs = getWallClockNs(); + int64_t elapsedTimestampNs = getElapsedRealtimeNs(); + char buf[kLineBufferSize]; char* pch; while (!fin.eof()) { @@ -70,7 +73,7 @@ bool KernelUidCpuActiveTimeReader::PullInternal(vector<shared_ptr<LogEvent>>* da int idx = 0; do { timeMs = std::stoull(pch); - auto ptr = make_shared<LogEvent>(mTagId, timestamp); + auto ptr = make_shared<LogEvent>(mTagId, wallClockTimestampNs, elapsedTimestampNs); ptr->write(uid); ptr->write(idx); ptr->write(timeMs); |