Add missing include headers for compilation on Intel SDK for Google TV.

Change-Id: I172667643e13e2e1c278fd4c0156d5a2445d79f7

Conflicts:

	micro_bench/micro_bench.c
Detect an error case and prevent printing an uninitialized variable

pm_process_usage can return an error, and leave procs[i]->usage
unitialized.  Detect the error case and print a warning.  Also
make the initialization of procs[i]->usage to 0 unconditional,
so nothing will be printed in the final procrank stats when an
error is detected.

Change-Id: I03f90ae6a5ebb201b6e9e43593cec225e1a8ded0
Add information about totals to procrank.

Now print a sum of all pss and uss at then end of the output, and
then print information from /proc/meminfo to help put those in
context.

Change-Id: I323d219820830e9435bb4dcfd78cbb9a3d6c129c
Include the shared memory and slab memory in procrank output.

Change-Id: I0dac539c220fda867ce166d78dc898a8ec7aa18a
Ignore the vector page in /proc/<pid>/maps

In kernel 2.6.37, the vector page was added to /proc/<pid>/maps,
but because it is located above TASK_SIZE (usually 0xbf000000),
it is considered to be in the kernel's address space, not the
process', so it doesn't show up in /proc/<pid>/pagemap.

When the vector page is detected, using the name "[vectors]",
remove it from the map.

Change-Id: I5f0758bbe5d2b927056fa9fee684fea63dd0fa4b
Handle EOF when reading /proc/<pid>/pagemap

Instead of handling maps with the name "[vectors]" specially,
silently ignore EOF when reading from /proc/<pid>/pagemap, which
occurs any time a a mapping is outside of the userspace range.

Change-Id: I674ade1eab6fd7732c6d9e120d0750cca5415b25
Fix various issues in procrank.

Fixed these problems:
1. Page swapped bit was not extracted correctly.
2. Pages were ignored when page present bit is not set.
3. Bit operations were not correct.
4. There was a compiler warning about unsigned/signed comparision.
5. Line limit was too short for the map file. This was causing procrank
   to generate a warning and remove the related process from results.

Change-Id: Ifed3913a49b15f59010cfa842090a13228074df9
procrank/procmem fail on 0-length page mappings

procrank prints messages such as:
warning: could not read usage for 279
and does not include that pid in its table of results

procmem segfaults when run against that process

The problem is the 0-length page map at the top of the stack:

beb39000-beb39000 rw-p 00000000 00:00 0
beb39000-beb5a000 rw-p 00000000 00:00 0          [stack]

This patch changes the code to skip over that 0-length mapping when calculating
memory usage

Change-Id: I02aaaecdf64affbd28ab43a2d0865edda33816bc
More robust parsing for smaps

Change-Id: Ica273bf302bbc5025e48aa62eff5bf64fbdcac77
showmap enhancements

Fixed a bug where maps were being coalesced even when they were
not necessarily coalesced.

Enhanced the BSS segment detection heuristic so that it takes
the map start / end addresses into account and displays the
inferred map type directly.

Automatically sort all maps by name or address as appropriate.

Fixed a bug parsing maps with paths that contain whitespace.

Enhanced the -a argument to show the same columns as the normal
mode but just prefixed with the virtual memory map information.

Change-Id: Ice78afb0c5b597683cb1a1ba65e3c10f10258f7c
showmap now includes the number of maps in a row.

Change-Id: Ie8c5d01322ec7a2995a35ea050b38cc299568075
Don't assume that the stack is always at 0x1000000.

With our ASLR changes, the stack is now located at a random
location in memory. Remove the hardcoded assumption that the
stack will always be between 0x10000000 and 0x40000000.

Change-Id: Ic0b6d9e3ae844f057ace81a982cec7e2b344e179
Ignore SIGPIPE is some of the tools used via dumpstate

  adb bugreport > b & sleep 5; kill $?
will show that a bunch of tools will SIGPIPE when trying to output data
which is normal.
We don't have a way on linux (bsd yes), to set NOSIGPIPE on the file desc
passed down via fork/exec.

Bug: 6447319
Change-Id: I1634a00a155fd8a3fd827aa4a77e94518534336c