Simplify nanoapp debug dump section
Fixes: 153913426
Test: lshal debug android.hardware.contexthub@1.1::IContexthub/default
Change-Id: I2029b1df0c63f5feafcf6e69db252474e4a94461
diff --git a/core/event_loop.cc b/core/event_loop.cc
index 3dea458..eff448a 100644
--- a/core/event_loop.cc
+++ b/core/event_loop.cc
@@ -328,23 +328,24 @@
}
void EventLoop::logStateToBuffer(DebugDumpWrapper &debugDump) const {
- debugDump.print("\nNanoapps:\n");
+ debugDump.print("\nEvent Loop:\n");
+ debugDump.print(" Max event pool usage: %zu/%zu\n", mMaxEventPoolUsage,
+ kMaxEventCount);
+
Nanoseconds timeSince =
SystemTime::getMonotonicTime() - mTimeLastWakeupBucketCycled;
uint64_t timeSinceMins =
timeSince.toRawNanoseconds() / kOneMinuteInNanoseconds;
uint64_t durationMins =
kIntervalWakeupBucket.toRawNanoseconds() / kOneMinuteInNanoseconds;
- debugDump.print(" SinceLastBucketCycle=%" PRIu64
- "mins BucketDuration=%" PRIu64 "mins\n\n",
+ debugDump.print(" Nanoapp host wakeup tracking: cycled %" PRIu64
+ "mins ago, bucketDuration=%" PRIu64 "mins\n",
timeSinceMins, durationMins);
+
+ debugDump.print("\nNanoapps:\n");
for (const UniquePtr<Nanoapp> &app : mNanoapps) {
app->logStateToBuffer(debugDump);
}
-
- debugDump.print("\nEvent Loop:\n");
- debugDump.print(" Max event pool usage: %zu/%zu\n", mMaxEventPoolUsage,
- kMaxEventCount);
}
bool EventLoop::allocateAndPostEvent(uint16_t eventType, void *eventData,
diff --git a/core/nanoapp.cc b/core/nanoapp.cc
index 0fb0beb..5a93d40 100644
--- a/core/nanoapp.cc
+++ b/core/nanoapp.cc
@@ -21,6 +21,7 @@
#include "chre/platform/fatal_error.h"
#include "chre/platform/log.h"
#include "chre/util/system/debug_dump.h"
+#include "chre_api/chre/version.h"
#include <algorithm>
@@ -127,19 +128,23 @@
}
void Nanoapp::logStateToBuffer(DebugDumpWrapper &debugDump) const {
+ debugDump.print(" Id=%" PRIu32 " 0x%016" PRIx64 " ", getInstanceId(),
+ getAppId());
PlatformNanoapp::logStateToBuffer(debugDump);
- debugDump.print(" Id=%" PRIu32 " AppId=0x%016" PRIx64 " ver=0x%" PRIx32
- " targetAPI=0x%" PRIx32
- " currentAllocatedBytes=%zu peakAllocatedBytes=%zu",
- getInstanceId(), getAppId(), getAppVersion(),
- getTargetApiVersion(), getTotalAllocatedBytes(),
- getPeakAllocatedBytes());
- debugDump.print(" HostWakeups=[ Latest-> ");
+ debugDump.print(" v%" PRIu32 ".%" PRIu32 ".%" PRIu32 " tgtAPI=%" PRIu32
+ ".%" PRIu32 " curAlloc=%zu peakAlloc=%zu",
+ CHRE_EXTRACT_MAJOR_VERSION(getAppVersion()),
+ CHRE_EXTRACT_MINOR_VERSION(getAppVersion()),
+ CHRE_EXTRACT_PATCH_VERSION(getAppVersion()),
+ CHRE_EXTRACT_MAJOR_VERSION(getTargetApiVersion()),
+ CHRE_EXTRACT_MINOR_VERSION(getTargetApiVersion()),
+ getTotalAllocatedBytes(), getPeakAllocatedBytes());
+ debugDump.print(" hostWakeups=[ cur->");
// Get buckets latest -> earliest except last one
for (size_t i = mWakeupBuckets.size() - 1; i > 0; --i) {
debugDump.print("%" PRIu16 ", ", mWakeupBuckets[i]);
}
- // earliest bucket gets no comma
+ // Earliest bucket gets no comma
debugDump.print("%" PRIu16 " ]\n", mWakeupBuckets.front());
}
diff --git a/platform/slpi/platform_nanoapp.cc b/platform/slpi/platform_nanoapp.cc
index dd339cb..bdeaf28 100644
--- a/platform/slpi/platform_nanoapp.cc
+++ b/platform/slpi/platform_nanoapp.cc
@@ -393,8 +393,8 @@
void PlatformNanoapp::logStateToBuffer(DebugDumpWrapper &debugDump) const {
if (mAppInfo != nullptr) {
- debugDump.print(" %s: vendor=\"%s\" commit=\"%s\"", mAppInfo->name,
- mAppInfo->vendor, getAppVersionString());
+ debugDump.print("%s (%s) @ %s", mAppInfo->name, mAppInfo->vendor,
+ getAppVersionString());
}
}