Droid::Monitor
Monitoring Android apu or memory usage and create their simple graph with Google API.
Installation
Add this line to your application's Gemfile:
gem 'droid-monitor'
And then execute:
$ bundle
Or install it yourself as:
$ gem install droid-monitor
Usage
See under sample
file in this repository.
The sample
use clockwork to run ruby script in particular terms.
CPU
# initialize
@cpu = Droid::Monitor::Cpu.new( { package: "com.android.chrome" } )
# save data into @cpu.cpu_usage
@cpu.store_dumped_cpu_usage
# export data into filename as google api format
filename = "sample_data.txt"
@cpu.save_cpu_usage_as_google_api(filename)
# export data into filename which is used the above command.
output_file_path = "sample.html"
graph_opts = { title: "Example", header1: "this graph is just sample"}
@cpu.create_graph(filename, graph_opts, output_file_path)
Graph
Memory
# initialize
# You can specify target devices with providing device serial which is provided via adb devices.
@memory = Droid::Monitor::Cpu.new( { package: "com.android.chrome", device_serial: "device_serials"} )
# save data into @memory.memory_usage
@memory.store_dumped_memory_details_usage
# export data into filename as google api format
filename = "sample_data.txt"
@memory.save_memory_details_as_google_api(filename)
# export data into filename which is used the above command.
output_file_path = "sample.html"
graph_opts = { title: "Example", header1: "this graph is just sample"}
@cpu.create_graph(filename, graph_opts, output_file_path)
Graph
Notice
- Some browser, like Google Chrome, can't see local file via page. So, you should see report html file via FireFox as example.
License
MIT license. Please see here.
Contributing
- Fork it ( https://github.com/[my-github-username]/droid-monitor/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request