ChkBugReport_featured-New

New bugreport analysis tool released as open source

Android™ developers, do you frequently get Application Not Responding (ANR) messages and application crashes? Are you unsure what to do with the massive data collected from Android’s bugreport tool? We talked to Pál Szász, a software developer at Sony Ericsson, to learn about ChkBugReport, a new tool that helps you analyse your crash files. Because this tool is such a great help for our developers at Sony Ericsson, and as a part of our ambition to step up our open source activities, we want to give all of you the chance to use it by making it open source. Read more after the jump.

Pál Szász, Software developer at Sony Ericsson.

My name is Pál Szász and I’ve been a software developer at Sony Ericsson since 2006. For several years, I worked on software maintenance, and most of the time was spent on fixing bugs. When hunting down an error, any information we could get was potentially useful. Therefore, we started to look at the output of the “bugreport” tool, which is a huge, chaotic, text file.

To find the information we wanted in an easier way, we created a new analysis tool, ChkBugReport, which helps you parse the very condensed information into something much more readable. After using it within Sony Ericsson with good results, we now want to share this tool with all you Android developers out there. You can find the latest information in the ChkBugReport forum thread on the XDA Forum, which I will also follow to answer questions and pick up suggestions.

Get started right away
The ChkBugReport source code, and all the information on how to use it, is published at GitHub. To start using the tool, just download the file chkbugreport.jar from the Code/Downloads section, and put it somewhere on your computer.  You can find more information in the installation guide. Since it is published as open source, it is free for you to use and develop even further. Apart from sharing our knowledge, our goal is to work closer with you external developers. In this specific case, we want to convert this tool into the ultimate “Swiss army knife of bug-hunting”. We are happy to respond to any questions, feedback or contribution suggestions, which can be posted in the ChkBugReport forum thread on the XDA Forum.

It’s quite easy to use the tool:

  • Create a bugreport (for example when you receive an ANR message) by executing
    adb shell bugreport > bugreport.txt
    
  • Execute ChkBugReport:
    java –jar chkbugreport.jar bugreport.txt
    
  • Open the “bugreport_out/index.html” in a browser.

Get to know the output of ChkBugReport
The bugreport file contains several sections, each of them being a copy of a file (for example /data/system/packages.xml), the output of an application (for example “top”) or the dump of a service (for example the dump of the window manager service).

ChkBugReport parses the file and as a first step it splits it in smaller files, one per section, so users can easily find the section they want to analyse. These sections will be saved in “bugreport_out/raw”, in case the user needs it.

As a second step, it executes a set of built-in plugins, which processes one or several of these sections. The output of the plugins is saved as separate chapters in the report, and together with the table-of-contents, is saved as a set of HTML files. By simply opening the “index.html” file in a browser, you can start analysing the content of the bugreport:

A screenshot from the main view of the ChkBugReport tool.

The plugins can also detect some errors; for example, the system log analyser plugin will find the ANR report in the log. These errors are sorted by priority and are collected in a special chapter, called “Errors”, so that you can easily find them.

Also, each plugin can contribute snippets of information about each process in a common chapter, called “Processes”. This way, you can find all the information related to a certain process in one place (memory usage, system log and so on).

Currently, ChkBugReport has the following plugins implemented:

  • BatteryInfoPlugin – extracts the battery usage information and draws a nice chart showing the draining speed.
  • CpuFreqPlugin – shows which CPU frequencies are supported, and how much time they were used.
  • SystemLogPlugin, MainLogPlugin and EventLogPlugin – these plugins parses the various logs and extract the following information:
    • Memory usage from GC (Garbage Collection) logs.
    • Database and ContentProvider access time statistics.
    • Process and service lifecycle charts.
    • Crashes and ANRs.
    • Configuration changes (for example, screen rotations).
    • Activity start-ups.
  • FTracePlugin – if the FTRACE functionality is enabled in the kernel, the context switch tracer is selected, and the Android bugreport tool supports saving the trace buffer, this plugin will analyse the trace and create statistics and overview charts. For example, it will show which thread was running and how long it was waiting. It will also save the information in VCD format, so that you can analyse the trace with GtkWave.
  • MemPlugin – extracts the memory usage from various sources (for example, the dump of the meminfo service, or the output of librank and procrank).
  • StackTracePlugin – analyses the stack traces and can even detect some programming errors (for example, when a network connection is trying to be created in a main thread).
  • SurfaceFlingerPlugin – visualises the position and size of the layers (and their visible area) from the dump of the SurfaceFlinger service.
  • WindowManagerPlugin – reconstructs the window list.

This is an example of the functionality available in ChkBugReport, and as you can see, this tool extracts a lot of valuable information from the bugreports. We will add new information on GitHub continuously, where one by one all the functionality will be explained. We will also post updates in the ChkBugReport forum thread on the XDA forum. We are also happy for any questions or comments posted there.

