History log of /frameworks/base/core/jni/android_os_Debug.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
6b8a522f16213a70f35a7bbb6db5c5ce8bdc1af7 27-Apr-2016 Martijn Coenen <maco@google.com> Don't count vm_map_ram as used memory in vmallocinfo.

Bug: 28378463
Change-Id: I1f22464dbd31bc9ee7f2307ce7eec4a0e2bbad06
/frameworks/base/core/jni/android_os_Debug.cpp
d47cbea81cbc3a986ebf511c73d39fb9b6d2634c 03-Mar-2016 Mathieu Chartier <mathieuc@google.com> Trim " (deleted)" from map names

Fixes application images to show as .art instead of GC accounting.
This was caused by storing the image in an anonymous map.

Bug: 27471334
Change-Id: I1a9584ab56cd7674df3832304886c743dafee731
/frameworks/base/core/jni/android_os_Debug.cpp
c4fb5f9d4b8012bc007f0c7e472d4ff4801254f5 03-Feb-2016 Colin Cross <ccross@android.com> Add dumpsys meminfo --unreachable

dumpsys meminfo --unreachable will search the native heap for
allocations that are unreachable.

Bug: 27208635
Change-Id: I40ab1c261cb222ca71d04ab8408f355bcb18ed94
(cherry picked from commit 84b1e3554b36b7fbccf57330c93bf484985ae3d6)
/frameworks/base/core/jni/android_os_Debug.cpp
e076485754dc30f9f798fb1242e6f7d5a0b6d39b 08-Jan-2016 Martijn Coenen <maco@google.com> Report SwapPss usage if available as part of Pss

Parse "SwapPss:" lines from /proc/pid/smaps if it exist, and store them
in a seperate stat entry.
Report SwapPss if made available by kernel, otherwise we fall back to
legacy Swap.

Fix getTotalSwappablePss documentation.

Change-Id: I361928c0f44c7dc9b959b91c127c916215063866
Signed-off-by: Thierry Strudel <tstrudel@google.com>
/frameworks/base/core/jni/android_os_Debug.cpp
228fa5f30fc9f7ec7d00742943b507465a40b46b 10-Dec-2015 Greg Hackmann <ghackmann@google.com> Return long long from get_zram_mem_used()

Commit 187a6aeb112ecbf85387a21ea75cf6beb3f9fc76 replaced atoll() with
fscanf("%ld"). Though unlikely, there could theoretically be 32-bit
devices with >2GB zram where the type difference matters.

Bug: 25951511

Change-Id: I902e27a214038fea1396185ef9a521316b0009f9
Signed-off-by: Greg Hackmann <ghackmann@google.com>
/frameworks/base/core/jni/android_os_Debug.cpp
187a6aeb112ecbf85387a21ea75cf6beb3f9fc76 09-Dec-2015 Greg Hackmann <ghackmann@google.com> Prefer new zram ABI

Starting with Linux 4.1, reading from /dev/block/zram*/mem_used_total
logs this warning:

"Attribute mem_used_total (and others) will be removed. See zram
documentation."

mem_used_total and several related counters are now consolidated under a
new node mm_stat. Prefer that when it's available.

Bug: 25951511

Change-Id: I0862c3cd1af5d003158aca6be42db25e4bebe7c7
Signed-off-by: Greg Hackmann <ghackmann@google.com>
/frameworks/base/core/jni/android_os_Debug.cpp
a6358d93a0f1cbc6469c226f7a77858e00b7de77 20-Oct-2015 Mathieu Chartier <mathieuc@google.com> Merge "Fix read_mapinfo to recognize free list large object space" into mnc-dr-dev am: 7f2deeeef5 am: df0cc41a7b
am: efa447e1ab

* commit 'efa447e1ab5a51c96219fc1d6204c128dbbaf661':
Fix read_mapinfo to recognize free list large object space
2e2069d053d43767662953298e7781ffede79fa1 19-Oct-2015 Mathieu Chartier <mathieuc@google.com> Fix read_mapinfo to recognize free list large object space

Bug: 25081604

(cherry picked from commit 6421da8f46e2a60da55939d8a4f7d91ab286dfcf)

Change-Id: If676c2309e3e397676fa8cef21405c34db7d5db2
/frameworks/base/core/jni/android_os_Debug.cpp
b57dd722f1dc0663417da37d3a82f8283ad3c982 24-Sep-2015 Elliott Hughes <enh@google.com> resolved conflicts for a884d81e to stage-aosp-master

Change-Id: Ice485967fa96f13786024b6939b826638e906ff0
76f6a86de25e1bf74717e047e55fd44b089673f3 19-Sep-2015 Daniel Micay <danielmicay@gmail.com> constify JNINativeMethod function pointer tables

Change-Id: I4036c924958221cbc644724f8eb01c5de3cd7954
/frameworks/base/core/jni/android_os_Debug.cpp
6bc5c3e1a5945762c61359884938d554c6c0aeb3 08-Jul-2015 Elliott Hughes <enh@google.com> am 7b12deb5: am 07e1c409: Merge "Android always has <malloc.h>."

