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
Get the latest updates in the ChkBugReport forum thread on XDA forum.
Download ChkBugReport source code from GitHub.
Read more in the ChkBugReport wiki pages at GitHub.
Have a look in the installation guide to get started using ChkBugReport.
Go directly to the Code/Downloads section to get started right away.
Learn more about Garbage Collection.
Read about the FTRACE functionality.
Get GtkWave viewer.
Check out our other open developer community blog posts.
No comments: