Dalvik Debug Monitor Service is a tool that assists you in debugging your application. It uses Android Debug Bridge to connect to a device and help you debug applications running inside a Dalvik virtual machine. Using the Dalvik Debug Monitor Service, you can monitor thread and heap information, move files to and from the device or emulator, simulate incoming calls and SMS, send location information to simulate GPS information, and more. You can access some of these functionalities using the Android Debug Bridge, but Dalvik Debug Monitor Service provides a user interface and makes it easier to perform these tasks.
Start the Dalvik Debug Monitor Service by running the command ddms at the command prompt. Make sure you run the command from the tools folder of the Android SDK because it requires access to some libraries in the Android SDK folder. This launches the Dalvik Debug Monitor Service and displays the interface shown in Figure 11.19.
When you start the emulator, the Dalvik Debug Monitor Service displays information about the applications invoked and shows a details log file of log messages. You can select an application to view the threads executing and memory allocated for that application. For example, Figure 11.20 shows the threads executing for our sample application.
As can be seen in Figure 11.20, when your simple "Hello Android Geek" application is running, there are several concurrent threads executing. In the bottom frame you can see a list of them, denoted by their process IDs ("pid") and their name ("tag"). The topmost of them seen is the "dalvikvm" thread running garbage collection ("GC") so as to recover some memory from objects that are no longer needed.
Your program is the "Activity" thread and you can see a sequence of "activities" (surprise!) running where the program instantiates the objects that make up your application. Also seen are various "housekeeping" threads running such as the "jdwp" and "ARMAs..." threads doing their thing to keep the Android emulator running as you expect it to.
Suffice it to say that a sophisticated system such as Android runs many different threads of programming code that make the cell phone behave as we expect it to. There are always multiple background tasks running to do things like monitor your GPS position, keep memory clean and available, write pixels to the screen, etc.
Was this article helpful?