* commit '7b12deb50b32bced71a9472027350fafbbe40bd4':
Android always has <malloc.h>.
c64df290e439eaba5d710d24ca89fff241b67dca 08-Jul-2015 Elliott Hughes <enh@google.com> Android always has <malloc.h>.

Change-Id: I9e18daeec26380c439f823e6a55ee61773c1b680
/frameworks/base/core/jni/android_os_Debug.cpp
ab3576e58a8d3965f57473e03ec8de69ae13404b 22-May-2015 Martijn Coenen <maco@google.com> Don't count lowmem mappings as memory used.

Bug: 21268095
Change-Id: I1b5f42752752584e947af710e53896203fbe477c
/frameworks/base/core/jni/android_os_Debug.cpp
3ed7643916ad8a839513355296f8203121fc91cd 01-May-2015 Mathieu Chartier <mathieuc@google.com> Look at map extensions before /dev/ + ashmem.

Prevents stuff like:
dalvik-classes.dex appearing as GC overhead.

(cherry picked from commit 9308462a5972192a1ad9abd01b36e1ad545eef99)

Bug: 20752953
Change-Id: Iab0935e882a5d938651ec2581845d8242aaf98af
/frameworks/base/core/jni/android_os_Debug.cpp
9308462a5972192a1ad9abd01b36e1ad545eef99 01-May-2015 Mathieu Chartier <mathieuc@google.com> Look at map extensions before /dev/ + ashmem.

Prevents stuff like:
dalvik-classes.dex appearing as GC overhead.

Bug: 20752953
Change-Id: Iab0935e882a5d938651ec2581845d8242aaf98af
/frameworks/base/core/jni/android_os_Debug.cpp
398e24ee14b0e818d9515f7c57691a4d02282d5f 23-Apr-2015 Martijn Coenen <maco@google.com> Fix vmalloc memory accounting (DO NOT MERGE).

VmallocUsed from meminfo sums all vmalloc'd
memory areas, but it shouldn't count the areas
that were mapped with ioremap(); ioremap()'d
ranges usually map to I/O memory, not actual
physical memory.

Binder and CMA are exceptions, but in the
common case we're more accurate not counting
those regions either.

Bug: 20483106
Change-Id: I75e74d9477a30a3de84877531b6e614a71469d24
(cherry picked from commit f33b6292168ea6e90c9d52d477c922af23001f63)
/frameworks/base/core/jni/android_os_Debug.cpp
16568705855f6c8dd78bc188c17e0237c5e827c0 12-Dec-2014 Iliyan Malchev <malchev@google.com> am 45838de9: fix Uss accounting in getPssPid()
automerge: 72468d2

* commit '72468d2d146f737b2b5d0223687b8fbc52723c76':
fix Uss accounting in getPssPid()
45838de942b87150fc3b03a8b943841a8647fd81 11-Dec-2014 Iliyan Malchev <malchev@google.com> fix Uss accounting in getPssPid()

Change-Id: I0d1dc81d127afbf3a7d7b4b86865ccb0e8bd7d4c
Signed-off-by: Iliyan Malchev <malchev@google.com>
/frameworks/base/core/jni/android_os_Debug.cpp
70acd9b36a9fc0d212b25d64f4edf0fc582331cf 09-Dec-2014 Sebastien Hertz <shertz@google.com> resolved conflicts for merge of beb84982 to lmp-mr1-dev-plus-aosp

Change-Id: Ib420549f3e20c149c15966dfece980b4f150177d
8b33cf4d34a9ea75e1121ee2f1d829b21f3cb5d6 09-Dec-2014 Dianne Hackborn <hackbod@google.com> Merge "Work on issue #18640385: Add procstats test mode" into lmp-mr1-dev
1a4b5a4f02e7d8ff8ff645377d97e6062d36aeaa 09-Dec-2014 Dianne Hackborn <hackbod@google.com> Work on issue #18640385: Add procstats test mode

You can now do "adb shell dumpsys procstats --start-testing" to
enable high frequency pss sampling.

Also improved the low on RAM mem reporting to separate out RAM
from memtrack, in case the data we are getting from that is bad.

And fixed meminfo --oom to work correctly again.

Change-Id: I7af17eab110a82298bd7b0ce381f8fa5c96c1f6a
/frameworks/base/core/jni/android_os_Debug.cpp
e417db6d574e90566e827bb2a1e5efeaa9c6d42e 09-Dec-2014 Mathieu Chartier <mathieuc@google.com> am 4ec1bdf5: am 52070f81: Merge "Add more -d dalvik details to dumpsys" into lmp-mr1-dev

* commit '4ec1bdf52f5c0d48fd13571796644feddc5a815b':
Add more -d dalvik details to dumpsys
25c5e2b12d5d5d06739e3f70a0da968d97935b46 09-Dec-2014 Mathieu Chartier <mathieuc@google.com> Add more -d dalvik details to dumpsys

Added .NonMoving for the non moving space.
Added .Zygote for the zygote.
Added .IndirectRef for indirect reference tables (jobjects).

Example:
Dalvik Details
.Heap 2264 2264 0 0
.LOS 80 80 0 0
.GC 144 144 0 0
.Zygote 331 196 0 2428
.NonMoving 540 540 0 0
.IndirectRef 20 20 0 0

