Network analysis tools for Android


Download

Application Download(s) Version Last Updated
SpeedTest server source, Windows binary 1.1 (changelog) July 1, 2011
SpeedTest .apk 1.2 (changelog) May 9, 2011
SpeedTest Visualization source, Windows binary 1.1 (changelog) June 3, 2011
NetStatsLib Android Library
(documentation)
Android library project 1.3 (changelog) July 1, 2011
NetStatsLib Android Example
NetStatsLib Example project
NetStatsLibExample.apk
1.1 (changelog) July 1, 2011
TrafficStats .apk 1.3 (changelog) June 24, 2011

Installation

You can install the Android apps by visiting this page in your device's browser and clicking the following links.

The app will be downloaded to your device. When it is finished, click on the completed download to begin installation.
Each app will ask for permission to access the network; click 'Install' to allow this.
If you've already installed the application on your device, you will be asked whether you want to replace it with the version you're downloading. Click 'OK' to do this.

Once all of this is complete, the application you installed will show up with the rest of your apps in the list accessible from your home screen.

Note

These Android apps are configured to send reports to the developers in the event of a crash. No personally identifying information is collected.

Usage

Speed Test

Server setup (Linux)

The speedtest server is supplied as source code with a Makefile to build it. We assume the following are available on the build system:

The server is contained in the directory speedtest-server. The two files are server.c and Makefile. To build the server, change directory to speedtest-server and run make. Upon completion, the executable, speedtest_server, is created in the directory.

The speed test server uses the following three ports:

These ports should be accessible from the test devices in order for the program to operate. This may require adjusting the firewall settings to allow traffic on these ports.

Server setup (Windows)

We provide the server binary to be run on a windows system. The server and the required library, cygwin1.dll, are contained in the windows archive. To install the server, retrieve the archive and extract it. The archive contains a directory speedtest_server, which includes the binary and the dll. To run the speedtest server, double-click on the executable, server.exe. You may be prompted by Windows to allow the application to create a listening socket. It is important to allow it, otherwise the server will be inaccessible due to the firewall.

Server setup (phone)

Additionally, the server is built into the SpeedTest app itself:

This means you can run phone-to-phone tests by entering the server phone's IP address on the client phone. If the client phone reports that the network is unreachable, check your network setup and make sure that the phones can receive packets from each other.

back to top

Application Usage

Configuration

The first time you open the Speed Test application, you will see the following in succession:

Tap the 'Add new...' button to add a server IP. You must enter the IP address of a computer running the speedtest server before you can gather any measurements.

You can also long-press on a server to remove it from the list.

Finally, select the desired network interface for testing...

...and press the Back button to return to the main testing screen. From this screen you can also configure the test timeout, which specifies how long the test should run before returning a result or reporting failure. For logging mode (see below), you can also configure the time that the background logging service will pause between successive test runs.

back to top
One-shot testing mode

Press "Run Test" and watch as the result (or failure) is displayed on the screen. You can also press the "Menu" key and select "Options" to get back to the configuration screen.

back to top
Background logging mode

SpeedTest can also be run in a "logging mode," which runs tests periodically and saves the results to a log file on the device's external storage. The testing will continue until the user stops it. To start logging, simply tap the "Start" button. A background service will be launched, ensuring that testing continues even if the user navigates away from the Speed Test application.

The logging status screen displays the time of the last test, as well as the last known location and the time of that location reading. The logging application will attempt to obtain the location from GPS if available, but will also use network-based location information if GPS is not available. If the device is unable to determine the location within 30 seconds of starting the logger, the test will begin without location information, and the logger will periodically attempt to retrieve the location again.

When a test is run with no location information, the latitude and longitude in the log file (see below) will appear as 'NaN'. Note also that since the logger always uses the last known location, the location recorded may differ somewhat from the actual location of the device during the test.

To extract the saved data, connect your device to a computer via USB and mount it for reading by clicking this notification and then clicking "Mount":

Once this is completed, the contents of your device's external storage should be accessible from your computer.

The log files are contained in a directory named speedtest_logs. A new log file is created when the "Start" button is clicked, and each file is named with a timestamp at the time of its creation.

The log file format is comma-separated values for easy import into programs such as Excel. Each line contains these values:

latitude,longitude,timestamp_string,bandwidth_down,bandwidth_up,rtt

The bandwidth values are bytes/second and the round-trip time is milliseconds. If a line contains negative values for bandwidth and round-trip time, this indicates that the test failed at that time and location.

SpeedTest Visualization

Finally, we also provide a tool to visualize the SpeedTest log results in a Google Earth overlay. If you are running Windows, installing this tool is as simple as unpacking the archive and running the executable at a command prompt, passing a SpeedTest log file as an argument.

If you are using the source archive, there are some prerequisites. The process for installing these will vary by platform; generally, each of these has an automatic binary installer program for Windows/Mac, or a package in your Linux distrubution's software repository.

Whether you use the source distribution or the binary, be sure to install Google Earth (http://earth.google.com/) to view the overlays that this tool produces.

When run on the command line with a SpeedTest log file, the tool produces a number of PNG images, plus three KML files: one for each of the three SpeedTest metrics of downlink bandwidth, uplink bandwidth, and round-trip time. Open any of these KML files in Google Earth to view the data. The colors of the rectangles on the map signify the average value of the metric in the location covered by the rectangle. Here is a screenshot of Google Earth displaying a sample overlay:


back to top

Traffic Stats

Per-interface

On the initial screen, the Traffic Stats application displays the report on the amount of data downloaded and uploaded through all of the interfaces available on the device.

The application reports the values since the last time the user hit the "Reset" button ("Since last reset"), as well as since the phone has been started ("Since last boot"). When the user hits "Reset", the counts in the last reset are set to 0, as shown below.

Per-application

A secondary mode of the TrafficStats application allows you to view the network traffic on a single interface, grouped by application. Press 'Start' to start the background monitoring service.

You can choose the network interface by pressing 'Menu' and selecting 'Options.' Note that changing this setting will not take effect until the background monitor service is restarted.

Since this requires capturing packets sent on the network interface, your device must be rooted* in order to use per-application mode. If your device is not rooted, you will see this message:

* - For clarification, this is different than the ability to run commands as root using adb shell. TrafficStats requires installation of a su binary that can be run by any process. The app has been tested with the binary provided with Superuser, which also enables per-application root permission control.


back to top