diff options
author | Andy McFadden <fadden@android.com> | 2010-08-31 13:50:08 -0700 |
---|---|---|
committer | Andy McFadden <fadden@android.com> | 2010-08-31 14:11:45 -0700 |
commit | 0a3f698117bd6438d0b668dfbb72828d25a23a3b (patch) | |
tree | a5e37d72c14adbe9eea5861736f8c0a575e9101f /vm/Misc.h | |
parent | c842a1d3ac530af7b5733aa83ad15495cd359ff0 (diff) | |
download | android_dalvik-0a3f698117bd6438d0b668dfbb72828d25a23a3b.tar.gz android_dalvik-0a3f698117bd6438d0b668dfbb72828d25a23a3b.tar.bz2 android_dalvik-0a3f698117bd6438d0b668dfbb72828d25a23a3b.zip |
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
Diffstat (limited to 'vm/Misc.h')
-rw-r--r-- | vm/Misc.h | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -306,4 +306,14 @@ size_t strlcpy(char *dst, const char *src, size_t size); */ 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*/ |