ml: Get memory usage from proc/[pid]/status

The previous code parses /proc/[pid]/totmaps to obtain the memory usage,
but this is deprecated and has been removed upstream (crbug.com/979781).
In the modification, we instead parse the /proc/[pid]/status and use
VmRSS+VmSwap as the memory usage.

The new method does not use the hand-coded indices so the result
should be more robust.

The new number reported will be a bit different from the previous one
because it will include the shared memory. This should be fine because
it is the relative sizes of the numbers that matter, rather the absolute
values.

BUG=chromium:979781
TEST=Added util_test.cc and ran emerge-pyro ml
TEST=Also ran cros_workon_make --board=$BOARD $PACKAGE_NAME --test
TEST=Confirmed it fixed the crash in crbug.com/979781 on device

Change-Id: I7fbfb6a1daa2db046bab9644d954404272c54330
Reviewed-on: https://chromium-review.googlesource.com/1692241
Tested-by: Honglin Yu <honglinyu@chromium.org>
Commit-Ready: Honglin Yu <honglinyu@chromium.org>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Andrew Moylan <amoylan@chromium.org>
7 files changed
tree: ba1feaa210024e9889974b04ea89f35bf2135bab
  1. arc/
  2. attestation/
  3. authpolicy/
  4. avtest_label_detect/
  5. biod/
  6. bluetooth/
  7. bootstat/
  8. buffet/
  9. camera/
  10. cfm-device-updater/
  11. chaps/
  12. chromeos-common-script/
  13. chromeos-config/
  14. chromeos-dbus-bindings/
  15. common-mk/
  16. container_utils/
  17. crash-reporter/
  18. cros-disks/
  19. cros-fuzz/
  20. cros_component/
  21. crosdns/
  22. crosh/
  23. cryptohome/
  24. cups_proxy/
  25. debugd/
  26. dev-install/
  27. diagnostics/
  28. disk_updater/
  29. dlcservice/
  30. easy-unlock/
  31. feedback/
  32. fitpicker/
  33. glib-bridge/
  34. goldfishd/
  35. hammerd/
  36. hardware_verifier/
  37. hermes/
  38. image-burner/
  39. imageloader/
  40. init/
  41. installer/
  42. ippusb_manager/
  43. kerberos/
  44. libbrillo/
  45. libchromeos-rs/
  46. libchromeos-ui/
  47. libcontainer/
  48. libhwsec/
  49. libipproto/
  50. libmems/
  51. libpasswordprovider/
  52. libtpmcrypto/
  53. login_manager/
  54. lorgnette/
  55. media_perception/
  56. mems_setup/
  57. metrics/
  58. midis/
  59. mist/
  60. ml/
  61. modem-utilities/
  62. modemfwd/
  63. mtpd/
  64. oobe_config/
  65. p2p/
  66. peerd/
  67. permission_broker/
  68. policy_proto/
  69. policy_utils/
  70. portier/
  71. power_manager/
  72. qmi2cpp/
  73. regions/
  74. rendernodehost/
  75. run_oci/
  76. runtime_probe/
  77. salsa/
  78. screenshot/
  79. sealed_storage/
  80. secure_erase_file/
  81. sepolicy/
  82. shill/
  83. smbprovider/
  84. smogcheck/
  85. st_flash/
  86. storage_info/
  87. system_api/
  88. thd/
  89. timberslide/
  90. touch_firmware_calibration/
  91. touch_keyboard/
  92. tpm2-simulator/
  93. tpm_manager/
  94. tpm_softclear_utils/
  95. trace_events/
  96. trim/
  97. trunks/
  98. u2fd/
  99. usb_bouncer/
  100. userfeedback/
  101. userspace_touchpad/
  102. virtual_file_provider/
  103. vm_tools/
  104. vpn-manager/
  105. webserver/
  106. wifi-testbed/
  107. .clang-format
  108. .gitignore
  109. .gn
  110. COMMIT-QUEUE.ini
  111. CPPLINT.cfg
  112. LICENSE
  113. OWNERS
  114. PRESUBMIT.cfg
  115. README.md
README.md

The Chromium OS Platform

This repo holds (most) of the custom code that makes up the Chromium OS platform. That largely covers daemons, programs, and libraries that were written specifically for Chromium OS.

We moved from multiple separate repos in platform/ to a single repo in platform2/ for a number of reasons:

  • Make it easier to work across multiple projects simultaneously
  • Increase code re-use (via common libs) rather than duplicate utility functions multiple items over
  • Share the same build system

While most projects were merged, not all of them were. Some projects were standalone already (such as vboot), or never got around to being folded in (such as imageloader). Some day those extra projects might get merged in.

Similarly, some projects that were merged in, were then merged back out. This was due to the evolution of the Brillo project and collaboration with Android. That means the AOSP repos are the upstream and Chromium OS carries copies.

Local Project Directory