Bug: 18672069
Change-Id: Id14e5bc92ceb15fe7a17d9fb035f18aa2925e50c
/frameworks/base/core/jni/android_os_Debug.cpp
582bdf9a5961a32de27556832e23e0611c4d1cbb 21-Nov-2014 Dan Albert <danalbert@google.com> am d8c169fe: am 0c437fd3: Merge "Add appropriate casts for char16_t."

* commit 'd8c169fedf883491e46b354484909694fd52cfaf':
Add appropriate casts for char16_t.
6698749dd4d4d6513b26aa9071af290b956b68a7 20-Nov-2014 Dan Albert <danalbert@google.com> Add appropriate casts for char16_t.

C++11 defines a real char16_t, which is not implicitly convertible to
uint16_t (and by extension jchar). Add casts as needed.

Bug: 18300613
Change-Id: I00752002ef2e938bdb57f70947e8fd53ec103293
/frameworks/base/core/jni/android_os_Debug.cpp
8415672e18cc6666d040435105fc7566ca525af4 19-Nov-2014 Mathieu Chartier <mathieuc@google.com> am 1073f202: am 36c7f4b6: Merge "Add zygote space to Dalvik Heap"

* commit '1073f2023efcc6cbd099358677d3e87ee996486d':
Add zygote space to Dalvik Heap
99f628286f42d235f753d6d50bb1bf2a3196341f 19-Nov-2014 Mathieu Chartier <mathieuc@google.com> Add zygote space to Dalvik Heap

Broken by
https://android-review.googlesource.com/#/c/115446/

This change fixes it by correctly putting the zygote in Dalvik Heap
instead of Dalvik Other.

Bug: 18447855

(cherry picked from commit 7fc9176c8a2102fb5be3668404bd15feb6878c89)

Change-Id: I9293e5d3f55ccfb2c93c6aacbf6abc164eacb10b
/frameworks/base/core/jni/android_os_Debug.cpp
7fc9176c8a2102fb5be3668404bd15feb6878c89 19-Nov-2014 Mathieu Chartier <mathieuc@google.com> Add zygote space to Dalvik Heap

Broken by
https://googleplex-android-review.git.corp.google.com/#/c/590612/

This change fixes it by correctly putting the zygote in Dalvik Heap
instead of Dalvik Other.

Bug: 18447855

Change-Id: I4a58480f1ef1eb17e760245d8690ce92e28ebea3
/frameworks/base/core/jni/android_os_Debug.cpp
035a7b0235835e856f39623fc571668e2d6048da 14-Nov-2014 Andreas Gampe <agampe@google.com> am 0626ec58: Merge "Frameworks/base: Wall Werror in core/jni"

* commit '0626ec58243c9dc7f4812a453ef9456b1f7ff1f4':
Frameworks/base: Wall Werror in core/jni
0f0b4919667f418b249c497f5ad3e83fdf4437e5 12-Nov-2014 Andreas Gampe <agampe@google.com> Frameworks/base: Wall Werror in core/jni

Turn on -Wall -Werror in core/jni. Fix warnings.

Clang TODO: For GCC we need to turn off Wunused-but-set-variable in
the GL bindings. However, Clang doesn't have that warning and thus
complains about an unknown pragma. It is necessary to make the
pragma #ifdef-ed on the compiler being GCC.

Change-Id: I14cab48d45c2771eef0432082356c47ed44a3d7f
/frameworks/base/core/jni/android_os_Debug.cpp
184293076201ec510898f8d505a8fe50458d9604 03-Nov-2014 Dianne Hackborn <hackbod@google.com> Few more small meminfo improvements.

- Add in category for graphics driver, and knowledge about it
for N5 (more devices will be added later).
- Renaming the labels for the .oat and .art files to be just
that, so it is clear what they are talking about.

Change-Id: I663ca8bd2febce41fcdde74b0d3a96ef9325edf1
/frameworks/base/core/jni/android_os_Debug.cpp
b3af4ec6bae4fe93d40f021e54cbbce10cc7b4c6 18-Oct-2014 Dianne Hackborn <hackbod@google.com> Fix issue #17948288: Improve accuracy of memory use reporting

We now use Mapped to not double-count cached pages that are
mapped in to app processes. Also read in some more values that
count towards kernel RAM use, and count buffers as free rather
than used RAM.

It also looks like the zram accounting is broken -- it was never
collecting the total zram reserved space. I need to figure out
how I was finding that before.

Change-Id: I883f6fc93966774b5c7d2801d1801666dd11ed41
/frameworks/base/core/jni/android_os_Debug.cpp
eee9764418d13176c9671e453775d476c2206f6c 24-Sep-2014 Mathieu Chartier <mathieuc@google.com> Fix dalvik map names

Some maps which should have been dalvik other were incorrectly
accounted for in dalvik heap.

Bug: 17632563

Change-Id: I90d0bebf700650a445b19c4c72674b2941868d8b
/frameworks/base/core/jni/android_os_Debug.cpp
0c6bc73c5e12dd4caae5bf3acbf1d26c3a9ad130 18-Jun-2014 Colin Cross <ccross@android.com> Fix reading memory usage for 64-bit processes