Feel free to start using ChkBugReport today, we hope it will make life a lot easier helping out with your bugreport analysis. However, since this is now open source, we would be really happy if you would work together with us to improve this tool, so feel free to give us any ideas, suggestions or contributions, either in the comments of this blogpost or in the ChkBugReport forum thread on XDA forum.

More information

Comments 7

Sort by: Newest | Oldest | Most popular

  1. By Vijayakumar Badiger

    #1

    Hello ,

    I am trying to install chkbugreport-0.4-185.jar. I am facing the below error. Please help me to fix it.
    In linux12.04 Ubuntu verison.

    fcxt34@a5361c-02:~/Downloads$ java -jar chkbugreport-0.4-185.jar java.lang.ClassNotFoundException: com.apple.eawt.Application
    at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:188)
    at com.sonyericsson.chkbugreport.Main.changeDocIcon(Main.java:112)
    at com.sonyericsson.chkbugreport.Main.(Main.java:96)
    at com.sonyericsson.chkbugreport.Main.main(Main.java:593)
    Failed to register extension ‘com.sonyericsson.chkbugreport.AdbExtension’ due to: java.lang.NoClassDefFoundError: com/android/ddmlib/IShellOutputReceiver
    ChkBugReport 0.4 (rev 185) (C) 2012 Sony Ericsson Mobile Communications AB
    Usage: chkbugreport bugreportfile
    or
    Usage: chkbugreport -t traceviewfile
    or
    Usage: chkbugreport [sections] dummybugreportfile
    Where dummybugreportfile does not exists, but will be used to generate
    a folder name and sections must contain at least one of the following:
    -ds:file – Use file as dumsys output (almost same as -pb)
    -el:file – Use file as event log
    -ft:file – Use file as ftrace dump
    -ml:file – Use file as main log
    -mo:file – Parse monkey output and extract stacktraces from it
    -pb:file – Load partial bugreport (eg. output of dumpsys)
    -pk:file – Load packages.xml file
    -ps:file – Use file as “processes” section
    -pt:file – Use file as “processes and threads” section
    -sa:file – Use file as “vm traces at last anr” section
    -sl:file – Use file as system log
    -sn:file – Use file as “vm traces just now” section
    -sd:dir – Load files from directory as partial bugreports
    -uh:file – Load usage-history.xml file
    Extra options:
    –browser – Launch the browser when done
    –gmt:offs – Set the GMT offset (needed to map UTC times to log times)
    –gui – Launch the Graphical User Interface if no file name is provided
    –silent – Supress all output except fatal errors
    –limit – Limit the input file size
    If using the -sl option for example, the log file will
    be truncated if it’s too long (since the generated html
    would be even bigger). This option (and –no-limit as well)
    must precede the other options in order to have effect.
    –no-limit – Don’t limit the input file size (default)

  2. Pingback #2

    ?????…

    When I initially left a comment I visited the -Notify me while new comments are added – checkbox now when a comment is added I receive six messages with the similar comment. Will there be any way you could clear away me from that service? Thanks!…

  3. By davie white

    #3

    hi,this tool is cool,but i had some problems when i use this tool to analysis monkey log:

    Failed to register extension ‘AdbExtension’ due to: java.lang.NoClassDefFoundError: com/android/ddmlib/IShellOutputReceiver
    ChkBugReport 0.4 (rev 164) (C) 2012 Sony Ericsson Mobile Communications AB
    Exception in thread “main” java.lang.NullPointerException
    at java.io.FileInputStream.(Unknown Source)
    at java.io.FileInputStream.(Unknown Source)
    at com.sonyericsson.chkbugreport.Main.parseMonkey(Main.java:365)
    at com.sonyericsson.chkbugreport.Main.run(Main.java:167)
    at com.sonyericsson.chkbugreport.Main.main(Main.java:112)

    could you tell me how can i use this tool to analysis monkey log ? ths

  4. Pingback #4

    … [Trackback]…

    […] Informations on that Topic: developer.sonymobile.com/wp/2012/01/25/new-bugreport-analysis-tool-released-as-open-source/ […]…

  5. Pingback #5

    … [Trackback]…

    […] There you will find 63250 more Infos: developer.sonymobile.com/wp/2012/01/25/new-bugreport-analysis-tool-released-as-open-source/ […]…

  6. Pingback #6

    … [Trackback]…

    […] Read More: developer.sonymobile.com/wp/2012/01/25/new-bugreport-analysis-tool-released-as-open-source/ […]…

  7. Pingback #7

    … [Trackback]…

    […] Find More Informations here: developer.sonymobile.com/wp/2012/01/25/new-bugreport-analysis-tool-released-as-open-source/ […]…

1-7 of 7 comments.