droid-monitor 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +61 -2
- data/doc/images/Screen Shot 2015-09-12 at 09.41.16.png +0 -0
- data/doc/images/Screen Shot 2015-09-12 at 09.41.30.png +0 -0
- data/doc/images/Screen Shot 2015-09-12 at 09.41.40.png +0 -0
- data/lib/droid/monitor/gfxinfo.rb +164 -0
- data/lib/droid/monitor/version.rb +1 -1
- data/lib/droid/monitor.rb +4 -0
- data/sample/example_gfxinfo.rb +26 -0
- data/test/gfxinfo_test.rb +206 -0
- metadata +9 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 653d74ef15f0fb02920299d3c197ceb69ad0ec18
|
4
|
+
data.tar.gz: 395ba0200c6c82c55e8df301f1352f82928eccad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 666ce05d773fe30e8870c6732a2a4c6b042c28f4dc675b6c399b0d1c3bec997f0bb1f8a0930492dec28264afe6e39213f436848ae6da215dadb2082d94634314
|
7
|
+
data.tar.gz: b88db5c4a1fc7327439b3f4e4250fbe6ff2e3988d2340aeda6712c25c872b0ca8edbfd59abafa2e613359a9bb19b52ab318afc7f8b3af40b4b13d827dd73326b
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Droid::Monitor
|
2
2
|
|
3
|
-
Monitoring Android
|
3
|
+
Monitoring Android cpu or memory usage and create their simple graph with Google API.
|
4
4
|
|
5
5
|
[![Gem Version](https://badge.fury.io/rb/droid-monitor.svg)](http://badge.fury.io/rb/droid-monitor)
|
6
6
|
|
@@ -20,11 +20,23 @@ Or install it yourself as:
|
|
20
20
|
|
21
21
|
$ gem install droid-monitor
|
22
22
|
|
23
|
-
##
|
23
|
+
## Quick Start with Sample
|
24
24
|
|
25
25
|
See under `sample` file in this repository.
|
26
26
|
The `sample` use clockwork to run ruby script in particular terms.
|
27
27
|
|
28
|
+
|
29
|
+
```
|
30
|
+
$ cd sample
|
31
|
+
$ bundle install
|
32
|
+
$ bundle exec clockwork example_cpu.rb
|
33
|
+
```
|
34
|
+
|
35
|
+
## Usage
|
36
|
+
|
37
|
+
Followings are only storing data.
|
38
|
+
They don't include cron like clockwork.
|
39
|
+
|
28
40
|
### CPU
|
29
41
|
|
30
42
|
```ruby
|
@@ -127,6 +139,53 @@ or
|
|
127
139
|
|
128
140
|
![](https://github.com/KazuCocoa/droid-monitor/blob/master/doc/images/Screen%20Shot%202015-07-01%2010.19.11.png?raw=true)
|
129
141
|
|
142
|
+
|
143
|
+
### Gfxinfo
|
144
|
+
|
145
|
+
```ruby
|
146
|
+
require "droid/monitor/gxfinfo"
|
147
|
+
|
148
|
+
# initialize
|
149
|
+
@gfx = Droid::Monitor::Gfxinfo.new( { package: "com.android.chrome" } )
|
150
|
+
|
151
|
+
# save data into @gfx.gfxinfo_usage
|
152
|
+
@gfx.store_dumped_gfxinfo_usage
|
153
|
+
|
154
|
+
# export data into filename as google api format
|
155
|
+
data_file_gfx = "sample_gfx.txt"
|
156
|
+
data_file_mem = "sample_mem.txt"
|
157
|
+
data_file_frame = "sample_frame.txt"
|
158
|
+
@gfx.save_gfxinfo_usage_as_google_api(data_file_gfx, data_file_mem, data_file_frame)
|
159
|
+
|
160
|
+
# export data into filename which is used the above command.
|
161
|
+
output_file_path1 = "sample1.html"
|
162
|
+
output_file_path2 = "sample2.html"
|
163
|
+
output_file_path3 = "sample3.html"
|
164
|
+
|
165
|
+
graph_opts = { title: "Example", header1: "this graph is just sample"}
|
166
|
+
@gfx.create_graph(@data_file_gfx, graph_opts, output_file_path1)
|
167
|
+
@gfx.create_graph(@data_file_mem, graph_opts, output_file_path3)
|
168
|
+
@gfx.create_graph(@data_file_frame, graph_opts, output_file_path3)
|
169
|
+
|
170
|
+
# clear @net.tcp_rec and @net.tcp_snd
|
171
|
+
@gfx.clear_gfxinfo_usage
|
172
|
+
```
|
173
|
+
|
174
|
+
#### Graph
|
175
|
+
|
176
|
+
- gfx
|
177
|
+
|
178
|
+
![](https://raw.githubusercontent.com/KazuCocoa/droid-monitor/master/doc/images/Screen%20Shot%202015-09-12%20at%2009.41.30.png)
|
179
|
+
|
180
|
+
- memory
|
181
|
+
|
182
|
+
![](https://raw.githubusercontent.com/KazuCocoa/droid-monitor/master/doc/images/Screen%20Shot%202015-09-12%20at%2009.41.40.png)
|
183
|
+
|
184
|
+
- frame
|
185
|
+
|
186
|
+
![](https://raw.githubusercontent.com/KazuCocoa/droid-monitor/master/doc/images/Screen%20Shot%202015-09-12%20at%2009.41.16.png)
|
187
|
+
|
188
|
+
|
130
189
|
## Notice
|
131
190
|
|
132
191
|
1. Some browser, like Google Chrome, can't see local file via page. So, you should see report html file via FireFox as example.
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,164 @@
|
|
1
|
+
require_relative "../monitor"
|
2
|
+
require_relative "common/commons"
|
3
|
+
require_relative "report/google_api_template"
|
4
|
+
|
5
|
+
require "json"
|
6
|
+
|
7
|
+
module Droid
|
8
|
+
module Monitor
|
9
|
+
class Gfxinfo < Droid::Monitor::Adb
|
10
|
+
attr_reader :gfxinfo_usage
|
11
|
+
|
12
|
+
include Droid::Monitor::Utils
|
13
|
+
|
14
|
+
def initialize(opts = {})
|
15
|
+
super(opts)
|
16
|
+
@gfxinfo_usage = []
|
17
|
+
end
|
18
|
+
|
19
|
+
def clear_gfxinfo_usage
|
20
|
+
@gfxinfo_usage = []
|
21
|
+
end
|
22
|
+
|
23
|
+
def dump_gfxinfo_usage(dump_data)
|
24
|
+
dump1 = dump_data.scan(/^.*views,.*kB of display lists,.*frames rendered.*$/).map(&:strip)
|
25
|
+
.first.split(/\s/).reject(&:empty?)
|
26
|
+
dump2 = dump_data.scan(/^.*bytes,.*MB.*$/).map(&:strip).first.split(/\s/).reject(&:empty?)
|
27
|
+
dump1 + dump2
|
28
|
+
rescue StandardError => e
|
29
|
+
puts e
|
30
|
+
[]
|
31
|
+
end
|
32
|
+
|
33
|
+
# called directory
|
34
|
+
def store_dumped_gfxinfo_usage
|
35
|
+
self.store_gfxinfo_usage(self.dump_gfxinfo_usage(self.dump_gfxinfo))
|
36
|
+
end
|
37
|
+
|
38
|
+
# @param [String] file_path_gfx A file path to save gfx data.
|
39
|
+
# @param [String] file_path_mem A file path to save memory usage regarding gfx data.
|
40
|
+
# @param [String] file_path_frame A file path to save frame data.
|
41
|
+
def save_gfxinfo_usage_as_google_api(file_path_gfx, file_path_mem, file_path_frame)
|
42
|
+
self.save(export_as_google_api_format_gfx(@gfxinfo_usage), file_path_gfx)
|
43
|
+
self.save(export_as_google_api_format_mem(@gfxinfo_usage), file_path_mem)
|
44
|
+
self.save(export_as_google_api_format_frame(@gfxinfo_usage), file_path_frame)
|
45
|
+
end
|
46
|
+
|
47
|
+
def store_gfxinfo_usage(dumped_gfxinfo)
|
48
|
+
@gfxinfo_usage.push self.merge_current_time(transfer_total_gfxinfo_to_hash(dumped_gfxinfo))
|
49
|
+
end
|
50
|
+
|
51
|
+
def transfer_total_gfxinfo_to_hash(dump_gfxinfo_array)
|
52
|
+
if dump_gfxinfo_array.length <= 1
|
53
|
+
{
|
54
|
+
view: 0,
|
55
|
+
display_lists_kb: 0,
|
56
|
+
frames_rendered: 0,
|
57
|
+
total_memory: 0,
|
58
|
+
time: dump_gfxinfo_array.last,
|
59
|
+
}
|
60
|
+
else
|
61
|
+
{
|
62
|
+
view: dump_gfxinfo_array[0].to_i,
|
63
|
+
display_lists_kb: dump_gfxinfo_array[2].to_f.round(2),
|
64
|
+
frames_rendered: dump_gfxinfo_array[7].to_i,
|
65
|
+
total_memory: (dump_gfxinfo_array[10].to_f / 1024).round(2),
|
66
|
+
time: dump_gfxinfo_array.last,
|
67
|
+
}
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def export_as_google_api_format_gfx(from_gfxinfo_usage)
|
72
|
+
google_api_data_format = empty_google_api_format_gfx
|
73
|
+
|
74
|
+
from_gfxinfo_usage.each do |hash|
|
75
|
+
a_google_api_data_format = {
|
76
|
+
c: [
|
77
|
+
{ v: hash[:time] },
|
78
|
+
{ v: hash[:view] },
|
79
|
+
{ v: hash[:display_lists_kb] },
|
80
|
+
]
|
81
|
+
}
|
82
|
+
google_api_data_format[:rows].push(a_google_api_data_format)
|
83
|
+
end
|
84
|
+
|
85
|
+
JSON.generate google_api_data_format
|
86
|
+
end
|
87
|
+
|
88
|
+
def export_as_google_api_format_mem(from_gfxinfo_usage)
|
89
|
+
google_api_data_format = empty_google_api_format_mem
|
90
|
+
|
91
|
+
from_gfxinfo_usage.each do |hash|
|
92
|
+
a_google_api_data_format = {
|
93
|
+
c: [
|
94
|
+
{ v: hash[:time] },
|
95
|
+
{ v: hash[:total_memory] },
|
96
|
+
]
|
97
|
+
}
|
98
|
+
google_api_data_format[:rows].push(a_google_api_data_format)
|
99
|
+
end
|
100
|
+
|
101
|
+
JSON.generate google_api_data_format
|
102
|
+
end
|
103
|
+
|
104
|
+
def export_as_google_api_format_frame(from_gfxinfo_usage)
|
105
|
+
google_api_data_format = empty_google_api_format_frame
|
106
|
+
|
107
|
+
from_gfxinfo_usage.each do |hash|
|
108
|
+
a_google_api_data_format = {
|
109
|
+
c: [
|
110
|
+
{ v: hash[:time] },
|
111
|
+
{ v: hash[:frames_rendered] },
|
112
|
+
]
|
113
|
+
}
|
114
|
+
google_api_data_format[:rows].push(a_google_api_data_format)
|
115
|
+
end
|
116
|
+
|
117
|
+
JSON.generate google_api_data_format
|
118
|
+
end
|
119
|
+
|
120
|
+
def create_graph(data_file_path, graph_opts = {}, output_file_path)
|
121
|
+
self.save(Droid::Monitor::GoogleApiTemplate.create_graph(data_file_path, graph_opts),
|
122
|
+
output_file_path)
|
123
|
+
end
|
124
|
+
|
125
|
+
private
|
126
|
+
|
127
|
+
def empty_google_api_format_gfx
|
128
|
+
{
|
129
|
+
cols: [
|
130
|
+
{ label: 'time', type: 'string' },
|
131
|
+
{ label: 'view', type: 'number' },
|
132
|
+
{ label: 'display_lists_kb', type: 'number' },
|
133
|
+
],
|
134
|
+
rows: [
|
135
|
+
],
|
136
|
+
}
|
137
|
+
end
|
138
|
+
|
139
|
+
def empty_google_api_format_mem
|
140
|
+
{
|
141
|
+
cols: [
|
142
|
+
{ label: 'time', type: 'string' },
|
143
|
+
{ label: 'total_memory', type: 'number' },
|
144
|
+
],
|
145
|
+
rows: [
|
146
|
+
],
|
147
|
+
}
|
148
|
+
end
|
149
|
+
|
150
|
+
def empty_google_api_format_frame
|
151
|
+
{
|
152
|
+
cols: [
|
153
|
+
{ label: 'time', type: 'string' },
|
154
|
+
{ label: 'frames_rendered', type: 'number' },
|
155
|
+
],
|
156
|
+
rows: [
|
157
|
+
],
|
158
|
+
}
|
159
|
+
end
|
160
|
+
|
161
|
+
|
162
|
+
end # class Gfxinfo
|
163
|
+
end # module Monitor
|
164
|
+
end # module Droid
|
data/lib/droid/monitor.rb
CHANGED
@@ -0,0 +1,26 @@
|
|
1
|
+
require "droid/monitor/gfxinfo"
|
2
|
+
require "clockwork"
|
3
|
+
|
4
|
+
module Clockwork
|
5
|
+
@gfx = Droid::Monitor::Gfxinfo.new( { package: "com.android.chrome" } )
|
6
|
+
@time = 0
|
7
|
+
@data_file_gfx = "sample_gfx.txt"
|
8
|
+
@data_file_mem = "sample_mem.txt"
|
9
|
+
@data_file_frame = "sample_frame.txt"
|
10
|
+
|
11
|
+
every(0.5.seconds, "capture gfxinfo usage") do
|
12
|
+
@gfx.store_dumped_gfxinfo_usage
|
13
|
+
@time += 1
|
14
|
+
|
15
|
+
if @time == 40
|
16
|
+
# Shold set 3 output files to save each data
|
17
|
+
@gfx.save_gfxinfo_usage_as_google_api(@data_file_gfx, @data_file_mem, @data_file_frame)
|
18
|
+
graph_opts = { title: "Example", header1: "this graph is just sample"}
|
19
|
+
@gfx.create_graph(@data_file_gfx, graph_opts, "result_gfx.html")
|
20
|
+
@gfx.create_graph(@data_file_mem, graph_opts, "result_mem.html")
|
21
|
+
@gfx.create_graph(@data_file_frame, graph_opts, "result_frame.html")
|
22
|
+
@gfx.clear_gfxinfo_usage
|
23
|
+
puts "saved"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,206 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
|
3
|
+
require './lib/droid/monitor/gfxinfo'
|
4
|
+
|
5
|
+
SAMPLE_GFXINFO = <<-EOS
|
6
|
+
Applications Graphics Acceleration Info:
|
7
|
+
Uptime: 14972669 Realtime: 14972664
|
8
|
+
|
9
|
+
** Graphics info for pid 29541 [com.android.chrome] **
|
10
|
+
|
11
|
+
Recent DisplayList operations
|
12
|
+
DrawDisplayList
|
13
|
+
DrawDisplayList
|
14
|
+
DrawDisplayList
|
15
|
+
DrawColor
|
16
|
+
DrawDisplayList
|
17
|
+
DrawDisplayList
|
18
|
+
RestoreToCount
|
19
|
+
DrawColor
|
20
|
+
DrawDisplayList
|
21
|
+
Save
|
22
|
+
ClipRect
|
23
|
+
DrawDisplayList
|
24
|
+
DrawDisplayList
|
25
|
+
DrawDisplayList
|
26
|
+
DrawDisplayList
|
27
|
+
DrawDisplayList
|
28
|
+
DrawDisplayList
|
29
|
+
DrawColor
|
30
|
+
DrawDisplayList
|
31
|
+
DrawDisplayList
|
32
|
+
RestoreToCount
|
33
|
+
DrawColor
|
34
|
+
DrawDisplayList
|
35
|
+
Save
|
36
|
+
ClipRect
|
37
|
+
DrawDisplayList
|
38
|
+
DrawDisplayList
|
39
|
+
DrawDisplayList
|
40
|
+
DrawDisplayList
|
41
|
+
DrawDisplayList
|
42
|
+
DrawDisplayList
|
43
|
+
DrawColor
|
44
|
+
DrawDisplayList
|
45
|
+
DrawDisplayList
|
46
|
+
RestoreToCount
|
47
|
+
DrawColor
|
48
|
+
DrawDisplayList
|
49
|
+
Save
|
50
|
+
ClipRect
|
51
|
+
DrawDisplayList
|
52
|
+
DrawDisplayList
|
53
|
+
DrawDisplayList
|
54
|
+
DrawDisplayList
|
55
|
+
DrawDisplayList
|
56
|
+
DrawDisplayList
|
57
|
+
DrawColor
|
58
|
+
DrawDisplayList
|
59
|
+
DrawDisplayList
|
60
|
+
RestoreToCount
|
61
|
+
DrawColor
|
62
|
+
|
63
|
+
Caches:
|
64
|
+
Current memory usage / total memory usage (bytes):
|
65
|
+
TextureCache 46528 / 25165824
|
66
|
+
LayerCache 0 / 16777216
|
67
|
+
RenderBufferCache 0 / 2097152
|
68
|
+
GradientCache 57344 / 524288
|
69
|
+
PathCache 0 / 10485760
|
70
|
+
TextDropShadowCache 0 / 2097152
|
71
|
+
PatchCache 26304 / 131072
|
72
|
+
FontRenderer 0 A8 524288 / 524288
|
73
|
+
FontRenderer 0 RGBA 0 / 0
|
74
|
+
FontRenderer 0 total 524288 / 524288
|
75
|
+
Other:
|
76
|
+
FboCache 1 / 16
|
77
|
+
Total memory usage:
|
78
|
+
654464 bytes, 0.62 MB
|
79
|
+
|
80
|
+
Profile data in ms:
|
81
|
+
|
82
|
+
com.android.chrome/org.chromium.chrome.browser.ChromeTabbedActivity/android.view.ViewRootImpl@41fc59c8
|
83
|
+
View hierarchy:
|
84
|
+
|
85
|
+
com.android.chrome/org.chromium.chrome.browser.ChromeTabbedActivity/android.view.ViewRootImpl@41fc59c8
|
86
|
+
41 views, 1.36 kB of display lists, 191 frames rendered
|
87
|
+
|
88
|
+
|
89
|
+
Total ViewRootImpl: 1
|
90
|
+
Total Views: 41
|
91
|
+
Total DisplayList: 1.36 kB
|
92
|
+
EOS
|
93
|
+
|
94
|
+
class GfxinfoTest < Test::Unit::TestCase
|
95
|
+
|
96
|
+
def setup
|
97
|
+
@gfx = Droid::Monitor::Gfxinfo.new( { package: "com.android.chrome" } )
|
98
|
+
end
|
99
|
+
|
100
|
+
def teardown
|
101
|
+
@gfx = nil
|
102
|
+
end
|
103
|
+
|
104
|
+
def test_initialize
|
105
|
+
assert_instance_of(Droid::Monitor::Gfxinfo, @gfx)
|
106
|
+
|
107
|
+
@gfx.api_level = 18
|
108
|
+
assert_equal("com.android.chrome", @gfx.package)
|
109
|
+
assert_equal("", @gfx.device_serial)
|
110
|
+
assert_equal(18, @gfx.api_level)
|
111
|
+
assert_equal([], @gfx.gfxinfo_usage)
|
112
|
+
end
|
113
|
+
|
114
|
+
def test_dump_gfxinfo_usage
|
115
|
+
expected = %w(41 views, 1.36 kB of display lists, 191 frames rendered 654464 bytes, 0.62 MB)
|
116
|
+
assert_equal(expected, @gfx.dump_gfxinfo_usage(SAMPLE_GFXINFO))
|
117
|
+
end
|
118
|
+
|
119
|
+
def test_push_current_time
|
120
|
+
assert_equal(@gfx.merge_current_time({}).length, 1)
|
121
|
+
end
|
122
|
+
|
123
|
+
def test_transfer_from_hash_empty_to_json
|
124
|
+
dummy_array = %w(13:43:32.556)
|
125
|
+
|
126
|
+
@gfx.store_gfxinfo_usage(dummy_array)
|
127
|
+
expected_json = "[{\"view\":0,\"display_lists_kb\":0,\"frames_rendered\":0," +
|
128
|
+
"\"total_memory\":0,\"time\":\"#{@gfx.gfxinfo_usage[0][:time]}\"}]"
|
129
|
+
assert_equal(expected_json, JSON.generate(@gfx.gfxinfo_usage))
|
130
|
+
end
|
131
|
+
|
132
|
+
def test_transfer_from_hash_correct_to_json
|
133
|
+
dummy_array = %w(465 views, 38.00 kB of display lists, 354 frames rendered 5781894 bytes, 5.51 MB 13:43:32.556)
|
134
|
+
|
135
|
+
@gfx.store_gfxinfo_usage(dummy_array)
|
136
|
+
expected_json = "[{\"view\":465,\"display_lists_kb\":38.0,\"frames_rendered\":354," +
|
137
|
+
"\"total_memory\":5646.38,\"time\":\"#{@gfx.gfxinfo_usage[0][:time]}\"}]"
|
138
|
+
assert_equal(expected_json, JSON.generate(@gfx.gfxinfo_usage))
|
139
|
+
end
|
140
|
+
|
141
|
+
def test_convert_to_google_data_api_format_gfx_one
|
142
|
+
dummy_array = %w(465 views, 38.00 kB of display lists, 354 frames rendered 5781894 bytes, 5.51 MB 13:43:32.556)
|
143
|
+
|
144
|
+
@gfx.store_gfxinfo_usage(dummy_array)
|
145
|
+
expected_json = "{\"cols\":[{\"label\":\"time\",\"type\":\"string\"},{\"label\":\"view\",\"type\":\"number\"}," +
|
146
|
+
"{\"label\":\"display_lists_kb\",\"type\":\"number\"}],\"rows\":[{\"c\":[{\"v\":\"#{@gfx.gfxinfo_usage[0][:time]}\"}," +
|
147
|
+
"{\"v\":465},{\"v\":38.0}]}]}"
|
148
|
+
assert_equal(@gfx.export_as_google_api_format_gfx(@gfx.gfxinfo_usage), expected_json)
|
149
|
+
end
|
150
|
+
|
151
|
+
def test_convert_to_google_data_api_format_mem_one
|
152
|
+
dummy_array = %w(465 views, 38.00 kB of display lists, 354 frames rendered 5781894 bytes, 5.51 MB 13:43:32.556)
|
153
|
+
|
154
|
+
@gfx.store_gfxinfo_usage(dummy_array)
|
155
|
+
expected_json = "{\"cols\":[{\"label\":\"time\",\"type\":\"string\"}," +
|
156
|
+
"{\"label\":\"total_memory\",\"type\":\"number\"}],\"rows\":[{\"c\":[{\"v\":\"#{@gfx.gfxinfo_usage[0][:time]}\"}," +
|
157
|
+
"{\"v\":5646.38}]}]}"
|
158
|
+
assert_equal(@gfx.export_as_google_api_format_mem(@gfx.gfxinfo_usage), expected_json)
|
159
|
+
end
|
160
|
+
|
161
|
+
def test_convert_to_google_data_api_format_frame_one
|
162
|
+
dummy_array = %w(465 views, 38.00 kB of display lists, 354 frames rendered 5781894 bytes, 5.51 MB 13:43:32.556)
|
163
|
+
|
164
|
+
@gfx.store_gfxinfo_usage(dummy_array)
|
165
|
+
expected_json = "{\"cols\":[{\"label\":\"time\",\"type\":\"string\"}," +
|
166
|
+
"{\"label\":\"frames_rendered\",\"type\":\"number\"}],\"rows\":[{\"c\":[{\"v\":\"#{@gfx.gfxinfo_usage[0][:time]}\"}," +
|
167
|
+
"{\"v\":354}]}]}"
|
168
|
+
assert_equal(@gfx.export_as_google_api_format_frame(@gfx.gfxinfo_usage), expected_json)
|
169
|
+
end
|
170
|
+
|
171
|
+
def test_convert_to_google_data_api_format_gfx_many
|
172
|
+
dummy_array = %w(465 views, 38.00 kB of display lists, 354 frames rendered 5781894 bytes, 5.51 MB 13:43:32.556)
|
173
|
+
|
174
|
+
@gfx.store_gfxinfo_usage(dummy_array)
|
175
|
+
@gfx.store_gfxinfo_usage(dummy_array)
|
176
|
+
expected_json = "{\"cols\":[{\"label\":\"time\",\"type\":\"string\"}," +
|
177
|
+
"{\"label\":\"view\",\"type\":\"number\"},{\"label\":\"display_lists_kb\",\"type\":\"number\"}]," +
|
178
|
+
"\"rows\":[{\"c\":[{\"v\":\"#{@gfx.gfxinfo_usage[1][:time]}\"},{\"v\":465},{\"v\":38.0}]}," +
|
179
|
+
"{\"c\":[{\"v\":\"#{@gfx.gfxinfo_usage[1][:time]}\"},{\"v\":465},{\"v\":38.0}]}]}"
|
180
|
+
assert_equal(@gfx.export_as_google_api_format_gfx(@gfx.gfxinfo_usage), expected_json)
|
181
|
+
end
|
182
|
+
|
183
|
+
def test_convert_to_google_data_api_format_mem_many
|
184
|
+
dummy_array = %w(465 views, 38.00 kB of display lists, 354 frames rendered 5781894 bytes, 5.51 MB 13:43:32.556)
|
185
|
+
|
186
|
+
@gfx.store_gfxinfo_usage(dummy_array)
|
187
|
+
@gfx.store_gfxinfo_usage(dummy_array)
|
188
|
+
expected_json = "{\"cols\":[{\"label\":\"time\",\"type\":\"string\"}," +
|
189
|
+
"{\"label\":\"total_memory\",\"type\":\"number\"}],\"rows\":[{\"c\":[{\"v\":\"#{@gfx.gfxinfo_usage[1][:time]}\"}," +
|
190
|
+
"{\"v\":5646.38}]},{\"c\":[{\"v\":\"#{@gfx.gfxinfo_usage[1][:time]}\"},{\"v\":5646.38}]}]}"
|
191
|
+
assert_equal(@gfx.export_as_google_api_format_mem(@gfx.gfxinfo_usage), expected_json)
|
192
|
+
end
|
193
|
+
|
194
|
+
def test_convert_to_google_data_api_format_frame_many
|
195
|
+
dummy_array = %w(465 views, 38.00 kB of display lists, 354 frames rendered 5781894 bytes, 5.51 MB 13:43:32.556)
|
196
|
+
|
197
|
+
@gfx.store_gfxinfo_usage(dummy_array)
|
198
|
+
@gfx.store_gfxinfo_usage(dummy_array)
|
199
|
+
expected_json = "{\"cols\":[{\"label\":\"time\",\"type\":\"string\"}," +
|
200
|
+
"{\"label\":\"frames_rendered\",\"type\":\"number\"}],\"rows\":[{\"c\":[{\"v\":\"#{@gfx.gfxinfo_usage[1][:time]}\"}," +
|
201
|
+
"{\"v\":354}]},{\"c\":[{\"v\":\"#{@gfx.gfxinfo_usage[1][:time]}\"},{\"v\":354}]}]}"
|
202
|
+
assert_equal(@gfx.export_as_google_api_format_frame(@gfx.gfxinfo_usage), expected_json)
|
203
|
+
end
|
204
|
+
|
205
|
+
|
206
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: droid-monitor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kazuaki MATSUO
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faml
|
@@ -97,11 +97,15 @@ files:
|
|
97
97
|
- doc/images/Screen Shot 2015-05-23 at 19.56.41.png
|
98
98
|
- doc/images/Screen Shot 2015-07-01 10.18.57.png
|
99
99
|
- doc/images/Screen Shot 2015-07-01 10.19.11.png
|
100
|
+
- doc/images/Screen Shot 2015-09-12 at 09.41.16.png
|
101
|
+
- doc/images/Screen Shot 2015-09-12 at 09.41.30.png
|
102
|
+
- doc/images/Screen Shot 2015-09-12 at 09.41.40.png
|
100
103
|
- droid-monitor.gemspec
|
101
104
|
- lib/droid/monitor.rb
|
102
105
|
- lib/droid/monitor/common/commons.rb
|
103
106
|
- lib/droid/monitor/common/utils.rb
|
104
107
|
- lib/droid/monitor/cpu.rb
|
108
|
+
- lib/droid/monitor/gfxinfo.rb
|
105
109
|
- lib/droid/monitor/memory.rb
|
106
110
|
- lib/droid/monitor/net.rb
|
107
111
|
- lib/droid/monitor/report/google_api_template.rb
|
@@ -110,11 +114,13 @@ files:
|
|
110
114
|
- sample/Gemfile
|
111
115
|
- sample/Gemfile.lock
|
112
116
|
- sample/example_cpu.rb
|
117
|
+
- sample/example_gfxinfo.rb
|
113
118
|
- sample/example_memory.rb
|
114
119
|
- sample/example_net.rb
|
115
120
|
- sample/result.html
|
116
121
|
- sample/sample.txt
|
117
122
|
- test/cpu_test.rb
|
123
|
+
- test/gfxinfo_test.rb
|
118
124
|
- test/memory_test.rb
|
119
125
|
- test/monitor_test.rb
|
120
126
|
- test/net_test.rb
|
@@ -146,6 +152,7 @@ summary: Monitoring Android cpu or memory usage and create their simple graph wi
|
|
146
152
|
Google API.
|
147
153
|
test_files:
|
148
154
|
- test/cpu_test.rb
|
155
|
+
- test/gfxinfo_test.rb
|
149
156
|
- test/memory_test.rb
|
150
157
|
- test/monitor_test.rb
|
151
158
|
- test/net_test.rb
|