64-bit process will have virtual addresses that don't fit in an
unsigned long if ActivityManagerService is in a 32-bit process,
and the locations of the '-' and ' ' characters in the maps
are not predictable. Fix the sscanf for finding the start of the
mapping, and use it again to find the end of the mapping. Also
fix a few 64-bit warnings.

Change-Id: I8855c76085142768be1d45346f1032fd37cbe4eb
/frameworks/base/core/jni/android_os_Debug.cpp
853940331ff2be48ed3e63f459845e5e43d0a131 16-Apr-2014 Mark Salyzyn <salyzyn@google.com> frameworks: 64 bit compile issues

ToDo: core/jni/com_android_internal_net_NetworkStatsFactory.cpp (merge issues)

Change-Id: I5cf0bbb868e6c18e86c97c6491b6ee983a8ee1a2
/frameworks/base/core/jni/android_os_Debug.cpp
f5df700e6ce056ebfa322314d970e52d6facc35a 25-Mar-2014 Ashok Bhat <ashok.bhat@arm.com> AArch64: Make frameworks/base code more portable

Changes in this patch include

[x] Use %zu for size_t, %zd for ssize_t

[x] Some minor changes have been done to conform with
standard JNI practice (e.g. use of jint instead of int
in JNI function prototypes)

Change-Id: Id1aaa7894a7d0b85ac7ecd7b2bfd8cc40374261f
Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>
Signed-off-by: Craig Barber <craig.barber@arm.com>
Signed-off-by: Kévin PETIT <kevin.petit@arm.com>
Signed-off-by: Marcus Oakland <marcus.oakland@arm.com>
/frameworks/base/core/jni/android_os_Debug.cpp
dbccd44a638ae8705a5b14bff8b2dd74abc26045 22-Nov-2013 The Android Open Source Project <initial-contribution@android.com> Merge commit 'b873a17ce7be0a9771c24999adca6964431728f6' into HEAD

Change-Id: I938755073e70602cc8f51ce9bd420fdcf870cecd
c367d48c55e5a3fa0df14fd62889e4bb6b63cb01 29-Oct-2013 Elliott Hughes <enh@google.com> Fix a variety of small publicly-reported bugs.

Possible NULL dereference in cmds/bootanimation/BootAnimation.cpp.
https://code.google.com/p/android/issues/detail?id=61556

Missing fclose in core/jni/android_os_Debug.cpp.
https://code.google.com/p/android/issues/detail?id=61546

Bad loop guards in core/jni/android_util_Process.cpp.
https://code.google.com/p/android/issues/detail?id=61557

Assignment to wrong variable in libs/androidfw/AssetManager.cpp.
https://code.google.com/p/android/issues/detail?id=61560

Missing delete[]s in libs/androidfw/ObbFile.cpp.
https://code.google.com/p/android/issues/detail?id=61549

Leaks on error in tools/aapt/Images.cpp.
https://code.google.com/p/android/issues/detail?id=61552

Two missing fclose calls in tools/aapt/Resource.cpp.
https://code.google.com/p/android/issues/detail?id=61553

Missing fclose in tools/aidl/aidl.cpp.
https://code.google.com/p/android/issues/detail?id=61554

Change-Id: I5820f3824e72d07a9acb776cf0af3e7443f5694a
/frameworks/base/core/jni/android_os_Debug.cpp
8883ced18ac25199330843964634fdf70647a127 03-Oct-2013 Dianne Hackborn <hackbod@google.com> Implement issue #11050739: Show swapped out RAM

Add "swapped out" field to mem info everywhere.

Change-Id: I89abe8eb0e91fa5c193da93815dc592593c8a3c8
/frameworks/base/core/jni/android_os_Debug.cpp
cb4285537b1bf67b5a248e509d5fe41a6f49282e 26-Sep-2013 Dianne Hackborn <hackbod@google.com> Fix issue #10948509: Crash in procstats when there is no data

Not dealing with the case where there is a null list.

Also fixed some bugs I found while looking at this:

- When resetting the stats, we would use a newly computed time stamp
for the total durations rather than the one we used to reset the
proc/service entries. This would result in them being able to be
slightly > 100%.
- There was a bug in how we split a single process state into its
per-package representation, where we would but the cloned process
state into the new package's entry (instead of properly for its
own package entry), to be immediately overwritten by the new
process state we make for that package. This could result in
bad data for processes that have multiple packages.
- There was a bug in resetting service stats, where we wouldn't
update the overall run timestamp, allowing that time to sometimes
be > 100%.
- There was a bug in computing pss data for processes with multiple
packages, where the pss data was not distributed across all of the
activity per-package process states.
- There was a bug in computing the zram information that would cause
it to compute the wrong value, and then never be displayed.

Finally a little code refactoring so that ProcessState and ServiceState
can now share a common implementation for the table of duration values.

