logcat的统计功能能满足需求
logcat -S
统计所有进程的log
输入 logcat -S 统计所有进程的log
size/num main system crash kernel Total Total 2034334/19815 433784/4555 0/0 14287744/116156 16755862/140526 Now 1094585/8253 22963/212 13969386/111773 15086934/120238 Logspan 14:40:42.561 14:39:47.603 14:44:55.518 14:44:55.518 Overhead 1556753 34835 20228674 21946488 Chattiest UIDs in main log buffer: Size +/- Pruned UID PACKAGE BYTES NUM 1047 cameraserver 316414 +15% 9 1000 system 174163 -38% 1472 PID/UID COMMAND LINE " " 647/1000 /vendor/bin/jnneserver 63950 1361 1111/1000 system_server 61950 111 392/1000 ...android.hardware.graphics.composer@2.1-service 9625 4809/1000 /apex/com.android.art/bin/dex2oat64 3379 3507/1000 /apex/com.android.art/bin/dex2oat64 3182 4458/1000 /apex/com.android.art/bin/dex2oat64 3170 4578/1000 /apex/com.android.art/bin/dex2oat64 3091 4269/1000 /apex/com.android.art/bin/dex2oat64 3091 4710/1000 /apex/com.android.art/bin/dex2oat64 3082 4414/1000 /apex/com.android.art/bin/dex2oat64 3079 4324/1000 /apex/com.android.art/bin/dex2oat64 3079 3767/1000 /apex/com.android.art/bin/dex2oat64 3077 4245/1000 /apex/com.android.art/bin/dex2oat64 3070 4512/1000 /apex/com.android.art/bin/dex2oat64 3036 1001 radio 105931 +14% 4 10128 org.codeaurora.ims 59824 +5.8% 45 0 root 31432 +12% 10075 org.codeaurora.snapcam 30206 +13% 3 10131 com.qti.ltebc 25591 +15% 1041 audioserver 20396 +13% 6 1073 network_stack 17748 +14% 4 50073 com.android.providers.media 15008 +18% 50076 com.android.calllogbackup 12227 +22% 1021 gps 9750 +14% 50106 vendor.qti.hardware.cacert.server 9204 +14% 10135 com.android.systemui 5621 +25% 4 50115 com.android.webview 4478 +33% 10149 com.android.providers.media.module 3789 50145 com.qualcomm.embms 3625 +50% 50150 com.android.cellbroadcastreceiver.module 3619 +50% 50113 com.android.quicksearchbox 3540 +50% 50119 com.android.deskclock 3513 +50% 50111 com.android.dialer 3511 +50% 50128 org.codeaurora.ims 3445 +50% 50130 com.qualcomm.location 3426 +50% 50134 org.codeaurora.dialer 3426 +50% 50118 com.android.inputmethod.latin 3413 +50% 50142 com.qualcomm.qti.ims 3351 +50% 2000 shell 3336 +50% 50126 com.android.gallery3d 3306 +50% 50151 com.android.permissioncontroller 3279 50140 com.qualcomm.qct.dlt 3258 50109 com.android.settings.intelligence 3256 50136 com.qualcomm.atfwd 3249 Chattiest UIDs in system log buffer: Size +/- Pruned UID PACKAGE BYTES NUM 1000 system 21960 6 0 root 753 +3.2% 10073 com.android.providers.media 250 Chattiest PIDs: Size Pruned PID/UID COMMAND LINE BYTES NUM 1726/1001 com.android.phone 1010120 6 384/1047 ...roid.hardware.camera.provider@2.4-service_64 314600 5 1111/1000 system_server 171663 117 647/1000 /vendor/bin/jnneserver 63950 1361 1674/10128 org.codeaurora.ims 59824 45 3210/1001 /vendor/bin/embmsslServer 39237 3237/10075 org.codeaurora.snapcam 31142 3 3178/10131 com.qti.ltebc 21333 605/0 /system/bin/installd 21324 382/1041 /vendor/bin/hw/android.hardware.audio.service 16077 Chattiest TIDs: Size Pruned TID/UID COMM BYTES NUM 1726/1001 com.android.phone 687232 2 1869/1001 HwBinder:1726_1 268055 384/1047 android.hardwar 69929 4 676/1000 ai.IJnneService 63950 1361 1674/10128 org.codeaurora.ims 59368 45 3447/1000 BackgroundDexOp 49342 1175/1000 android.bg 44632 1092/1047 provider@2.4-se 29424 1088/1047 provider@2.4-se 22190 1090/1047 provider@2.4-se 21942 1 1989/1001 NetworkService 21192 3202/10131 LTEBCInitManage 18234 1091/1047 provider@2.4-se 17828 3366/1047 provider@2.4-se 16606 1096/1047 HwBinder:384_2 14343 3220/1001 /vendor/bin/embmsslServer 14245 1089/1047 provider@2.4-se 14170 1093/1047 provider@2.4-se 13375 3221/1001 /vendor/bin/embmsslServer 13261 3378/1047 provider@2.4-se 12846 2167/1041 writer 11688 1177/1000 ActivityManager 10458 3237/10075 org.codeaurora.snapcam 10036 2 435/1000 composer@2.1-se 9625 1992/1001 Binder:1726_8 9512 405/0 vendor.jlq.hard 7876 1095/1047 HwBinder:384_1 7467 3284/10075 CameraBackgroun 7165 1993/1001 Binder:1726_9 7150 Chattiest TAGs: Size TID/PID/UID LOG_TAG NAME BYTES dex2oat64 388684 1726/1001 RILJ 289613 384/1047 CamX 210816 1726/1001 LocaleTracker-0 210192 1726/1001 SST 99495 1726/1001 NewNitzStateMachineImpl 94432 384/1047 CHIUSECASE 79616 676/647/1000 jnne 63950 1674/10128 QtiCarrierConfigHelper 58960 1726/1001 LocaleTracker-1 55409 1726/1001 ImsPhone 38745 mfosal 38363 3447/1111/1000 PackageDexOptimizer 38198 1175/1111/1000 am_pss 37255 auditd 25706 1726/1001 DefaultPhoneNotifier 22914 1726/1001 EmergencyNumberTracker 21468 605/0 installd 21324 1726/1001 QtiDCT-C 19254 1726/1001 NRM-C-0 16675 1726/1001 IccSmsInterfaceManager 14975 384/1047 CHIGPU 12870 1869/1726/1001 RilRequest 12094 1111/1000 system_server 11141 435/392/1000 malicomposer 9625 1726/1001 SubscriptionController 9554 382/1041 jr510_platform 9305 /10131 LTE Application 9142 405/0 PerfControl 8940 dvm_lock_sample 8450 1177/1111/1000 am_proc_start 8018 1726/1001 GsmCdmaPhone 6606
统计指定进程的log
比如统计camera provider进程(384)的log
logcat -S --pid=384
输出:
size/num main system crash kernel Total Total 2034434/19817 433784/4555 0/0 14293774/116205 16761992/140577 Now 1094585/8253 22963/212 13975416/111822 15092964/120287 Logspan 14:40:42.561 14:39:47.603 14:45:21.887 14:45:21.887 Overhead 1556753 34835 20237448 21955262 Logging for this PID: Size Pruned PID/UID COMMAND LINE BYTES NUM 384/1047 ...roid.hardware.camera.provider@2.4-service_64 314600 5 Chattiest TIDs for PID 384: Size Pruned TID/UID COMM BYTES NUM 384/1047 android.hardwar 69929 4 1092/1047 provider@2.4-se 29424 1088/1047 provider@2.4-se 22190 1090/1047 provider@2.4-se 21942 1 1091/1047 provider@2.4-se 17828 3366/1047 provider@2.4-se 16606 1096/1047 HwBinder:384_2 14343 1089/1047 provider@2.4-se 14170 1093/1047 provider@2.4-se 13375 3378/1047 provider@2.4-se 12846 1095/1047 HwBinder:384_1 7467 3348/1047 provider@2.4-se 6745 3352/1047 provider@2.4-se 6437 3351/1047 provider@2.4-se 6339 3377/1047 provider@2.4-se 5615 3349/1047 provider@2.4-se 5446 3376/1047 cameraserver 5444 3381/1047 cameraserver 5229 3354/1047 provider@2.4-se 4833 3379/1047 cameraserver 3696 3367/1047 provider@2.4-se 3648 3388/1047 HwBinder:384_3 3537 3329/1047 provider@2.4-se 2944 3350/1047 provider@2.4-se 2710 3347/1047 provider@2.4-se 2342 3380/1047 provider@2.4-se 2198 3334/1047 provider@2.4-se 831 3371/1047 provider@2.4-se 715 3370/1047 provider@2.4-se 715 Chattiest TAGs for PID 384: Size TID/PID/UID LOG_TAG NAME BYTES 384/1047 CamX 210816 384/1047 CHIUSECASE 79616 384/1047 CHIGPU 12870