ProjectDescription
arcTools/deamons/init-scripts to run ARC
attestationDaemon and client for managing remote attestation
authpolicyDaemon for integrating with Microsoft Active Directory (AD) domains
avtest_label_detectTest tool for OCRing device labels
biodBiometrics daemon
bluetoothBluetooth Service and tools
bootstatTools for tracking points in the overall boot process (for metrics)
buffetDaemon for reacting to cloud messages
cameraChrome OS Camera daemon
cfm-device-updaterFirmware updaters for CFM peripherals
chapsPKCS #11 implementation for TPM 1 devices
chromeos-common-scriptShared scripts for partitions and basic disk information
chromeos-configCrOS unified build runtime config manager
chromeos-dbus-bindingsSimplifies the implementation of D-Bus daemons and proxies
common-mkCommon build & test logic for platform2 projects
container_utilsSupport tools for containers (e.g. device-jail)
crash-reporterThe system crash handler & reporter
cros-disksDaemon for mounting removable media (e.g. USB sticks and SD cards)
cros-fuzzSupport crate for fuzzing rust code
cros_component
crosdnsHostname resolution service for Chrome OS
croshThe Chromium OS shell
cryptohomeDaemon and tools for managing encrypted /home and /var directories
cups_proxyDaemon for proxying CUPS printing request
debugdCentralized debug daemon for random tools
dev-installTools & settings for managing the developer environment on the device
diagnosticsDevice telemetry and diagnostics daemons
disk_updaterUtility for updating root disk firmware (e.g. SSDs and eMMC)
dlcserviceDownloadable Content (DLC) Service daemon
easy-unlockDaemon for handling Easy Unlock requests (e.g. unlocking Chromebooks with an Android device)
feedbackDaemon for headless systems that want to gather feedback (normally Chrome manages it)
fitpicker
glib-bridgelibrary for libchrome-glib message loop interoperation
goldfishdAndroid Emulator Daemon
hammerdFirmware updater utility for hammer hardware
hardware_verifierHardware verifier tool
hermesChrome OS LPA implementation for eSIM hardware support
image-burnerDaemon for writing disk images (e.g. recovery) to USB sticks & SD cards
imageloaderDaemon for mounting signed disk images
initCrOS common startup init scripts and boot time helpers
installerCrOS installer utility (for AU/recovery/etc...)
ippusb_manager“Service” for ipp-over-usb printing
kerberosDaemon for managing Kerberos tickets
libbrilloCommon platform utility library
libchromeos-rsCommon platform utility library for Rust
libchromeos-ui
libcontainer
libhwsecLibrary for the utility functions of all TPM related daemons
libipprotoLibrary for building and parsing IPP (Internet Printing Protocol) frames
libmemsUtility library to configure, manage and retrieve events from IIO sensors
libpasswordproviderPassword Provider library for securely managing credentials with system services
libtpmcryptoLibrary for AES256-GCM encryption with TPM sealed keys
login_managerSession manager for handling the life cycle of the main session (e.g. Chrome)
lorgnetteDaemon for managing attached USB scanners via SANE
media_perceptionMedia perception service for select platforms
memdDaemon that logs memory-related data and events
mems_setupBoot-time initializer tool for sensors
metricsClient side user metrics collection
midisMIDI service
mistModem USB Interface Switching Tool
mlMachine learning service
modem-utilities
modemfwdDaemon for managing modem firmware updaters
mtpdDaemon for handling Media Transfer Protocol (MTP) with devices (e.g. phones)
oobe_configUtilities for saving and restoring OOBE config state
p2pService for sharing files between CrOS devices (e.g. updates)
peerdDaemon for communicating with local peers
permission_broker
policy_protoBuild file to compile policy proto file
policy_utilsTools and related library to set or override device policies
portierMulti-Network Neighbor Discovery Proxy service for Chrome OS
power_managerUserspace power management daemon and associated tools
qmi2cppChrome OS QMI IDL Compiler
regions
rendernodehostRender node forward library
run_ociMinimalistic container runtime
runtime_probeRuntime probe tool for ChromeOS
salsaTouchpad experimentation framework
screenshotTiny command to take a screenshot
sealed_storageLibrary for sealing data to device identity and state
secure_erase_fileHelper tools for securely erasing files from storage (e.g. keys and PII data)
sepolicySELinux policy for Chrome OS
shillChrome OS Connection Manager
smbproviderDaemon for connecting Samba / Windows networking shares to the Files.app
smogcheckDeveloper library for working with raw I2C devices
st_flash
storage_infoHelper shell functions for retrieving disk information)
system_apiHeaders and .proto files etc. to be shared with chromium
thdThermal daemon to help keep systems running cool
timberslideTool for working with EC crashes for reporting purposes
touch_firmware_calibration
touch_keyboardUtilities for a touch based virtual keyboard
tpm2-simulatorA software TPM 2.0 implementation (for testing/debugging)
tpm_managerDaemon and client for managing TPM setup and operations
tpm_softclear_utilsUtilities that soft-clear TPM (for testing only)
trace_eventsA framework for adding trace events to your Rust code.
trimService to manage filesystem trim operations in the background
trunksMiddleware and resource manager for interfacing with TPM 2.0 hardware
u2fdU2FHID emulation daemon for systems with secure elements (not TPMs)
usb_bouncerTools for managing USBGuard white-lists and configuration on Chrome OS
userfeedbackVarious utilities to gather extended data for user feedback reports
userspace_touchpad
virtual_file_provider
vm_toolsUtilities for Virtual Machine (VM) orchestration
vpn-manager
webserverSmall web server with D-Bus client backends
wifi-testbedTools for creating a WiFi testbed image

AOSP Project Directory

These projects can be found here: https://chromium.googlesource.com/aosp/platform/