Show CPU# and utime/stime in the Dalvik thread dump.
This adds the "CPU number last executed on" from /proc/stat to
the Dalvik thread output. This may come in handy when looking at
thread dumps. While I was at it I added the utime/stime values,
which may not be all that useful since they represent lifetime usage
rather than recent usage.
Output appears on the schedstat line:
| schedstat=( 2930542006 9197204583 1284 ) ut=287 st=6 core=0
The routine that parses /proc/stat, previously only used for DDMS, has
been generalized. This also fixes a problem with parsing threads
whose name includes a space.
I also changed this and the /proc/schedstat code to use /proc/self
instead of /proc/%d + getpid().
Bug 2884342.
Change-Id: Iec85bc929005044427ebbb468bfa0c9693444bca
diff --git a/vm/Misc.h b/vm/Misc.h
index 358a97b..e188705 100644
--- a/vm/Misc.h
+++ b/vm/Misc.h
@@ -306,4 +306,14 @@
*/
void *dvmAllocRegion(size_t size, int prot, const char *name);
+/*
+ * Get some per-thread stats from /proc/self/task/N/stat.
+ */
+typedef struct {
+ unsigned long utime; /* number of jiffies scheduled in user mode */
+ unsigned long stime; /* number of jiffies scheduled in kernel mode */
+ int processor; /* number of CPU that last executed thread */
+} ProcStatData;
+bool dvmGetThreadStats(ProcStatData* pData, pid_t tid);
+
#endif /*_DALVIK_MISC*/