Change-Id: I5e0f4e9107829b81f395dad9419c33257b4f8902
/frameworks/base/core/jni/android_os_Debug.cpp
bde988ade5f75c3d241422dce2ee4124871fab53 26-Sep-2013 Adam Lesinski <adamlesinski@google.com> Merge "Add Graphics alloc tracking via memtrack" into klp-dev
cbd9a52f256087426feb19ac6e51eff772e81375 25-Sep-2013 Dianne Hackborn <hackbod@google.com> Fix issue #10903002: com.facebook.katana keeps itself in A Services

Now when memory low, if a service's process is above
a selected pss, then the process is not allowed to go
in to the service a list.

Also simplified the normal meminfo details dump to not
include the shared dirty and shared clean sizes by
default, since these can be very confusing. You will
still get to see them with the "-a" flag.

Finally some small steps to better managing service
processes in the LRU list, so hopefully we can some
day be better about letting them drop down in the list
when there isn't really much interesting happening in
the process. Not yet used at this point.

Change-Id: I654bfd6d05de2a63120185ebb15ffda8cbeb5dac
/frameworks/base/core/jni/android_os_Debug.cpp
5b4ef81f2b79dd5d597b1681de4d0311d46693aa 23-Sep-2013 Adam Lesinski <adamlesinski@google.com> Add Graphics alloc tracking via memtrack

Any OpenGL memory reported by /proc/pid/smaps will not be included
in the GPU GL memory count and will be considered Unknown. This is
an artifact of how some memory reporting is done in libmemtrack
and some is done in this module.

bug:10294768

Change-Id: Id8fb63b2e86520f4dbc8410573a509e66b96b13b
/frameworks/base/core/jni/android_os_Debug.cpp
8e69257a9c7e9c1781e1f53d8856358ada38921d 11-Sep-2013 Dianne Hackborn <hackbod@google.com> Implement #10749688: Improve low memory reporting

This significantly reworks the logging we do when
all cached processes are killed:

- We now collect the list of processes in-place so we
have a snapshot of exactly when the low memory situation
happened.
- In that snapshot we include the key process state: oom
adj, proc state, adj reasons.
- The report then asynchronously collects pss information
for those processes.
- The ultimate data printed to the log looks like a mix
between the "dumpsys meminfo" and "dumpsys activity"
output. This code no longer uses "dumpsys meminfo"
itself, so some of that data is no longer included,
in particular pss organized by allocation type.

In doing this, I realized that the existing code that is
supposed to run "procstats" is not currently working. And
at that point I realized, really, when we are collecting
this pss data we'd really like to include all those native
processes using ghod-only-knows how much RAM. And guess
what, we have a list of processes available in
ProcessCpuTracker.

So we now also collect and print information for native
processes, and we also do this for "dumpsys meminfo" which
really seems like a good thing when we are printing summaries
of all pss and such.

I also improved the code for reading /proc/meminfo to be
able to load all the interesting fields from there, and
am now printing that as well.

Change-Id: I9e7d13e9c07a8249c7a7e12e5433973b2c0fdc11
/frameworks/base/core/jni/android_os_Debug.cpp
87eac99a21772ae56018cb81db6966557b459554 10-Sep-2013 Ruben Brunk <rubenbrunk@google.com> Remove dependency on JNIHelp header side effects.

Bug: 10680559
Change-Id: I47870d6c48906e0a420c52b7bc5945ffe29c68a2
/frameworks/base/core/jni/android_os_Debug.cpp
37c99432625e2adeb50baf25f471abc8481b2b3e 06-Sep-2013 Dianne Hackborn <hackbod@google.com> Implement issue #10550827: watching gpu memory for occam_svelte

