Expose number of idle pages on heap dump.

Further work on this is also exposing pages that are !KPF_DIRTY, i.e. that are
allocated and then never written to.

Bug: 132952543
Change-Id: Ibe7e2e15dc275833a6eabfdee10e6c2ed7cc1d98
diff --git a/tools/heap_profile b/tools/heap_profile
index e1e7d72..96681a3 100755
--- a/tools/heap_profile
+++ b/tools/heap_profile
@@ -145,6 +145,9 @@
                       "client to wait for buffer space. Use with caution as "
                       "this can significantly slow down the client.",
                       action="store_true")
+  parser.add_argument("--idle-allocations", help="Keep track of how many "
+                      "bytes were unused since the last clear_refs, per "
+                      "callstack", action="store_true")
   parser.add_argument("--simpleperf", action="store_true",
                       help="Get simpleperf profile of heapprofd. This is "
                       "only for heapprofd development.")
@@ -178,6 +181,8 @@
   target_cfg = ""
   if args.block_client:
     target_cfg += "block_client: true\n"
+  if args.idle_allocations:
+    target_cfg += "idle_allocations: true\n"
   if args.pid:
     for pid in args.pid.split(','):
       try: