Android系统中有哪些日志信息和工具

Android系统日志和工具

我们经常需要查看设备里面的各种日志信息。所以有必要了解android系统里面有哪些日志,以及用什么方式可以提取这些日志。以我手头的红米note4xplus为例,其基本配置为高通msm8953,android7.0。我们可以看一下根文件系统:

mido:/ # ls
acct              init.carrier.rc                      init.qcom.sh               root
bin               init.class_main.sh                   init.qcom.syspart_fixup.sh sbin
bt_firmware       init.environ.rc                      init.qcom.usb.rc           sdcard
cache             init.mdm.sh                          init.qcom.usb.sh           seapp_contexts
charger           init.miui.cust.rc                    init.rc                    selinux_version
config            init.miui.early_boot.sh              init.recovery.hardware.rc  sepolicy
cust              init.miui.google_revenue_share.rc    init.target.rc             service_contexts
d                 init.miui.google_revenue_share_v2.rc init.usb.configfs.rc       storage
data              init.miui.nativedebug.rc             init.usb.rc                sys
default.prop      init.miui.post_boot.sh               init.zygote32.rc           system
dev               init.miui.rc                         init.zygote64_32.rc        tombstones
dsp               init.msm.usb.configfs.rc             mnt                        ueventd.qcom.rc
etc               init.qcom.class_core.sh              oem                        ueventd.rc
file_contexts.bin init.qcom.early_boot.sh              persist                    unlock_key
firmware          init.qcom.factory.rc                 proc                       vendor
fstab.qcom        init.qcom.rc                         property_contexts          verity_key
init              init.qcom.sensors.sh                 res

以这个设备的文件系统为基础,我们来看一下一般的android设备中都有那些系统日志。

本文档只做日志相关的概要说明,不具体说明每个工具的使用方法。

android设备默认的命令一般都在/system/bin, /system/xbin和/sbin目录下。我们选择几个常用的命令来做个说明。

atrace

实际上就是systrace的代理。用来抓取用户空间服务日志信息。

一般用法:

adb shell atrace sched freq idle gfx view sync -b 96000 -f atrace.log

命令帮助:

adb shell atrace --help
usage: atrace [options] [categories...]
options include:
  -a appname      enable app-level tracing for a comma separated list of cmdlines
  -b N            use a trace buffer size of N KB
  -c              trace into a circular buffer
  -f filename     use the categories written in a file as space-separated
                    values in a line
  -k fname,...    trace the listed kernel functions
  -n              ignore signals
  -s N            sleep for N seconds before tracing [default 0]
  -t N            trace for N seconds [defualt 5]
  -z              compress the trace dump
  --async_start   start circular trace and return immediatly
  --async_dump    dump the current contents of circular trace buffer
  --async_stop    stop tracing and dump the current contents of circular
                    trace buffer
  --stream        stream trace to stdout as it enters the trace buffer
                    Note: this can take significant CPU time, and is best
                    used for measuring things that are not affected by
                    CPU performance, like pagecache usage.

  --list_categories
                  list the available tracing categories
 -o filename      write the trace to the specified file instead
                    of stdout.

所有的业务类型列表:

adb shell atrace --list_categories
         gfx - Graphics
       input - Input
        view - View System
     webview - WebView
          wm - Window Manager
          am - Activity Manager
          sm - Sync Manager
       audio - Audio
       video - Video
      camera - Camera
         hal - Hardware Modules
         app - Application
         res - Resource Loading
      dalvik - Dalvik VM
          rs - RenderScript
      bionic - Bionic C Library
       power - Power Management
          pm - Package Manager
          ss - System Server
    database - Database
       sched - CPU Scheduling
         irq - IRQ Events
        freq - CPU Frequency
        idle - CPU Idle
        disk - Disk I/O
         mmc - eMMC commands
        load - CPU Load
        sync - Synchronization
       workq - Kernel Workqueues
  memreclaim - Kernel Memory Reclaim
  regulators - Voltage and Current Regulators
  binder_driver - Binder Kernel driver
  binder_lock - Binder global lock trace
   pagecache - Page cache

bootstat

查看设备启动状态信息。

`
adb shell bootstat -p
Boot events:

Original: https://www.cnblogs.com/aosp/p/16411738.html
Author: 河东西望
Title: Android系统中有哪些日志信息和工具

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/582222/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

  • 防止shell script多次运行

    防止shell script多次运行 一个思路是在script初期检测系统中是否存在同名进程。 if [ ps -ef | grep "test.sh" | g…

    Linux 2023年5月28日
    076
  • exec

    exec 函数 exec()函数通过运行其他程序来替换当前进程。 新程序启动后PID和老程序一样,就像两个程序接力跑,你的程序把进程交接给了新程序。 exec函数众多,可以分为两种…

    Linux 2023年6月7日
    094
  • 实验一-密码引擎-商用密码算法实现1

    任务详情 参考https://weread.qq.com/web/reader/2fb3259071ef04932fbfd2ekc81322c012c81e728d9d180和网上…

    Linux 2023年6月8日
    0115
  • redis开启远程访问

    redis默认只允许本地访问,要使redis可以远程访问可以修改redis.conf 打开redis.conf文件在 NETWORK部分有说明 By default, if no …

    Linux 2023年5月28日
    0146
  • JavaScript快速入门-08-JSON

    8 JSON 因平时工作时,使用JSON的场景比较多,其JSON语法不再介绍,仅介绍在JavaScript中JSON的解析和序列化。 8.1 JSON 对象 JSON对象有两个方法…

    Linux 2023年6月7日
    098
  • 软件工程 软件测试 第6篇随笔

    5、软件测试 1.软件测试的目的: 测试是一个为了发现错误而执行程序的过程 一个好的测试用例是指很可能找到迄今为止尚未发现的错误的测试用例 一个成功的测试是指揭示了迄今为止尚未发现…

    Linux 2023年6月7日
    0112
  • phpcms v9全站点击量排行代码

    前台: {pc:content action=”sitehits” siteid=”1″ num=”10″ …

    Linux 2023年6月13日
    068
  • 关于面试的那些事

    这周做了三次的笔试,周日的XXX,周三的XXX,周五的XXX。 首先周日的XXX,考了四道算法题,两个小时,说实话题目都没怎么读懂,算法基本没接触过,结果一道也没有做出来,只想说,…

    Linux 2023年6月7日
    0109
  • 汉诺塔

    设计并实现一个游戏:汉诺塔。完成这个实验,涉及C++面向对象编程以及基本的数据结构知识(如栈和队列)但具此次实现并没有使用STL库。 1. 汉诺塔问题 汉诺塔是一个著名的数学问题。…

    Linux 2023年6月13日
    088
  • 代码审计-PHP反序列化漏洞

    什么是序列化 序列化可以实现将对象压缩并格式化,方便数据的传输和存储。为什么要序列化?PHP 文件在执行结束时会把对象销毁,如果下次要引用这个对象的话就很麻烦,所以就有了对象序列化…

    Linux 2023年6月6日
    0113
  • Golang 实现 Redis(8): TCC分布式事务

    本文是使用 golang 实现 redis 系列的第八篇, 将介绍如何在分布式缓存中使用 Try-Commit-Catch 方式来解决分布式一致性问题。 在上一篇文章中我们使用一致…

    Linux 2023年5月28日
    080
  • 总结:弹性伸缩的五个条件与六个教训

    前言弹性伸缩是云计算时代给我们带来的一项核心技术红利,但是 IT 的世界中,没有一个系统功能可以不假思索的应用到所有的场景中。这篇文章,我们将应用企业级分布式应用服务-EDAS 的…

    Linux 2023年6月8日
    094
  • linux版的查毒工具 ClamAv 安装脚本

    /bin/bash 安装linux版的查毒工具 clamav 用root执行 保证服务器能访问外网 yum源最好是最新的 创建用户和组 groupadd clamavuseradd…

    Linux 2023年6月13日
    097
  • angular typescript 引入js文件

    第一步,将js文件放在应该放的位置,我是自己随便建了个js测试一下。 第二步,在angular.json里引入js。 第三步,在要使用的地方声明,然后就可以使用。 注意点:angu…

    Linux 2023年6月7日
    076
  • 如何使用 etcd 实现分布式 /etc 目录

    etcd 是一款兼具一致性和高可用性的键值数据库,简单、安全、快速、可信,目前是 Kubernetes 的首要数据存储。我们先来看一段 etcd 官方对于名字的解释。 The na…

    Linux 2023年6月14日
    0118
  • shell之常用的一些命令2

    前言 自我感觉学习shell要常用man,–help这样挺方便去写的,光靠熟练远远不够的 bash;gutter:false;</p> <h1>!/bin…

    Linux 2023年6月8日
    071
亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球