Well, it would work if the published file permissions gave the
system process access to them. :(

Change-Id: I99e0c506f52c212384b20a042dcdd35516cf49c2
/frameworks/base/core/jni/android_os_Debug.cpp
cb4728f247e3793e7fc1baa031290aa732bb77a7 09-Aug-2013 Colin Cross <ccross@android.com> parse named anonymous memory for dumpsys meminfo

Treat [anon:libc_malloc] as native heap and anything else that
starts with [anon: as unknown.

Bug: 10212959
Change-Id: Ifd120ae86e7a22291383df37d2b96f9f2dcd68b9
/frameworks/base/core/jni/android_os_Debug.cpp
c8230519728b14065effd3b7d4eca273ff86160c 14-Jul-2013 Dianne Hackborn <hackbod@google.com> Switch proc stats to use new process state constants.

These new constants are a better mapping to the kind of
information that procstats is wanting to collect about
processes. In doing this, the process states are tweaked
to have a bit more information that we care about for
procstats.

This changes the format of the data printed by procstats,
so the checkin version is bumped to 2. The structure is
the same, however the codes for process states have all
changed. The new codes are, in order of precedence:

p -- persistent system process.
t -- top activity; actually any visible activity.
f -- important foreground process (ime, wallpaper, etc).
b -- important background process
u -- performing backup operation.
w -- heavy-weight process (currently not used).
s -- background process running a service.
r -- process running a receiver.
h -- process hosting home/launcher app when not on top.
l -- process hosting the last app the user was in.
a -- cached process hosting a previous activity.
c -- cached process hosting a client activity.
e -- cached process that is empty.

In addition, we are now collecting uss along with pss
data for each process, so the pss checkin entries now
have three new values at the end of the min/avg/max uss
values of that process.

With this switch to using process state constants more
fundamentally, I realized that they could actually be
used by the core oom adj code to make it a lot cleaner.
So that change has been made, that code has changed quite
radically, and lost a lot of its secondary states and flags
that it used to use in its computation, now relying on
primarily the oom_adj and proc state values for the process.

This also cleaned up a few problems -- for example for
purposes of determing the memory level of the device, if a
long-running service dropped into the cached oom_adj level,
it would start being counted as a cached process and thus
make us think that the memory state is better than it is.
Now we do this based on the proc state, which always stays
as a service regardless of what is happening like this, giving
as a more consistent view of the memory state of the device.

Making proc state a more fundamentally part of the oom adj
computation means that the values can also be more carefully
tuned in semantic meaning so the value assigned to a process
doesn't tend to change unless the semantics of the process
has really significantly changed.

For example, a process will be assigned the service state
regardless of whether that services is executing operations
in the foreground, running normally, or has been dropped to
the lru list for pruning. The top state is used for everything
related to activities visible to the user: when actually on
top, visible but not on top, currently pausing, etc.

There is a new Context.BIND_SHOWING_UI added for when system
services bind to apps, to explicitly indicate that the app
is showing UI for the system. This gives us a better metric
to determine when it is showing UI, and thus when it needs
to do a memory trim when it is no longer in that state. Without
this, services could get in bad states of continually trimming.

Finally, more HashSet containers have been changed to ArraySet,
reducing the temporary iterators created for iterating over
them.

Change-Id: I1724113f42abe7862e8aecb6faae5a7620245e89
/frameworks/base/core/jni/android_os_Debug.cpp
cfc837f7fa43362b5049f648fe1bfdf5a010cc1c 28-Jun-2013 Dianne Hackborn <hackbod@google.com> Start really collecting PSS data for process stats.

The activity manager now uses some heuristics to try to
sample PSS data from processes so that it can get enough
data to over reasonable time have something useful, without
doing it too aggressively.

The current policy is:

1. Whenever a significant global change happens (memory state,
sceen on or off), we collect PSS from all processes; this will
not happen more than every 10 minutes.
2. When all activities become idle, we will collect PSS from the
current top process; this will not happen more than every 2
minutes per process.
3. We will sample the top-most process's PSS every 5 minutes.
4. When an process's oom adj changes and it has been more than
30 minutes since PSS has been collected from it, we will
collect a new PSS sample.
5. If a process changes from service A to service B (meaning it
has been running a service for a long time), we will collect
a PSS sample from it.
6. If someone explicitly requests PSS data (for running services
UI or dumpsys), record that.

Also:

- Finish moving the procstats output all to the new format.
- Record information about processes being killed due to excessive
wake locks or CPU use in procstats.
- Rework how we structure common vs. per-package process stats to
make it simpler to deal with.
- Optimize the Debug.getPss() implementation (we use it a lot now).
Should probably optimize it further at some point.

Change-Id: I179f1f7ae5852c7e567de4127d8457b50d27e0f0
/frameworks/base/core/jni/android_os_Debug.cpp
64770d16b0907a8e1ee81ef6c8fa398a6bdbee79 24-May-2013 Dianne Hackborn <hackbod@google.com> Some improvements to meminfo output.

- Rename "Swappable PSS" to "PSS Clean" which I think is what it
means and is consistent with the other memory metrics.
- Split at the top level the dalvik heap from other dalvik allocations,
so when you look on the dalvik allocations line things are consistent
with the allocator's data and it is clear what are app allocations vs.
other data in dalvik.
- Don't print lines that are all 0.
- Don't print the detailed Dalvik allocation data by default; add a new
option to have it printed.

Here's what a typical system process dump now looks like:

** MEMINFO in pid 6358 [system] **
Pss Pss Shared Private Shared Private Heap Heap Heap
Total Clean Dirty Dirty Clean Clean Size Alloc Free
------ ------ ------ ------ ------ ------ ------ ------ ------
Native Heap 0 0 0 0 0 0 6964 3599 2048
Dalvik Heap 7541 0 4344 7356 0 0 11768 11194 574
Dalvik Other 3553 0 2792 3448 0 0
Stack 28 0 8 28 0 0
Cursor 4 0 0 4 0 0
Ashmem 5 0 12 0 0 0
Other dev 4004 0 24 4000 0 4
.so mmap 3959 684 2500 2280 5468 684
.apk mmap 173 68 0 0 692 68
.dex mmap 4358 3068 0 0 9276 3068
Other mmap 60 0 8 8 244 36
Unknown 4387 0 508 4380 0 0
TOTAL 28072 3820 10196 21504 15680 3860 18732 14793 2622

Objects
Views: 10 ViewRootImpl: 1
AppContexts: 8 Activities: 0
Assets: 3 AssetManagers: 3
Local Binders: 176 Proxy Binders: 341
Death Recipients: 141
OpenSSL Sockets: 0

SQL
MEMORY_USED: 473
PAGECACHE_OVERFLOW: 98 MALLOC_SIZE: 62

DATABASES
pgsz dbsz Lookaside(b) cache Dbname
4 68 49 7/21/7 /data/data/com.android.providers.settings/databases/settings.db
4 20 17 0/13/1 /data/system/locksettings.db
4 20 21 96/14/2 /data/system/locksettings.db (1)
4 20 21 75/13/2 /data/system/locksettings.db (2)
4 80 29 4/17/3 /data/system/users/0/accounts.db

Change-Id: Ifd511a7baaa8808f82f39509a5a15c71c41d1bac
/frameworks/base/core/jni/android_os_Debug.cpp
3c61506b7147e13b9d39fc07fb189504fcab4541 13-May-2013 Anwar Ghuloum <anwarg@google.com> Add more memory usage stats

Added support for teasing apart different parts of the dalvik heap.

Note this adds more public api and we should talk to hackbod before going into master with this.

(cherry picked from commit 73407daf3f6110e933d8614605b21586c4c5fde2)

Change-Id: If4431f50e67e18bcc42e00694c97805477bd6815
/frameworks/base/core/jni/android_os_Debug.cpp
3a8ce1bec819c9b104880493a6862fd2a9546132 27-Apr-2013 Anwar Ghuloum <anwarg@google.com> More stats for meminfo

Added shared clean tracking (for pageable stuff). Renamed .oat and .art mmap.

(cherry picked from commit 967d53b17b6010c3a675ca9c3bbd0e9dd2f2f092)

Change-Id: I741e0dbe0d3f9aee6975c6fad8af9905942962d4
/frameworks/base/core/jni/android_os_Debug.cpp
88887d0a53f866e61a7524b0edfc95e6dde57d72 19-Mar-2013 Anwar Ghuloum <anwarg@google.com> break out boot.art

breaking out boot.art mapped pages

(cherry picked from commit eaa3f2d59adaeb87cd8d1726b696521f984659c4)

Change-Id: Ie89477bd3a93a15de3a4db76ef5eae497c3087e3
/frameworks/base/core/jni/android_os_Debug.cpp
8884ef4fe80505bc6e41c167b67efbb93e43475d 15-Mar-2013 Anwar Ghuloum <anwarg@google.com> Break out Oat footprint for ram

Breaking out oat footprint in meminfo.

(cherry picked from commit c92f177d96b5952e0bfde01597972fc607aed93a)

Change-Id: I7b0452045c265b7544c41d3a5953e10a081c5315
/frameworks/base/core/jni/android_os_Debug.cpp
7c9f30bfb361ccb864e6d130e0f4f2af53fc1c32 27-Feb-2013 Ian Rogers <irogers@google.com> Track stack memory in MemoryInfo.

In /proc/pid/maps the main stack is identified as "[stack]". In Linux 3.4
thread stacks are identified as "[stack:<tid>]" where <tid> is the thread ID of
the thread using that stack. Add support in MemInfo's otherStats to track
memory being used by the stack.

Add sanity check on the length of the otherStats array.
Add detail messages to two null pointer exceptions.

Bug: 8265251

Change-Id: I2b228b147da9bdc5c7a4d825dfc628fcc7923927
/frameworks/base/core/jni/android_os_Debug.cpp
9f8589c31f8910a9c3c33a81675822da9f0cf2df 23-Feb-2013 Ian Rogers <irogers@google.com> Recognize odex files in memory accounting.

Give odex files the same heap category as dex files.

Change-Id: I82539e20ac20a2b80c63c0cfceb266d9c59e22b7
/frameworks/base/core/jni/android_os_Debug.cpp
afc10e174d73363185f42cb67ec429a64549f2c7 22-Feb-2013 Ian Rogers <irogers@google.com> Account malloc mmaped pages as native heap.

Currently when malloc uses a page rather than brk the heap gets accounted as
ashmem memory. Previously the memory would be accounted as unknown but since
[1] it gets accounted as ashmem. This change makes the accounting see this
memory as being native, ie the same kind of memory we associate with brk.

[1] https://android-review.googlesource.com/#/c/49583/3

Change-Id: I6f496cfeb590268d41d8e047b12cd5c90359e2b0
/frameworks/base/core/jni/android_os_Debug.cpp
f72467ad9843bf5d4b75fb308386e77ebb5c3447 09-Jun-2012 Dianne Hackborn <hackbod@google.com> Include important native processes in watchdog stacks.

Helps us track down deadlocks involving native service processes.

Bug: 6615693
Change-Id: I580047550772e29586195a8cf440141574e3f40c
/frameworks/base/core/jni/android_os_Debug.cpp
8564c8da817a845353d213acd8636b76f567b234 06-Jan-2012 Steve Block <steveblock@google.com> Rename (IF_)LOGW(_IF) to (IF_)ALOGW(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/157065

Bug: 5449033
Change-Id: I00a4b904f9449e6f93b7fd35eac28640d7929e69
/frameworks/base/core/jni/android_os_Debug.cpp
6215d3ff4b5dfa52a5d8b9a42e343051f31066a5 04-Jan-2012 Steve Block <steveblock@google.com> Rename (IF_)LOGI(_IF) to (IF_)ALOGI(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/156801

Bug: 5449033
Change-Id: Ib08fe86d23db91ee153e9f91a99a35c42b9208ea
/frameworks/base/core/jni/android_os_Debug.cpp
5baa3a62a97544669fba6d65a11c07f252e654dd 20-Dec-2011 Steve Block <steveblock@google.com> Rename (IF_)LOGD(_IF) to (IF_)ALOGD(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/156016

Bug: 5449033
Change-Id: I4c4e33bb9df3e39e11cd985e193e6fbab4635298
/frameworks/base/core/jni/android_os_Debug.cpp
b437e090ec03a2bab10bdfcb9484577a7f34e157 06-Aug-2011 Dianne Hackborn <hackbod@google.com> Improved memory use reporting.

Change-Id: I38e53e6228bba92a142bafeedb5af8df4e4e5724
/frameworks/base/core/jni/android_os_Debug.cpp
0e3328fbdd3845b0e2bec364e951498eaee6b079 17-Jul-2011 Dianne Hackborn <hackbod@google.com> Rework and fix "adb shell dumpsys meminfo"

We now collect more detailed information splitting the maps into
additional useful categories.

Fixed some bugs in account, such as not correctly handling all of
the current dalvik allocations.

The activity manager now prints a final summary of all pss organized
by the apps and the categories.

Change-Id: Iafc5f27c998095812b1483c6803b8e0f0587aeae
/frameworks/base/core/jni/android_os_Debug.cpp
c1b9bbb21c8ad5109978a4e9e770cd18b0257434 13-Jul-2011 Mike Lockwood <lockwood@android.com> Remove some #ifdef HAVE_ANDROID_OS that were needed for the simulator build

Change-Id: I13d9f251f86c05ae5405f37adbf6b8e9660935ba
Signed-off-by: Mike Lockwood <lockwood@android.com>
/frameworks/base/core/jni/android_os_Debug.cpp
393b84c137fe52f42205cef7e63b7a04b4bfd789 18-Oct-2010 Brian Carlstrom <bdc@google.com> Extended android.os.Debug.dumpNativeHeap to include /proc/self/maps contents

Change-Id: I86da98bc48111007d8226d8d0dbc7be470bde877
/frameworks/base/core/jni/android_os_Debug.cpp
06a6b558bd03d8f0fed8f94f1dcfc03c5a51bd1c 14-Jul-2010 Andy McFadden <fadden@android.com> Implement native dump for "am dumpheap -n".

This adds the ability to generate a trivial heap dump on demand. If
the appropriate system properties aren't set, the output file will
instead contain instructions for enabling them.

The data returned by get_malloc_leak_info() is processed and written
to the specified file. The output looks something like:

Android Native Heap Dump v1.0

Total memory: 2981301
Allocation records: 2152

z 1 sz 65557 num 1 bt 8010dd78 afd12618 ...
z 1 sz 52008 num 3 bt 8010dd78 afd12618 ...
z 1 sz 24428 num 1 bt 8010dd78 8010de84 ...
...2149 more...
END

(the "..." is actually the remaining entries in the stack backtrace;
I truncated it here)

"z" indicates whether the allocation was made pre- or post-zygote,
"sz" is the size allocated, and "num" is the number of allocations
made of that size with the specified backtrace.

Change-Id: I2d60f07444fce5f7178b3f51c928c8faa0b051bd
/frameworks/base/core/jni/android_os_Debug.cpp
3025ef332c29e255388f74b2afefe05f64bce07c 01-Sep-2009 Dianne Hackborn <hackbod@google.com> Various infrastructure to support a running services UI.

Some of this is temporary (in particular the two approaches for getting
process memory, one working but horrible, the other not working but
preferred) until I figure out the best way to do it.

Change-Id: I8c8f25062d481fcea22a47d459b083d2fd8a5040
/frameworks/base/core/jni/android_os_Debug.cpp
bd51116a5310683f70a37110bf735252dc7e4e38 09-Jul-2009 Grace Kloba <klobag@google.com> Fix couple of bugs in the meminfo report.
. added the new "/data/dalvik-cache/" to dalvik heap
. shortened the starting line's length from 40 to 30 to handle the case where there is no name
. fixed the pri/shared for others. It was swapped.
/frameworks/base/core/jni/android_os_Debug.cpp
9066cfe9886ac131c34d59ed0e2d287b0e3c0087 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
/frameworks/base/core/jni/android_os_Debug.cpp
d83a98f4ce9cfa908f5c54bbd70f03eec07e7553 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
/frameworks/base/core/jni/android_os_Debug.cpp
3001a035439d8134a7d70d796376d1dfbff3cdcd 19-Feb-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@132276
/frameworks/base/core/jni/android_os_Debug.cpp
d24b8183b93e781080b2c16c487e60d51c12da31 11-Feb-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@130745
/frameworks/base/core/jni/android_os_Debug.cpp
54b6cfa9a9e5b861a9930af873580d6dc20f773c 21-Oct-2008 The Android Open Source Project <initial-contribution@android.com> Initial Contribution
/frameworks/base/core/jni/android_os_Debug.cpp