이번에 안드로이드 앱 최적화를 위해 책을 한 권 구입했고 메모리 관련 참조를 하기 위해 저자가 adb 명령어를 활용하는 걸 봤다. (adb shell)
처음엔 단순히 안드로이드 스튜디오 터미널에서 adb를 사용할 수 있을거라 생각했는데 명령어를 인식하지 않았고
서치를 해서 맥 터미널에서 adb를 사용하는 방법을 찾았고, 나는 제시된 방법중에 안드로이드 스튜디오가 설치되어 있을때의 방법을 따랐다.
Option 3 - If you already have Android Studio installed
Add
platform-tools
to your pathecho 'export ANDROID_HOME=/Users/$USER/Library/Android/sdk' >> ~/.bash_profile echo 'export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools' >> ~/.bash_profile
Refresh your bash profile (or restart your terminal app)
source ~/.bash_profile
Start using adb
adb devices
아래는 위 과정을 모두 수행해준 뒤, 디바이스를 연결하고 터미널에서 adb 를 사용해 dumpsys meminfo라는 명령어를 수행해 준 결과이다.
수행되고 있는 프로세스와 각각 사용하고 있는 메모리 양, 기기의 총 램과 사용하고 있는 램, free 램 등을 표시해주고 있다.
Seongs-iMac:FootBalance seonghwanchoi$ adb shell
a3xeltekx:/ $
a3xeltekx:/ $ dumpsys meminfo
Applications Memory Usage (in Kilobytes):
Uptime: 212648676 Realtime: 419990496
Total PSS by process:
184,384K: system (pid 2671)
117,114K: com.android.systemui (pid 3067 / activities)
106,383K: com.google.android.gms.persistent (pid 12217)
91,600K: com.google.android.gms (pid 12241)
64,148K: com.sec.android.inputmethod (pid 10296)
57,643K: com.microsoft.skydrive (pid 3746)
50,214K: com.sec.android.app.launcher (pid 15670 / activities)
49,183K: com.kakaobank.channel (pid 1307 / activities)
39,193K: com.android.phone (pid 3428)
36,261K: com.google.android.apps.photos (pid 4120)
28,962K: com.samsung.android.MtpApplication (pid 3363 / activities)
28,613K: com.rsupport.mvagent (pid 20518)
26,025K: com.sec.imsservice (pid 3415)
25,306K: jp.naver.line.android (pid 20324)
23,311K: com.ktmusic.geniemusic:audio (pid 14445)
21,002K: com.instagram.android:mqtt (pid 13210)
17,979K: com.android.vending (pid 31751)
17,808K: com.kakao.talk (pid 1243)
14,796K: com.google.android.googlequicksearchbox:search (pid 30655)
14,589K: com.android.bluetooth (pid 3009)
12,877K: com.gsr.gs25 (pid 4095)
12,711K: com.ktcs.whowho (pid 29242)
12,478K: com.samsung.android.providers.context (pid 3801)
12,259K: android.process.acore (pid 3523)
11,984K: com.makeshop.podbbang (pid 15226)
11,559K: android.process.media (pid 3324)
11,182K: com.sec.spp.push:RemoteDlcProcess (pid 19843)
10,832K: cameraserver (pid 2303)
9,985K: perfd (pid 3580)
9,936K: com.sec.spp.push (pid 16231)
9,854K: mediaserver (pid 2316)
9,660K: surfaceflinger (pid 2224)
9,357K: com.hanabank.ebk.channel.android.hananbank (pid 31063)
9,262K: logd (pid 2125)
8,911K: com.samsung.android.calendar (pid 25672)
8,615K: rild (pid 2309)
8,598K: audioserver (pid 2298)
8,554K: com.android.nfc (pid 3402)
7,491K: com.rsupport.mvagent:widget (pid 19673)
7,412K: com.olleh.android.oc2 (pid 32222)
6,718K: com.google.process.gapps (pid 3710)
6,089K: com.samsung.android.communicationservice (pid 24422)
6,010K: com.hanafn.push.agent (pid 19771)
5,886K: com.google.android.googlequicksearchbox:interactor (pid 739)
5,863K: com.android.settings:QuickSettingsTile (pid 3240)
5,699K: com.samsung.android.scloud:autobackupmgr (pid 29805)
5,364K: com.samsung.android.scloud (pid 26743)
5,082K: media.extractor (pid 2315)
5,014K: media.codec (pid 2313)
4,958K: com.google.android.ext.services (pid 3616)
4,716K: com.samsung.android.smartface (pid 4065)
4,185K: com.ims.dm (pid 29583)
3,817K: com.android.printspooler (pid 4013)
3,588K: com.sec.sve (pid 3381)
3,385K: com.sec.phone (pid 3606)
3,379K: imsd (pid 2291)
3,346K: zygote (pid 2272)
3,291K: mediadrmserver (pid 2314)
3,213K: com.samsung.android.SettingsReceiver (pid 3975)
2,906K: gpsd (pid 2292)
2,534K: netd (pid 2317)
2,445K: /init (pid 1)
2,416K: vold (pid 2151)
1,703K: mcDriverDaemon (pid 2150)
1,700K: wpa_supplicant (pid 24718)
1,682K: adbd (pid 2273)
1,596K: installd (pid 2311)
1,566K: ueventd (pid 1449)
1,533K: drmserver (pid 2285)
1,137K: jackservice (pid 2288)
960K: sdp_cryptod (pid 2297)
959K: lmkd (pid 2222)
843K: keystore (pid 2312)
815K: smdexe (pid 2310)
799K: at_distributor (pid 2326)
787K: connfwexe (pid 2308)
748K: dumpsys (pid 4201)
744K: tlc_server (pid 2844)
723K: gatekeeperd (pid 2325)
596K: androidshmservice (pid 2337)
582K: apaservice (pid 2287)
572K: logcat (pid 3553)
542K: auditd (pid 2277)
539K: servicemanager (pid 2223)
527K: sh (pid 4196)
516K: ss_conn_daemon (pid 2283)
499K: sh (pid 3578)
497K: diagexe (pid 2293)
488K: otp_server (pid 2869)
465K: edmaudit (pid 2284)
460K: cbd (pid 2294)
433K: ddexe (pid 2307)
432K: healthd (pid 2219)
352K: sdcard (pid 3515)
348K: sdcard (pid 3025)
338K: iod (pid 3635)
332K: cs (pid 2226)
294K: debuggerd (pid 2149)
294K: debuggerd:signaller (pid 2160)
210K: watchdogd (pid 2225)
208K: argosd (pid 2290)
Total PSS by OOM adjustment:
125,038K: Native
10,832K: cameraserver (pid 2303)
9,985K: perfd (pid 3580)
9,854K: mediaserver (pid 2316)
9,660K: surfaceflinger (pid 2224)
9,262K: logd (pid 2125)
8,615K: rild (pid 2309)
8,598K: audioserver (pid 2298)
5,082K: media.extractor (pid 2315)
5,014K: media.codec (pid 2313)
3,379K: imsd (pid 2291)
3,346K: zygote (pid 2272)
3,291K: mediadrmserver (pid 2314)
2,906K: gpsd (pid 2292)
2,534K: netd (pid 2317)
2,445K: /init (pid 1)
2,416K: vold (pid 2151)
1,703K: mcDriverDaemon (pid 2150)
1,700K: wpa_supplicant (pid 24718)
1,682K: adbd (pid 2273)
1,596K: installd (pid 2311)
1,566K: ueventd (pid 1449)
1,533K: drmserver (pid 2285)
1,137K: jackservice (pid 2288)
960K: sdp_cryptod (pid 2297)
959K: lmkd (pid 2222)
843K: keystore (pid 2312)
815K: smdexe (pid 2310)
799K: at_distributor (pid 2326)
787K: connfwexe (pid 2308)
748K: dumpsys (pid 4201)
744K: tlc_server (pid 2844)
723K: gatekeeperd (pid 2325)
596K: androidshmservice (pid 2337)
582K: apaservice (pid 2287)
572K: logcat (pid 3553)
542K: auditd (pid 2277)
539K: servicemanager (pid 2223)
527K: sh (pid 4196)
516K: ss_conn_daemon (pid 2283)
499K: sh (pid 3578)
497K: diagexe (pid 2293)
488K: otp_server (pid 2869)
465K: edmaudit (pid 2284)
460K: cbd (pid 2294)
433K: ddexe (pid 2307)
432K: healthd (pid 2219)
352K: sdcard (pid 3515)
348K: sdcard (pid 3025)
338K: iod (pid 3635)
332K: cs (pid 2226)
294K: debuggerd (pid 2149)
294K: debuggerd:signaller (pid 2160)
210K: watchdogd (pid 2225)
208K: argosd (pid 2290)
184,384K: System
184,384K: system (pid 2671)
206,952K: Persistent
117,114K: com.android.systemui (pid 3067 / activities)
39,193K: com.android.phone (pid 3428)
26,025K: com.sec.imsservice (pid 3415)
12,478K: com.samsung.android.providers.context (pid 3801)
8,554K: com.android.nfc (pid 3402)
3,588K: com.sec.sve (pid 3381)
14,589K: Persistent Service
14,589K: com.android.bluetooth (pid 3009)
373,051K: Visible
106,383K: com.google.android.gms.persistent (pid 12217)
91,600K: com.google.android.gms (pid 12241)
64,148K: com.sec.android.inputmethod (pid 10296)
50,214K: com.sec.android.app.launcher (pid 15670 / activities)
23,311K: com.ktmusic.geniemusic:audio (pid 14445)
11,984K: com.makeshop.podbbang (pid 15226)
11,182K: com.sec.spp.push:RemoteDlcProcess (pid 19843)
5,886K: com.google.android.googlequicksearchbox:interactor (pid 739)
4,958K: com.google.android.ext.services (pid 3616)
3,385K: com.sec.phone (pid 3606)
28,962K: Perceptible
28,962K: com.samsung.android.MtpApplication (pid 3363 / activities)
109,038K: A Services
28,613K: com.rsupport.mvagent (pid 20518)
17,979K: com.android.vending (pid 31751)
17,808K: com.kakao.talk (pid 1243)
12,877K: com.gsr.gs25 (pid 4095)
12,711K: com.ktcs.whowho (pid 29242)
11,559K: android.process.media (pid 3324)
7,491K: com.rsupport.mvagent:widget (pid 19673)
49,183K: Previous
49,183K: com.kakaobank.channel (pid 1307 / activities)
186,426K: B Services
57,643K: com.microsoft.skydrive (pid 3746)
25,306K: jp.naver.line.android (pid 20324)
21,002K: com.instagram.android:mqtt (pid 13210)
14,796K: com.google.android.googlequicksearchbox:search (pid 30655)
9,936K: com.sec.spp.push (pid 16231)
9,357K: com.hanabank.ebk.channel.android.hananbank (pid 31063)
8,911K: com.samsung.android.calendar (pid 25672)
7,412K: com.olleh.android.oc2 (pid 32222)
6,089K: com.samsung.android.communicationservice (pid 24422)
6,010K: com.hanafn.push.agent (pid 19771)
5,699K: com.samsung.android.scloud:autobackupmgr (pid 29805)
5,364K: com.samsung.android.scloud (pid 26743)
4,716K: com.samsung.android.smartface (pid 4065)
4,185K: com.ims.dm (pid 29583)
68,131K: Cached
36,261K: com.google.android.apps.photos (pid 4120)
12,259K: android.process.acore (pid 3523)
6,718K: com.google.process.gapps (pid 3710)
5,863K: com.android.settings:QuickSettingsTile (pid 3240)
3,817K: com.android.printspooler (pid 4013)
3,213K: com.samsung.android.SettingsReceiver (pid 3975)
Total PSS by category:
170,338K: Dalvik
146,690K: Native
48,973K: .dex mmap
45,588K: EGL mtrack
43,319K: Dalvik Other
42,158K: GL mtrack
38,941K: .so mmap
33,350K: .art mmap
28,888K: .oat mmap
27,424K: Other mmap
23,033K: Unknown
14,542K: .apk mmap
9,596K: Stack
1,009K: Other dev
508K: .ttf mmap
216K: Ashmem
4K: Cursor
0K: Gfx dev
0K: .jar mmap
0K: Other mtrack
Total RAM: 1,407,728K (status moderate)
Free RAM: 209,725K ( 66,141K cached pss + 116,168K cached kernel + 27,416K free)
Used RAM: 935,512K ( 685,048K used pss + 250,464K kernel)
Lost RAM: 262,491K
Tuning: 128 (large 512), oom 122,880K, restore limit 40,960K (high-end-gfx)
참조 :
https://stackoverflow.com/questions/17901692/set-up-adb-on-mac-os-x/19142768
'ANDROID' 카테고리의 다른 글
[안드로이드] 아이콘 스왑 애니메이션을 만들고 싶을 때, 두 개의 핸들러를 둘 것. (0) | 2018.03.23 |
---|---|
[안드로이드] 특정 이미지뷰의 위치로 아이콘을 움직이자 (0) | 2018.03.07 |
[안드로이드] 남는 모든 액티비티를 종료하고 앱 재시작시 깔끔하게 시작하기 (2) | 2018.02.19 |
[안드로이드] OPENGL ES 뷰를 비트맵으로 저장해 이미지뷰에 출력하기 (0) | 2018.02.19 |
[안드로이드] 뷰 위에 들어오는 모든 터치 이벤트를 막기 (0) | 2018.02.02 |