Android Debug Bridge (ADB) is a versatile command-line tool that lets you communicate with a device (an emulator or a connected Android device). The adb command facilitates a variety of device actions, such as installing and debugging apps, and it provides access to a UNIX shell that you can use to run a variety of commands on a device. It is a client-server program that includes three components:
- A client, which sends commands. The client runs on your development machine. You can invoke a client from a command-line terminal by issuing an adb command.
- A daemon (adbd), which runs commands on a device. The daemon runs as a background process on each device.
- A server, which manages communication between the client and the daemon. The server runs as a background process on your development machine.
Once the server has set up connections to all devices, you can use adb commands to access those devices. Because the server manages connections to devices and handles commands from multiple adb clients, you can control any device from any client (or from a script).
Logcat is a command-line tool that dumps a log of system messages, including stack traces when the device throws an error and messages that you have written from your app with the Log class.
CPU usage log- For multi threaded application, it would be extremely useful to tell what thread are running on each core. So each task in multi threaded application taking some CPU usage. Below are the steps to get the CPU usage log in running device.
STEP 1: Connect your device (mobile or tab) using a USB in your laptop or desktop’s USB port.
STEP 2: Make sure your device “Developer option” and “USB debugging” mode is on.
STEP 3: Now open a terminal window on your system which is already connected with the device. Locate the folder which contains ADB tool. In our case, we are using Linux and ADB is present in the location:
STEP 4: We now have to reach in this mentioned file location through our Linux terminal.
STEP 5: Now we have to use the adb shell command. The Android Debug Bridge (adb) provides a Unix shell that you can use to run a variety of commands on an emulator or connected device.
STEP 6: Now you can see your command has executed successfully after putting the correct system password. As we have used ‘sudo’ before the ‘adb shell’ command, Linux asks for user password.
STEP 7: Next you have to use “top” command. Top command display processor activity of your Linux box and also displays tasks managed by kernel in real-time. It’ll show processor and memory are being used and other information like running processes.
When you enter “top” command and press “Enter” key, you will see the log files or you can say CPU usage log files.
We can easily extract the entire log and save it in a text file. Usually, developers and mostly testers dig on this large text files and extract out information manually. We faced these kind of time consuming issues where we wanted to extract meaningful data immediately from large data piles. Then we decided to come up with a solution and developed the ADB Log Extractor. We basically provide a solution to extract data from these huge log files in Microsoft Excel spreadsheet. The Excel file also contains graphs on the basis of extracted data.
We have developed a simple application (executable jar) which accept these kind of huge text file and generate excel file and graph according to data extracted. The process is simple, described below:
Step 1: Open the application by double clicking on ‘Executer.bat’ file. It’ll open the app and it’s somehow look like below.
Step 2: User have to click on “Open File” button and locate the text (.txt or .log etc.) file which you want to extract data and generate excel sheet as well as graph.
Step 3: After successfully extracted the data from the text file you’ll get an indication that your file is generated in Excel format.
Step 4: Now you have to open the same file location from where you have picked up your text file. You will see there an Excel file is generated with the same name.
Now open the generated excel file. You will see your extracted data in rows and column format and graph plotted successfully based upon the extracted data.
If you are involved in same kind of project and working with ADB Log Data, you can use our tool. Just drop a mail to email@example.com, describe your project and ask for the tool. Hope it’ll help you also as it help us a lot.