adb shell dumpsys 命令查看内存

用以下命令可以查看程序的内存使用情况:

adb shell dumpsys meminfo $package_name or $pid

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
此外adb shell dumpsys命令还可以用来查看系统服务信息,使用下面命令可以输出系统当前支持的服务:

adb shell service list

输出:

Microsoft Windows [版本 6.1.7601]
版权所有 (c) 2009 Microsoft Corporation。保留所有权利。

C:\Users\asus>adb shell service list
Found 163 services:
0       call_adapter: [com.android.internal.telecom.IMzInCallAdapter]
1       flyme_novccusagestats: [android.nonvccUsageStats.INonVccStatsInterfaces]
2       alphame_server: [com.meizu.common.alphame.IAlphaMe]
3       GbaService: [com.mediatek.gba.IGbaService]
4       dcm_service: [com.meizu.datamanager.IDataCollectManagerInterface]
5       GpuAppSpectatorService: [com.mediatek.GpuAppSpectatorService]
6       carrier_config: [com.android.internal.telephony.ICarrierConfigLoader]
7       phone_ext: [android.telephony.ITelephonyExt]
8       phoneEx: [com.mediatek.internal.telephony.ITelephonyEx]
9       phone: [com.android.internal.telephony.ITelephony]
10      isms: [com.android.internal.telephony.ISms]
11      iphonesubinfo: [com.android.internal.telephony.IPhoneSubInfo]
12      simphonebook: [com.android.internal.telephony.IIccPhoneBook]
13      IIccPhoneBookMz: [com.android.internal.telephony.meizu.IIccPhoneBookMz]
14      telecom: [com.android.internal.telecom.ITelecomService]
15      isub: [com.android.internal.telephony.ISub]
16      ims: [com.android.ims.internal.IImsService]
17      wfo: [com.mediatek.wfo.IWifiOffloadService]
18      flyme_theme_service: [android.content.res.flymetheme.IFlymeThemeManager]
19      contexthub_service: [android.hardware.location.IContextHubService]
20      dns_listener: [android.net.metrics.IDnsEventListener]
21      connmetrics: [android.net.IIpConnectivityMetrics]
22      connectivity_metrics_logger: [android.net.IConnectivityMetricsLogger]
23      bluetooth_manager: [android.bluetooth.IBluetoothManager]
24      trp: [meizu.security.ITRPEng]
25      flyme_intelligent_engine: [android.perf.IIntelligentEngineService]
26      flyme_packagemanager: [android.content.pm.IFlymePackageManager]
27      flyme_wallpaper: [meizu.wallpaper.IFlymeWallpaper]
28      device_states: [meizu.os.IDeviceStateService]
29      hips_service: [meizu.hips.IFlymeHipsService]
30      flyme_permission: [meizu.security.IFlymePermissionService]
31      gesture_manager: [android.view.IGestureManager]
32      access_control: [meizu.security.IAccessControlManager]
33      move_window: [meizu.view.IMoveWindow]
34      imms: [com.android.internal.telephony.IMms]
35      media_projection: [android.media.projection.IMediaProjectionManager]
36      mtk-perfservice: [com.mediatek.perfservice.IPerfService]
37      launcherapps: [android.content.pm.ILauncherApps]
38      shortcut: [android.content.pm.IShortcutService]
39      fingerprint: [android.hardware.fingerprint.IFingerprintService]
40      trust: [android.app.trust.ITrustManager]
41      media_router: [android.media.IMediaRouterService]
42      media_session: [android.media.session.ISessionManager]
43      restrictions: [android.content.IRestrictionsManager]
44      print: [android.print.IPrintManager]
45      graphicsstats: [android.view.IGraphicsStats]
46      dreams: [android.service.dreams.IDreamManager]
47      commontime_management: []
48      network_time_update_service: []
49      samplingprofiler: []
50      diskstats: []
51      voiceinteraction: [com.android.internal.app.IVoiceInteractionManagerService]
52      appwidget: [com.android.internal.appwidget.IAppWidgetService]
53      backup: [android.app.backup.IBackupManager]
54      soundtrigger: [com.android.internal.app.ISoundTriggerService]
55      jobscheduler: [android.app.job.IJobScheduler]
56      hardware_properties: [android.os.IHardwarePropertiesManager]
57      serial: [android.hardware.ISerialManager]
58      usb: [android.hardware.usb.IUsbManager]
59      midi: [android.media.midi.IMidiManager]
60      DockObserver: []
61      audio: [android.media.IAudioService]
62      wallpaper: [android.app.IWallpaperManager]
63      dropbox: [com.android.internal.os.IDropBoxManagerService]
64      search_engine: [com.mediatek.search.ISearchEngineManagerService]
65      search: [android.app.ISearchManager]
66      country_detector: [android.location.ICountryDetector]
67      location: [android.location.ILocationManager]
68      devicestoragemonitor: []
69      notification: [android.app.INotificationManager]
70      recovery: [android.os.IRecoverySystem]
71      updatelock: [android.os.IUpdateLock]
72      servicediscovery: [android.net.nsd.INsdManager]
73      pppoe: [android.net.pppoe.IPppoeManager]
74      connectivity: [android.net.IConnectivityManager]
75      ethernet: [android.net.IEthernetManager]
76      rttmanager: [android.net.wifi.IRttManager]
77      wifiscanner: [android.net.wifi.IWifiScanner]
78      wifi: [android.net.wifi.IWifiManager]
79      wifip2p: [android.net.wifi.p2p.IWifiP2pManager]
80      netpolicy: [android.net.INetworkPolicyManager]
81      netstats: [android.net.INetworkStatsService]
82      network_score: [android.net.INetworkScoreService]
83      textservices: [com.android.internal.textservice.ITextServicesManager]
84      networkmanagement_service_flyme: [android.os.INetworkManagementServiceFlyme]
85      network_management: [android.os.INetworkManagementService]
86      clipboard: [android.content.IClipboard]
87      flyme_statusbar: [meizu.statusbar.IFlymeStatusBarService]
88      statusbar: [com.android.internal.statusbar.IStatusBarService]
89      device_policy: [android.app.admin.IDevicePolicyManager]
90      deviceidle: [android.os.IDeviceIdleController]
91      persistent_data_block: [android.service.persistentdata.IPersistentDataBlockService]
92      lock_settings: [com.android.internal.widget.ILockSettings]
93      uimode: [android.app.IUiModeManager]
94      mount: [IMountService]
95      accessibility: [android.view.accessibility.IAccessibilityManager]
96      input_method: [com.android.internal.view.IInputMethodManager]
97      pinner: []
98      vrmanager: [android.service.vr.IVrManager]
99      input: [android.hardware.input.IInputManager]
100     window: [android.view.IWindowManager]
101     alarm: [android.app.IAlarmManager]
102     consumer_ir: [android.hardware.IConsumerIrService]
103     vibrator: [android.os.IVibratorService]
104     content: [android.content.IContentService]
105     account: [android.accounts.IAccountManager]
106     media.camera.proxy: [android.hardware.ICameraServiceProxy]
107     telephony.registry: [com.android.internal.telephony.ITelephonyRegistry]
108     scheduling_policy: [android.os.ISchedulingPolicyService]
109     webviewupdate: [android.webkit.IWebViewUpdateService]
110     usagestats: [android.app.usage.IUsageStatsManager]
111     battery: []
112     sensorservice: [android.gui.SensorServer]
113     device_control: [meizu.os.IDeviceControlService]
114     flyme_error_report_manager: [android.app.IFlymeErrorReportManager]
115     anrmanager: [android.app.IANRManager]
116     processinfo: [android.os.IProcessInfoService]
117     permission: [android.os.IPermissionController]
118     cpuinfo: []
119     dbinfo: []
120     gfxinfo: []
121     meminfo: []
122     procstats: [com.android.internal.app.procstats.IProcessStats]
123     activity: [android.app.IActivityManager]
124     user: [android.os.IUserManager]
125     otadexopt: [android.content.pm.IOtaDexopt]
126     package: [android.content.pm.IPackageManager]
127     netd: [android.net.INetd]
128     media.mmsdk: [com.mediatek.mmsdk.IMMSdkService]
129     media.camera: [android.hardware.ICameraService]
130     display: [android.hardware.display.IDisplayManager]
131     sub_display_power: [meizu.os.ISubDisplayPowerManager]
132     power: [android.os.IPowerManager]
133     appops: [com.android.internal.app.IAppOpsService]
134     batterystats: [com.android.internal.app.IBatteryStats]
135     pps_server: [com.meizu.pps.IPPS]
136     media.sound_trigger_hw: [android.hardware.ISoundTriggerHwService]
137     media.radio: [android.hardware.IRadioService]
138     media.audio_policy: [android.media.IAudioPolicyService]
139     media.VTS: [android.hardware.IVTService]
140     gpu: [android.ui.IGpuService]
141     SurfaceFlinger: [android.ui.ISurfaceComposer]
142     drm.drmManager: [drm.IDrmManagerService]
143     meizu.camera: [meizu.camera.ICameraService]
144     GuiExtService: [GuiExtService]
145     batteryproperties: [android.os.IBatteryPropertiesRegistrar]
146     PQ: [PQService]
147     media.resource_manager: [android.media.IResourceManagerService]
148     media.player: [android.media.IMediaPlayerService]
149     AAL: [AALService]
150     media.extractor: [android.media.IMediaExtractorService]
151     media.drm: [android.media.IMediaDrmService]
152     media.audio_flinger: [android.media.IAudioFlinger]
153     android.security.keystore: [android.security.IKeystoreService]
154     android.vendor.meizu.IFacerecoDaemon: [android.vendor.meizu.IFacerecoDaemon]
155     android.service.gatekeeper.IGateKeeperService: [android.service.gatekeeper.IGateKeeperServic
e]
156     program_binary: []
157     hotknotnativeservice: []
158     android.hardware.fingerprint.IGoodixFingerprintDaemon: [android.hardware.fingerprint.IGoodix
FingerprintDaemon]
159     media.codec: [android.media.IMediaCodecService]
160     mtk.codecservice: []
161     android.hardware.fingerprint.IFingerprintDaemon: [android.hardware.fingerprint.IFingerprintD
aemon]
162     NvRAMAgent: [NvRAMAgent]

查询到运行的system service后,就可以在dumpsys后面加上service的名字,查看指定的service信息。

adb shell dumpsys activity

adb shell dumpsys cpuinfo

adb shell dumpsys battery

adb shell dumpsys window

有些service能够接收额外的参数,我们可以使用-h查看帮助信息。

adb shell dumpsys package -h
adb shell dumpsys activity -h

例如:dumpsys activity -p 包名 可以过滤一个包的信息

发布了96 篇原创文章 · 获赞 57 · 访问量 11万+

猜你喜欢

转载自blog.csdn.net/lyabc123456/article/details/84560782