droid-monitor 0.6.1 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.gitignore +1 -0
- data/.rubocop.yml +16 -0
- data/.travis.yml +14 -9
- data/Gemfile +2 -0
- data/README.md +2 -0
- data/Rakefile +10 -1
- data/droid-monitor.gemspec +18 -16
- data/lib/droid/monitor.rb +23 -16
- data/lib/droid/monitor/common/commons.rb +4 -2
- data/lib/droid/monitor/common/timer.rb +2 -0
- data/lib/droid/monitor/common/utils.rb +2 -0
- data/lib/droid/monitor/cpu.rb +39 -42
- data/lib/droid/monitor/executor/executor.rb +2 -0
- data/lib/droid/monitor/gfxinfo.rb +43 -45
- data/lib/droid/monitor/memory.rb +32 -32
- data/lib/droid/monitor/net.rb +21 -25
- data/lib/droid/monitor/report/google_api_template.rb +4 -2
- data/lib/droid/monitor/version.rb +3 -1
- data/sample/Gemfile +5 -3
- data/sample/example_cpu.rb +11 -9
- data/sample/example_gfxinfo.rb +14 -12
- data/sample/example_memory.rb +11 -9
- data/sample/example_net.rb +12 -10
- data/test/cpu_test.rb +67 -67
- data/test/gfxinfo_test.rb +249 -251
- data/test/memory_test.rb +206 -208
- data/test/monitor/timer_test.rb +2 -0
- data/test/monitor_test.rb +9 -9
- data/test/net_test.rb +10 -9
- data/test/run_test.rb +2 -0
- metadata +31 -17
- data/sample/Gemfile.lock +0 -39
@@ -1,11 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'tilt/haml'
|
2
4
|
|
3
5
|
module Droid
|
4
6
|
module Monitor
|
5
7
|
module GoogleApiTemplate
|
6
8
|
class << self
|
7
|
-
def create_graph(
|
8
|
-
template_path = File.expand_path(
|
9
|
+
def create_graph(data_file_path, graph_opts = {})
|
10
|
+
template_path = File.expand_path('templates/template_google_api_format.haml', __dir__)
|
9
11
|
default_graph_settings = { miniValue: 0, maxValue: 400, width: 800, height: 480 }
|
10
12
|
|
11
13
|
template = Tilt::HamlTemplate.new(template_path)
|
data/sample/Gemfile
CHANGED
data/sample/example_cpu.rb
CHANGED
@@ -1,21 +1,23 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'droid/monitor/cpu'
|
4
|
+
require 'clockwork'
|
3
5
|
|
4
6
|
module Clockwork
|
5
|
-
@cpu = Droid::Monitor::Cpu.new(
|
7
|
+
@cpu = Droid::Monitor::Cpu.new(package: 'com.android.chrome')
|
6
8
|
@time = 0
|
7
|
-
@data_file =
|
9
|
+
@data_file = 'sample.txt'
|
8
10
|
|
9
|
-
every(0.5.seconds,
|
11
|
+
every(0.5.seconds, 'capture cpu usage') do
|
10
12
|
@cpu.store_dumped_cpu_usage
|
11
13
|
@time += 1
|
12
14
|
|
13
15
|
if @time == 40
|
14
16
|
@cpu.save_cpu_usage_as_google_api(@data_file)
|
15
|
-
graph_opts = { title:
|
16
|
-
@cpu.create_graph(@data_file, graph_opts,
|
17
|
+
graph_opts = { title: 'Example', header1: 'this graph is just sample' }
|
18
|
+
@cpu.create_graph(@data_file, graph_opts, 'result.html')
|
17
19
|
@cpu.clear_cpu_usage
|
18
|
-
puts
|
20
|
+
puts 'saved'
|
19
21
|
end
|
20
22
|
end
|
21
|
-
end
|
23
|
+
end
|
data/sample/example_gfxinfo.rb
CHANGED
@@ -1,26 +1,28 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'droid/monitor/gfxinfo'
|
4
|
+
require 'clockwork'
|
3
5
|
|
4
6
|
module Clockwork
|
5
|
-
@gfx = Droid::Monitor::Gfxinfo.new(
|
7
|
+
@gfx = Droid::Monitor::Gfxinfo.new(package: 'com.android.chrome')
|
6
8
|
@time = 0
|
7
|
-
@data_file_gfx =
|
8
|
-
@data_file_mem =
|
9
|
-
@data_file_frame =
|
9
|
+
@data_file_gfx = 'sample_gfx.txt'
|
10
|
+
@data_file_mem = 'sample_mem.txt'
|
11
|
+
@data_file_frame = 'sample_frame.txt'
|
10
12
|
|
11
|
-
every(0.5.seconds,
|
13
|
+
every(0.5.seconds, 'capture gfxinfo usage') do
|
12
14
|
@gfx.store_dumped_gfxinfo_usage
|
13
15
|
@time += 1
|
14
16
|
|
15
17
|
if @time == 40
|
16
18
|
# Shold set 3 output files to save each data
|
17
19
|
@gfx.save_gfxinfo_usage_as_google_api(@data_file_gfx, @data_file_mem, @data_file_frame)
|
18
|
-
graph_opts = { title:
|
19
|
-
@gfx.create_graph(@data_file_gfx, graph_opts,
|
20
|
-
@gfx.create_graph(@data_file_mem, graph_opts,
|
21
|
-
@gfx.create_graph(@data_file_frame, graph_opts,
|
20
|
+
graph_opts = { title: 'Example', header1: 'this graph is just sample' }
|
21
|
+
@gfx.create_graph(@data_file_gfx, graph_opts, 'result_gfx.html')
|
22
|
+
@gfx.create_graph(@data_file_mem, graph_opts, 'result_mem.html')
|
23
|
+
@gfx.create_graph(@data_file_frame, graph_opts, 'result_frame.html')
|
22
24
|
@gfx.clear_gfxinfo_usage
|
23
|
-
puts
|
25
|
+
puts 'saved'
|
24
26
|
end
|
25
27
|
end
|
26
28
|
end
|
data/sample/example_memory.rb
CHANGED
@@ -1,21 +1,23 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'droid/monitor/memory'
|
4
|
+
require 'clockwork'
|
3
5
|
|
4
6
|
module Clockwork
|
5
|
-
@memory = Droid::Monitor::Memory.new(
|
7
|
+
@memory = Droid::Monitor::Memory.new(package: 'com.android.chrome')
|
6
8
|
@time = 0
|
7
|
-
@data_file =
|
9
|
+
@data_file = 'sample.txt'
|
8
10
|
|
9
|
-
every(0.5.seconds,
|
11
|
+
every(0.5.seconds, 'capture memory usage') do
|
10
12
|
@memory.store_dumped_memory_details_usage
|
11
13
|
@time += 1
|
12
14
|
|
13
15
|
if @time == 40
|
14
16
|
@memory.save_memory_details_as_google_api(@data_file)
|
15
|
-
graph_opts = { title:
|
16
|
-
@memory.create_graph(@data_file, graph_opts,
|
17
|
+
graph_opts = { title: 'Example', header1: 'this graph is just sample' }
|
18
|
+
@memory.create_graph(@data_file, graph_opts, 'result.html')
|
17
19
|
@memory.clear_memory_detail_usage
|
18
|
-
puts
|
20
|
+
puts 'saved'
|
19
21
|
end
|
20
22
|
end
|
21
|
-
end
|
23
|
+
end
|
data/sample/example_net.rb
CHANGED
@@ -1,13 +1,15 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../lib/droid/monitor/net'
|
4
|
+
require 'clockwork'
|
3
5
|
|
4
6
|
module Clockwork
|
5
|
-
@net = Droid::Monitor::Net.new(
|
7
|
+
@net = Droid::Monitor::Net.new(package: 'com.android.chrome')
|
6
8
|
@time = 0
|
7
|
-
@data_file =
|
8
|
-
@data_file2 =
|
9
|
+
@data_file = 'sample.txt'
|
10
|
+
@data_file2 = 'sample2.txt'
|
9
11
|
|
10
|
-
every(0.5.seconds,
|
12
|
+
every(0.5.seconds, 'capture nets usage') do
|
11
13
|
@net.store_dumped_tcp_rcv
|
12
14
|
@net.store_dumped_tcp_snd
|
13
15
|
@time += 1
|
@@ -15,12 +17,12 @@ module Clockwork
|
|
15
17
|
if @time == 40
|
16
18
|
@net.save_cpu_usage_as_google_api_rec(@data_file)
|
17
19
|
@net.save_cpu_usage_as_google_api_snd(@data_file2)
|
18
|
-
graph_opts = { title:
|
19
|
-
@net.create_graph(@data_file, graph_opts,
|
20
|
-
@net.create_graph(@data_file2, graph_opts,
|
20
|
+
graph_opts = { title: 'Example', header1: 'this graph is just sample' }
|
21
|
+
@net.create_graph(@data_file, graph_opts, 'result.html')
|
22
|
+
@net.create_graph(@data_file2, graph_opts, 'result2.html')
|
21
23
|
|
22
24
|
@net.clear_tcps
|
23
|
-
puts
|
25
|
+
puts 'saved'
|
24
26
|
end
|
25
27
|
end
|
26
28
|
end
|
data/test/cpu_test.rb
CHANGED
@@ -1,47 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'test/unit'
|
2
4
|
|
3
5
|
require './lib/droid/monitor/cpu'
|
4
6
|
|
5
|
-
SAMPLE_CPU_DATA_44 =
|
6
|
-
Load: 20.88 / 17.57 / 10.31
|
7
|
-
CPU usage from 7077ms to 1571ms ago:
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
96% TOTAL: 49% user + 20% kernel + 26% iowait + 0.5% softirq
|
7
|
+
SAMPLE_CPU_DATA_44 = <<~EOS
|
8
|
+
Load: 20.88 / 17.57 / 10.31
|
9
|
+
CPU usage from 7077ms to 1571ms ago:
|
10
|
+
47% 844/system_server: 37% user + 10% kernel / faults: 2947 minor
|
11
|
+
23% 3031/com.facebook.orca: 22% user + 0.3% kernel / faults: 553 minor
|
12
|
+
18% 24281/android.process.media: 12% user + 5.2% kernel / faults: 910 minor
|
13
|
+
9.2% 15887/com.linkbubble.playstore: 7.4% user + 1.8% kernel / faults: 137 minor
|
14
|
+
7.4% 1038/com.android.systemui: 4.1% user + 3.2% kernel / faults: 23 minor
|
15
|
+
6.1% 125/mmcqd/0: 0% user + 6.1% kernel
|
16
|
+
6.1% 161/surfaceflinger: 2% user + 4.1% kernel
|
17
|
+
6% 24263/com.android.chrome: 4.7% user + 1.2% kernel / faults: 1361 minor 17 major
|
18
|
+
5.2% 20938/com.facebook.katana: 2.1% user + 3% kernel / faults: 64 minor
|
19
|
+
2.7% 194/sdcard: 0.1% user + 2.5% kernel
|
20
|
+
1.2% 60/kswapd0: 0% user + 1.2% kernel
|
21
|
+
1.2% 11502/kworker/u:13: 0% user + 1.2% kernel
|
22
|
+
1% 289/sensors.qcom: 0.1% user + 0.9% kernel
|
23
|
+
0.9% 21403/com.mailboxapp: 0.7% user + 0.1% kernel / faults: 303 minor
|
24
|
+
0.7% 144/jbd2/mmcblk0p19: 0% user + 0.7% kernel
|
25
|
+
0.7% 1162/com.google.android.gms.persistent: 0.3% user + 0.3% kernel / faults: 37 minor
|
26
|
+
0.3% 1762/mpdecision: 0% user + 0.3% kernel
|
27
|
+
0.1% 18301/kworker/0:2: 0% user + 0.1% kernel
|
28
|
+
0.3% 25698/com.google.android.gms.wearable: 0.3% user + 0% kernel / faults: 354 minor
|
29
|
+
0% 158/netd: 0% user + 0% kernel / faults: 38 minor
|
30
|
+
0.1% 191/logcat: 0.1% user + 0% kernel
|
31
|
+
0% 1024/MC_Thread: 0% user + 0% kernel
|
32
|
+
0.1% 1239/com.tul.aviate: 0.1% user + 0% kernel / faults: 4 minor
|
33
|
+
0.1% 6799/kworker/0:0: 0% user + 0.1% kernel
|
34
|
+
0% 14728/com.google.android.googlequicksearchbox:search: 0% user + 0% kernel / faults: 13 minor
|
35
|
+
0% 24205/kworker/1:1: 0% user + 0% kernel
|
36
|
+
96% TOTAL: 49% user + 20% kernel + 26% iowait + 0.5% softirq
|
35
37
|
EOS
|
36
38
|
|
37
|
-
TOP_CPU =
|
38
|
-
17742 0 4.7% S 82 2929372K 212464K fg u0_a124 com.android.chrome
|
39
|
+
TOP_CPU = <<~EOS
|
40
|
+
17742 0 4.7% S 82 2929372K 212464K fg u0_a124 com.android.chrome
|
39
41
|
EOS
|
40
42
|
|
41
43
|
class CpuTest < Test::Unit::TestCase
|
42
|
-
|
43
44
|
def setup
|
44
|
-
@cpu = Droid::Monitor::Cpu.new(
|
45
|
+
@cpu = Droid::Monitor::Cpu.new(package: 'com.android.chrome')
|
45
46
|
end
|
46
47
|
|
47
48
|
def teardown
|
@@ -52,8 +53,8 @@ class CpuTest < Test::Unit::TestCase
|
|
52
53
|
assert_instance_of(Droid::Monitor::Cpu, @cpu)
|
53
54
|
|
54
55
|
@cpu.api_level = 18
|
55
|
-
assert_equal(
|
56
|
-
assert_equal(
|
56
|
+
assert_equal('com.android.chrome', @cpu.package)
|
57
|
+
assert_equal('', @cpu.device_serial)
|
57
58
|
assert_equal(18, @cpu.api_level)
|
58
59
|
assert_equal([], @cpu.cpu_usage)
|
59
60
|
end
|
@@ -63,7 +64,7 @@ class CpuTest < Test::Unit::TestCase
|
|
63
64
|
end
|
64
65
|
|
65
66
|
def test_dump_cpu_usage
|
66
|
-
expected = %w
|
67
|
+
expected = %w[6% 24263/com.android.chrome: 4.7% user + 1.2% kernel / faults: 1361 minor 17 major]
|
67
68
|
assert_equal(expected, @cpu.dump_cpu_usage(SAMPLE_CPU_DATA_44))
|
68
69
|
end
|
69
70
|
|
@@ -73,31 +74,31 @@ class CpuTest < Test::Unit::TestCase
|
|
73
74
|
end
|
74
75
|
|
75
76
|
def test_dump_cpu_usage_with_top
|
76
|
-
expected = %w
|
77
|
+
expected = %w[17742 0 4.7% S 82 2929372K 212464K fg u0_a124 com.android.chrome]
|
77
78
|
assert_equal(expected, @cpu.dump_cpu_usage(TOP_CPU))
|
78
79
|
end
|
79
80
|
|
80
81
|
def test_transfer_from_hash_empty_to_json
|
81
|
-
dummy_array = %w
|
82
|
+
dummy_array = %w[13:43:32.556]
|
82
83
|
|
83
84
|
@cpu.store_cpu_usage(dummy_array)
|
84
|
-
expected_json =
|
85
|
-
|
85
|
+
expected_json = '[{"total_cpu":"0%","process":"no package process","user":"0%",' \
|
86
|
+
"\"kernel\":\"0%\",\"time\":\"#{@cpu.cpu_usage[0][:time]}\"}]"
|
86
87
|
|
87
88
|
assert_equal(expected_json, JSON.generate(@cpu.cpu_usage))
|
88
89
|
end
|
89
90
|
|
90
91
|
def test_transfer_from_hash_correct_to_json
|
91
|
-
dummy_array = %w
|
92
|
+
dummy_array = %w[4.7% 2273/com.sample.package:sample: 3.3% user + 1.3% kernel 13:43:32.556]
|
92
93
|
|
93
94
|
@cpu.store_cpu_usage(dummy_array)
|
94
|
-
expected_json =
|
95
|
-
|
95
|
+
expected_json = '[{"total_cpu":"4.7%","process":"2273/com.sample.package:sample:",' \
|
96
|
+
"\"user\":\"3.3%\",\"kernel\":\"1.3%\",\"time\":\"#{@cpu.cpu_usage[0][:time]}\"}]"
|
96
97
|
assert_equal(expected_json, JSON.generate(@cpu.cpu_usage))
|
97
98
|
end
|
98
99
|
|
99
100
|
def test_transfer_from_hash_empty_to_json_with_top
|
100
|
-
dummy_array = %w
|
101
|
+
dummy_array = %w[13:43:32.556]
|
101
102
|
|
102
103
|
@cpu.store_cpu_usage_with_top(dummy_array)
|
103
104
|
expected_json = "[{\"total_cpu\":\"0%\",\"process\":\"no package process\",\"time\":\"#{@cpu.cpu_usage[0][:time]}\"}]"
|
@@ -105,7 +106,7 @@ class CpuTest < Test::Unit::TestCase
|
|
105
106
|
end
|
106
107
|
|
107
108
|
def test_transfer_from_hash_correct_to_json_with_top
|
108
|
-
dummy_array = %w
|
109
|
+
dummy_array = %w[17742 0 4.7% S 82 2929372K 212464K fg u0_a124 com.sample.package 13:43:32.55]
|
109
110
|
|
110
111
|
@cpu.store_cpu_usage_with_top(dummy_array)
|
111
112
|
expected_json = "[{\"total_cpu\":\"4.7%\",\"process\":\"17742\",\"time\":\"#{@cpu.cpu_usage[0][:time]}\"}]"
|
@@ -113,49 +114,48 @@ class CpuTest < Test::Unit::TestCase
|
|
113
114
|
end
|
114
115
|
|
115
116
|
def test_convert_to_google_data_api_format_one
|
116
|
-
dummy_array = %w
|
117
|
+
dummy_array = %w[4.7% 2273/com.sample.package:sample: 3.3% user + 1.3% kernel 13:43:32.556]
|
117
118
|
|
118
119
|
@cpu.store_cpu_usage(dummy_array)
|
119
|
-
expected_json =
|
120
|
-
|
121
|
-
|
122
|
-
|
120
|
+
expected_json = '{"cols":[{"label":"time","type":"string"},' \
|
121
|
+
'{"label":"total_cpu","type":"number"},{"label":"user","type":"number"},' \
|
122
|
+
"{\"label\":\"kernel\",\"type\":\"number\"}],\"rows\":[{\"c\":[{\"v\":\"#{@cpu.cpu_usage[0][:time]}\"}," \
|
123
|
+
'{"v":4.7},{"v":3.3},{"v":1.3}]}]}'
|
123
124
|
assert_equal(@cpu.export_as_google_api_format(@cpu.cpu_usage), expected_json)
|
124
125
|
end
|
125
126
|
|
126
127
|
def test_convert_to_google_data_api_format_many
|
127
|
-
dummy_array = %w
|
128
|
+
dummy_array = %w[4.7% 2273/com.sample.package:sample: 3.3% user + 1.3% kernel 13:43:32.556]
|
128
129
|
|
129
130
|
@cpu.store_cpu_usage(dummy_array)
|
130
131
|
@cpu.store_cpu_usage(dummy_array)
|
131
|
-
expected_json =
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
132
|
+
expected_json = '{"cols":[{"label":"time","type":"string"},' \
|
133
|
+
'{"label":"total_cpu","type":"number"},{"label":"user","type":"number"},' \
|
134
|
+
"{\"label\":\"kernel\",\"type\":\"number\"}],\"rows\":[{\"c\":[{\"v\":\"#{@cpu.cpu_usage[0][:time]}\"}," \
|
135
|
+
"{\"v\":4.7},{\"v\":3.3},{\"v\":1.3}]},{\"c\":[{\"v\":\"#{@cpu.cpu_usage[1][:time]}\"}," \
|
136
|
+
'{"v":4.7},{"v":3.3},{"v":1.3}]}]}'
|
136
137
|
assert_equal(@cpu.export_as_google_api_format(@cpu.cpu_usage), expected_json)
|
137
138
|
end
|
138
139
|
|
139
140
|
def test_convert_to_google_data_api_format_with_top_one
|
140
|
-
dummy_array = %w
|
141
|
+
dummy_array = %w[17742 0 4.7% S 82 2929372K 212464K fg u0_a124 com.sample.package 13:43:32.55]
|
141
142
|
|
142
143
|
@cpu.store_cpu_usage_with_top(dummy_array)
|
143
|
-
expected_json =
|
144
|
-
|
145
|
-
|
144
|
+
expected_json = '{"cols":[{"label":"time","type":"string"},' \
|
145
|
+
"{\"label\":\"total_cpu\",\"type\":\"number\"}],\"rows\":[{\"c\":[{\"v\":\"#{@cpu.cpu_usage[0][:time]}\"}," \
|
146
|
+
'{"v":4.7}]}]}'
|
146
147
|
assert_equal(@cpu.export_as_google_api_format_with_top(@cpu.cpu_usage), expected_json)
|
147
148
|
end
|
148
149
|
|
149
150
|
def test_convert_to_google_data_api_format_with_top_many
|
150
|
-
dummy_array = %w
|
151
|
+
dummy_array = %w[17742 0 4.7% S 82 2929372K 212464K fg u0_a124 com.sample.package 13:43:32.55]
|
151
152
|
|
152
153
|
@cpu.store_cpu_usage_with_top(dummy_array)
|
153
154
|
@cpu.store_cpu_usage_with_top(dummy_array)
|
154
|
-
expected_json =
|
155
|
-
|
156
|
-
|
157
|
-
|
155
|
+
expected_json = '{"cols":[{"label":"time","type":"string"},' \
|
156
|
+
"{\"label\":\"total_cpu\",\"type\":\"number\"}],\"rows\":[{\"c\":[{\"v\":\"#{@cpu.cpu_usage[0][:time]}\"}," \
|
157
|
+
"{\"v\":4.7}]},{\"c\":[{\"v\":\"#{@cpu.cpu_usage[1][:time]}\"}," \
|
158
|
+
'{"v":4.7}]}]}'
|
158
159
|
assert_equal(@cpu.export_as_google_api_format_with_top(@cpu.cpu_usage), expected_json)
|
159
160
|
end
|
160
|
-
|
161
161
|
end
|
data/test/gfxinfo_test.rb
CHANGED
@@ -1,254 +1,255 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'test/unit'
|
2
4
|
|
3
5
|
require './lib/droid/monitor/gfxinfo'
|
4
6
|
|
5
|
-
SAMPLE_GFXINFO =
|
6
|
-
Applications Graphics Acceleration Info:
|
7
|
-
Uptime: 14972669 Realtime: 14972664
|
7
|
+
SAMPLE_GFXINFO = <<~EOS
|
8
|
+
Applications Graphics Acceleration Info:
|
9
|
+
Uptime: 14972669 Realtime: 14972664
|
8
10
|
|
9
|
-
** Graphics info for pid 29541 [com.android.chrome] **
|
11
|
+
** Graphics info for pid 29541 [com.android.chrome] **
|
10
12
|
|
11
|
-
Recent DisplayList operations
|
12
|
-
DrawDisplayList
|
13
|
+
Recent DisplayList operations
|
13
14
|
DrawDisplayList
|
14
|
-
DrawDisplayList
|
15
|
-
DrawColor
|
16
15
|
DrawDisplayList
|
17
16
|
DrawDisplayList
|
18
|
-
|
19
|
-
|
20
|
-
DrawDisplayList
|
21
|
-
|
22
|
-
|
17
|
+
DrawColor
|
18
|
+
DrawDisplayList
|
19
|
+
DrawDisplayList
|
20
|
+
RestoreToCount
|
21
|
+
DrawColor
|
23
22
|
DrawDisplayList
|
23
|
+
Save
|
24
|
+
ClipRect
|
24
25
|
DrawDisplayList
|
25
26
|
DrawDisplayList
|
26
27
|
DrawDisplayList
|
27
28
|
DrawDisplayList
|
28
|
-
DrawDisplayList
|
29
|
-
DrawColor
|
30
29
|
DrawDisplayList
|
31
30
|
DrawDisplayList
|
32
|
-
|
33
|
-
|
34
|
-
DrawDisplayList
|
35
|
-
|
36
|
-
|
31
|
+
DrawColor
|
32
|
+
DrawDisplayList
|
33
|
+
DrawDisplayList
|
34
|
+
RestoreToCount
|
35
|
+
DrawColor
|
37
36
|
DrawDisplayList
|
37
|
+
Save
|
38
|
+
ClipRect
|
38
39
|
DrawDisplayList
|
39
40
|
DrawDisplayList
|
40
41
|
DrawDisplayList
|
41
42
|
DrawDisplayList
|
42
|
-
DrawDisplayList
|
43
|
-
DrawColor
|
44
43
|
DrawDisplayList
|
45
44
|
DrawDisplayList
|
46
|
-
|
47
|
-
|
48
|
-
DrawDisplayList
|
49
|
-
|
50
|
-
|
45
|
+
DrawColor
|
46
|
+
DrawDisplayList
|
47
|
+
DrawDisplayList
|
48
|
+
RestoreToCount
|
49
|
+
DrawColor
|
51
50
|
DrawDisplayList
|
51
|
+
Save
|
52
|
+
ClipRect
|
52
53
|
DrawDisplayList
|
53
54
|
DrawDisplayList
|
54
55
|
DrawDisplayList
|
55
56
|
DrawDisplayList
|
56
|
-
DrawDisplayList
|
57
|
-
DrawColor
|
58
57
|
DrawDisplayList
|
59
58
|
DrawDisplayList
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
59
|
+
DrawColor
|
60
|
+
DrawDisplayList
|
61
|
+
DrawDisplayList
|
62
|
+
RestoreToCount
|
63
|
+
DrawColor
|
64
|
+
|
65
|
+
Caches:
|
66
|
+
Current memory usage / total memory usage (bytes):
|
67
|
+
TextureCache 46528 / 25165824
|
68
|
+
LayerCache 0 / 16777216
|
69
|
+
RenderBufferCache 0 / 2097152
|
70
|
+
GradientCache 57344 / 524288
|
71
|
+
PathCache 0 / 10485760
|
72
|
+
TextDropShadowCache 0 / 2097152
|
73
|
+
PatchCache 26304 / 131072
|
74
|
+
FontRenderer 0 A8 524288 / 524288
|
75
|
+
FontRenderer 0 RGBA 0 / 0
|
76
|
+
FontRenderer 0 total 524288 / 524288
|
77
|
+
Other:
|
78
|
+
FboCache 1 / 16
|
79
|
+
Total memory usage:
|
80
|
+
654464 bytes, 0.62 MB
|
81
|
+
|
82
|
+
Profile data in ms:
|
83
|
+
|
84
|
+
com.android.chrome/org.chromium.chrome.browser.ChromeTabbedActivity/android.view.ViewRootImpl@41fc59c8
|
85
|
+
View hierarchy:
|
86
|
+
|
87
|
+
com.android.chrome/org.chromium.chrome.browser.ChromeTabbedActivity/android.view.ViewRootImpl@41fc59c8
|
88
|
+
41 views, 1.36 kB of display lists, 191 frames rendered
|
89
|
+
|
90
|
+
|
91
|
+
Total ViewRootImpl: 1
|
92
|
+
Total Views: 41
|
93
|
+
Total DisplayList: 1.36 kB
|
92
94
|
EOS
|
93
95
|
|
94
|
-
SAMPLE_GFXINFO_5 =
|
95
|
-
Applications Graphics Acceleration Info:
|
96
|
-
Uptime: 6019250 Realtime: 13901895
|
96
|
+
SAMPLE_GFXINFO_5 = <<~EOS
|
97
|
+
Applications Graphics Acceleration Info:
|
98
|
+
Uptime: 6019250 Realtime: 13901895
|
97
99
|
|
98
|
-
** Graphics info for pid 26834 [com.android.chrome] **
|
100
|
+
** Graphics info for pid 26834 [com.android.chrome] **
|
99
101
|
|
100
|
-
Recent DisplayList operations
|
102
|
+
Recent DisplayList operations
|
103
|
+
ConcatMatrix
|
104
|
+
Save
|
105
|
+
DrawBitmap
|
106
|
+
RestoreToCount
|
107
|
+
DrawRenderNode
|
108
|
+
DrawRenderNode
|
109
|
+
Save
|
110
|
+
ClipRect
|
111
|
+
Translate
|
112
|
+
DrawRenderNode
|
113
|
+
DrawText
|
114
|
+
DrawText
|
115
|
+
RestoreToCount
|
116
|
+
DrawRenderNode
|
117
|
+
Save
|
101
118
|
ConcatMatrix
|
102
119
|
Save
|
103
120
|
DrawBitmap
|
104
121
|
RestoreToCount
|
105
|
-
DrawRenderNode
|
106
122
|
DrawRenderNode
|
107
123
|
Save
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
DrawText
|
112
|
-
DrawText
|
124
|
+
ConcatMatrix
|
125
|
+
Save
|
126
|
+
DrawBitmap
|
113
127
|
RestoreToCount
|
114
|
-
DrawRenderNode
|
115
|
-
Save
|
116
|
-
ConcatMatrix
|
117
|
-
Save
|
118
|
-
DrawBitmap
|
119
128
|
RestoreToCount
|
120
|
-
DrawRenderNode
|
121
|
-
Save
|
122
|
-
ConcatMatrix
|
123
|
-
Save
|
124
|
-
DrawBitmap
|
125
|
-
RestoreToCount
|
126
|
-
RestoreToCount
|
127
|
-
DrawRenderNode
|
128
129
|
DrawRenderNode
|
129
130
|
DrawRenderNode
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
RestoreToCount
|
139
|
-
|
140
|
-
|
141
|
-
DrawBitmap
|
142
|
-
DrawBitmap
|
143
|
-
DrawBitmap
|
144
|
-
|
145
|
-
|
146
|
-
DrawBitmap
|
147
|
-
DrawBitmap
|
148
|
-
DrawBitmap
|
149
|
-
|
150
|
-
DrawText
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
Total
|
182
|
-
Total
|
131
|
+
DrawRenderNode
|
132
|
+
Save
|
133
|
+
ConcatMatrix
|
134
|
+
Save
|
135
|
+
DrawBitmap
|
136
|
+
RestoreToCount
|
137
|
+
RestoreToCount
|
138
|
+
DrawRenderNode
|
139
|
+
RestoreToCount
|
140
|
+
RestoreToCount
|
141
|
+
DrawRect
|
142
|
+
DrawBitmap
|
143
|
+
DrawBitmap
|
144
|
+
DrawBitmap
|
145
|
+
DrawBitmap
|
146
|
+
DrawPatch
|
147
|
+
DrawBitmap
|
148
|
+
DrawBitmap
|
149
|
+
DrawBitmap
|
150
|
+
DrawBitmap
|
151
|
+
DrawText
|
152
|
+
DrawText
|
153
|
+
|
154
|
+
Caches:
|
155
|
+
Current memory usage / total memory usage (bytes):
|
156
|
+
TextureCache 669300 / 50331648
|
157
|
+
LayerCache 0 / 33554432 (numLayers = 0)
|
158
|
+
Layers total 0 (numLayers = 0)
|
159
|
+
RenderBufferCache 0 / 4194304
|
160
|
+
GradientCache 0 / 1048576
|
161
|
+
PathCache 0 / 25165824
|
162
|
+
TessellationCache 0 / 1048576
|
163
|
+
TextDropShadowCache 0 / 5242880
|
164
|
+
PatchCache 960 / 131072
|
165
|
+
FontRenderer 0 A8 524288 / 524288
|
166
|
+
FontRenderer 0 RGBA 0 / 0
|
167
|
+
FontRenderer 0 total 524288 / 524288
|
168
|
+
Other:
|
169
|
+
FboCache 0 / 0
|
170
|
+
Total memory usage:
|
171
|
+
1194548 bytes, 1.14 MB
|
172
|
+
|
173
|
+
Profile data in ms:
|
174
|
+
|
175
|
+
com.android.chrome/org.chromium.chrome.browser.ChromeTabbedActivity/android.view.ViewRootImpl@27de7df5 (visibility=0)
|
176
|
+
View hierarchy:
|
177
|
+
|
178
|
+
com.android.chrome/org.chromium.chrome.browser.ChromeTabbedActivity/android.view.ViewRootImpl@27de7df5
|
179
|
+
55 views, 51,03 kB of display lists
|
180
|
+
|
181
|
+
|
182
|
+
Total ViewRootImpl: 1
|
183
|
+
Total Views: 55
|
184
|
+
Total DisplayList: 51,03 kB
|
183
185
|
EOS
|
184
186
|
|
185
|
-
SAMPLE_GFXINFO_6 =
|
186
|
-
Applications Graphics Acceleration Info:
|
187
|
-
Uptime: 9658130 Realtime: 9658130
|
188
|
-
|
189
|
-
** Graphics info for pid 9702 [com.android.chrome] **
|
190
|
-
|
191
|
-
Stats since: 9656484850794ns
|
192
|
-
Total frames rendered: 3
|
193
|
-
Janky frames: 2 (66.67%)
|
194
|
-
90th percentile: 101ms
|
195
|
-
95th percentile: 101ms
|
196
|
-
99th percentile: 101ms
|
197
|
-
Number Missed Vsync: 2
|
198
|
-
Number High input latency: 0
|
199
|
-
Number Slow UI thread: 2
|
200
|
-
Number Slow bitmap uploads: 0
|
201
|
-
Number Slow issue draw commands: 1
|
202
|
-
|
203
|
-
Caches:
|
204
|
-
Current memory usage / total memory usage (bytes):
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
Other:
|
218
|
-
|
219
|
-
Total memory usage:
|
220
|
-
|
221
|
-
|
222
|
-
Profile data in ms:
|
223
|
-
|
224
|
-
|
225
|
-
Stats since: 9656484850794ns
|
226
|
-
Total frames rendered: 3
|
227
|
-
Janky frames: 2 (66.67%)
|
228
|
-
90th percentile: 101ms
|
229
|
-
95th percentile: 101ms
|
230
|
-
99th percentile: 101ms
|
231
|
-
Number Missed Vsync: 2
|
232
|
-
Number High input latency: 0
|
233
|
-
Number Slow UI thread: 2
|
234
|
-
Number Slow bitmap uploads: 0
|
235
|
-
Number Slow issue draw commands: 1
|
236
|
-
|
237
|
-
View hierarchy:
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
Total ViewRootImpl: 1
|
244
|
-
Total Views: 21
|
245
|
-
Total DisplayList: 31.36 kB
|
187
|
+
SAMPLE_GFXINFO_6 = <<~EOS
|
188
|
+
Applications Graphics Acceleration Info:
|
189
|
+
Uptime: 9658130 Realtime: 9658130
|
190
|
+
|
191
|
+
** Graphics info for pid 9702 [com.android.chrome] **
|
192
|
+
|
193
|
+
Stats since: 9656484850794ns
|
194
|
+
Total frames rendered: 3
|
195
|
+
Janky frames: 2 (66.67%)
|
196
|
+
90th percentile: 101ms
|
197
|
+
95th percentile: 101ms
|
198
|
+
99th percentile: 101ms
|
199
|
+
Number Missed Vsync: 2
|
200
|
+
Number High input latency: 0
|
201
|
+
Number Slow UI thread: 2
|
202
|
+
Number Slow bitmap uploads: 0
|
203
|
+
Number Slow issue draw commands: 1
|
204
|
+
|
205
|
+
Caches:
|
206
|
+
Current memory usage / total memory usage (bytes):
|
207
|
+
TextureCache 878276 / 75497472
|
208
|
+
LayerCache 0 / 50331648 (numLayers = 0)
|
209
|
+
Layers total 0 (numLayers = 0)
|
210
|
+
RenderBufferCache 0 / 8388608
|
211
|
+
GradientCache 0 / 1048576
|
212
|
+
PathCache 0 / 33554432
|
213
|
+
TessellationCache 0 / 1048576
|
214
|
+
TextDropShadowCache 0 / 6291456
|
215
|
+
PatchCache 0 / 131072
|
216
|
+
FontRenderer 0 A8 1048576 / 1048576
|
217
|
+
FontRenderer 0 RGBA 0 / 0
|
218
|
+
FontRenderer 0 total 1048576 / 1048576
|
219
|
+
Other:
|
220
|
+
FboCache 0 / 0
|
221
|
+
Total memory usage:
|
222
|
+
1926852 bytes, 1.84 MB
|
223
|
+
|
224
|
+
Profile data in ms:
|
225
|
+
|
226
|
+
com.android.chrome/org.chromium.chrome.browser.firstrun.FirstRunActivityStaging/android.view.ViewRootImpl@6b40547 (visibility=0)
|
227
|
+
Stats since: 9656484850794ns
|
228
|
+
Total frames rendered: 3
|
229
|
+
Janky frames: 2 (66.67%)
|
230
|
+
90th percentile: 101ms
|
231
|
+
95th percentile: 101ms
|
232
|
+
99th percentile: 101ms
|
233
|
+
Number Missed Vsync: 2
|
234
|
+
Number High input latency: 0
|
235
|
+
Number Slow UI thread: 2
|
236
|
+
Number Slow bitmap uploads: 0
|
237
|
+
Number Slow issue draw commands: 1
|
238
|
+
|
239
|
+
View hierarchy:
|
240
|
+
|
241
|
+
com.android.chrome/org.chromium.chrome.browser.firstrun.FirstRunActivityStaging/android.view.ViewRootImpl@6b40547
|
242
|
+
21 views, 31.36 kB of display lists
|
243
|
+
|
244
|
+
|
245
|
+
Total ViewRootImpl: 1
|
246
|
+
Total Views: 21
|
247
|
+
Total DisplayList: 31.36 kB
|
246
248
|
EOS
|
247
249
|
|
248
250
|
class GfxinfoTest < Test::Unit::TestCase
|
249
|
-
|
250
251
|
def setup
|
251
|
-
@gfx = Droid::Monitor::Gfxinfo.new(
|
252
|
+
@gfx = Droid::Monitor::Gfxinfo.new(package: 'com.android.chrome')
|
252
253
|
end
|
253
254
|
|
254
255
|
def teardown
|
@@ -259,26 +260,26 @@ class GfxinfoTest < Test::Unit::TestCase
|
|
259
260
|
assert_instance_of(Droid::Monitor::Gfxinfo, @gfx)
|
260
261
|
|
261
262
|
@gfx.api_level = 18
|
262
|
-
assert_equal(
|
263
|
-
assert_equal(
|
263
|
+
assert_equal('com.android.chrome', @gfx.package)
|
264
|
+
assert_equal('', @gfx.device_serial)
|
264
265
|
assert_equal(18, @gfx.api_level)
|
265
266
|
assert_equal([], @gfx.gfxinfo_usage)
|
266
267
|
end
|
267
268
|
|
268
269
|
def test_dump_gfxinfo_usage
|
269
|
-
expected = %w
|
270
|
+
expected = %w[654464 bytes, 0.62 MB 41 views, 1.36 kB of display lists, 191 frames rendered] # rubocop:disable Lint/PercentStringArray
|
270
271
|
|
271
272
|
assert_equal(expected, @gfx.dump_gfxinfo_usage(SAMPLE_GFXINFO))
|
272
273
|
end
|
273
274
|
|
274
|
-
def test_dump_gfxinfo_usage_for_API21
|
275
|
-
expected = %w
|
275
|
+
def test_dump_gfxinfo_usage_for_API21 # rubocop:disable Naming/MethodName
|
276
|
+
expected = %w[1194548 bytes, 1.14 MB 55 views, 51,03 kB of display lists] # rubocop:disable Lint/PercentStringArray
|
276
277
|
|
277
278
|
assert_equal(expected, @gfx.dump_gfxinfo_usage(SAMPLE_GFXINFO_5))
|
278
279
|
end
|
279
280
|
|
280
|
-
def test_dump_gfxinfo_usage_for_API23
|
281
|
-
expected = %w(1926852 bytes, 1.84 MB 21 views, 31.36 kB of display lists Total frames rendered: 3 Janky frames: 2 (66.67%))
|
281
|
+
def test_dump_gfxinfo_usage_for_API23 # rubocop:disable Naming/MethodName
|
282
|
+
expected = %w(1926852 bytes, 1.84 MB 21 views, 31.36 kB of display lists Total frames rendered: 3 Janky frames: 2 (66.67%)) # rubocop:disable Lint/PercentStringArray
|
282
283
|
@gfx.api_level = 23
|
283
284
|
assert_equal(expected, @gfx.dump_gfxinfo_usage(SAMPLE_GFXINFO_6))
|
284
285
|
end
|
@@ -288,111 +289,108 @@ class GfxinfoTest < Test::Unit::TestCase
|
|
288
289
|
end
|
289
290
|
|
290
291
|
def test_transfer_from_hash_empty_to_json
|
291
|
-
dummy_array = %w
|
292
|
+
dummy_array = %w[13:43:32.556]
|
292
293
|
|
293
294
|
@gfx.store_gfxinfo_usage(dummy_array)
|
294
|
-
expected_json =
|
295
|
-
|
295
|
+
expected_json = '[{"view":0,"display_lists_kb":0,"frames_rendered":0,' \
|
296
|
+
"\"total_memory\":0,\"time\":\"#{@gfx.gfxinfo_usage[0][:time]}\"}]"
|
296
297
|
assert_equal(expected_json, JSON.generate(@gfx.gfxinfo_usage))
|
297
298
|
end
|
298
299
|
|
299
300
|
def test_transfer_from_hash_correct_to_json
|
300
|
-
dummy_array = %w
|
301
|
+
dummy_array = %w[5781894 bytes 5.51 MB 465 views 38.00 kB of display lists 354 frames rendered 13:43:32.556]
|
301
302
|
|
302
303
|
@gfx.store_gfxinfo_usage(dummy_array)
|
303
|
-
expected_json =
|
304
|
-
|
304
|
+
expected_json = '[{"view":465,"display_lists_kb":38.0,"frames_rendered":354,' \
|
305
|
+
"\"total_memory\":5646.38,\"time\":\"#{@gfx.gfxinfo_usage[0][:time]}\"}]"
|
305
306
|
assert_equal(expected_json, JSON.generate(@gfx.gfxinfo_usage))
|
306
307
|
end
|
307
308
|
|
308
309
|
def test_convert_to_google_data_api_format_gfx_one
|
309
|
-
dummy_array = %w
|
310
|
+
dummy_array = %w[5781894 bytes 5.51 MB 465 views 38.00 kB of display lists 354 frames rendered 13:43:32.556]
|
310
311
|
|
311
312
|
@gfx.store_gfxinfo_usage(dummy_array)
|
312
|
-
expected_json =
|
313
|
-
|
314
|
-
|
313
|
+
expected_json = '{"cols":[{"label":"time","type":"string"},{"label":"view","type":"number"},' \
|
314
|
+
"{\"label\":\"display_lists_kb\",\"type\":\"number\"}],\"rows\":[{\"c\":[{\"v\":\"#{@gfx.gfxinfo_usage[0][:time]}\"}," \
|
315
|
+
'{"v":465},{"v":38.0}]}]}'
|
315
316
|
assert_equal(@gfx.export_as_google_api_format_gfx(@gfx.gfxinfo_usage), expected_json)
|
316
317
|
end
|
317
318
|
|
318
319
|
def test_convert_to_google_data_api_format_mem_one
|
319
|
-
dummy_array = %w
|
320
|
+
dummy_array = %w[5781894 bytes 5.51 MB 465 views 38.00 kB of display lists 354 frames rendered 13:43:32.556]
|
320
321
|
|
321
322
|
@gfx.store_gfxinfo_usage(dummy_array)
|
322
|
-
expected_json =
|
323
|
-
|
324
|
-
|
323
|
+
expected_json = '{"cols":[{"label":"time","type":"string"},' \
|
324
|
+
"{\"label\":\"total_memory\",\"type\":\"number\"}],\"rows\":[{\"c\":[{\"v\":\"#{@gfx.gfxinfo_usage[0][:time]}\"}," \
|
325
|
+
'{"v":5646.38}]}]}'
|
325
326
|
assert_equal(@gfx.export_as_google_api_format_mem(@gfx.gfxinfo_usage), expected_json)
|
326
327
|
end
|
327
328
|
|
328
329
|
def test_convert_to_google_data_api_format_frame_one
|
329
|
-
dummy_array = %w
|
330
|
+
dummy_array = %w[5781894 bytes 5.51 MB 465 views 38.00 kB of display lists 354 frames rendered 13:43:32.556]
|
330
331
|
|
331
332
|
@gfx.store_gfxinfo_usage(dummy_array)
|
332
|
-
expected_json =
|
333
|
-
|
334
|
-
|
333
|
+
expected_json = '{"cols":[{"label":"time","type":"string"},' \
|
334
|
+
"{\"label\":\"frames_rendered\",\"type\":\"number\"}],\"rows\":[{\"c\":[{\"v\":\"#{@gfx.gfxinfo_usage[0][:time]}\"}," \
|
335
|
+
'{"v":354}]}]}'
|
335
336
|
assert_equal(@gfx.export_as_google_api_format_frame(@gfx.gfxinfo_usage), expected_json)
|
336
337
|
end
|
337
338
|
|
338
339
|
def test_convert_to_google_data_api_format_frame_one_api_23
|
339
|
-
dummy_array = %w(1926852 bytes
|
340
|
+
dummy_array = %w(1926852 bytes 1.84 MB 21 views 31.36 kB of display lists Total frames rendered: 3 Janky frames: 2 (66.67%))
|
340
341
|
@gfx.api_level = 23
|
341
342
|
|
342
343
|
@gfx.store_gfxinfo_usage(dummy_array)
|
343
|
-
expected_json =
|
344
|
-
|
345
|
-
|
344
|
+
expected_json = '{"cols":[{"label":"time","type":"string"},' \
|
345
|
+
'{"label":"frames_rendered","type":"number"},{"label":"janky_frame","type":"number"}],' \
|
346
|
+
"\"rows\":[{\"c\":[{\"v\":\"#{@gfx.gfxinfo_usage[0][:time]}\"},{\"v\":3},{\"v\":2}]}]}"
|
346
347
|
assert_equal(@gfx.export_as_google_api_format_frame(@gfx.gfxinfo_usage), expected_json)
|
347
348
|
end
|
348
349
|
|
349
|
-
|
350
350
|
def test_convert_to_google_data_api_format_gfx_many
|
351
|
-
dummy_array = %w
|
351
|
+
dummy_array = %w[5781894 bytes 5.51 MB 465 views 38.00 kB of display lists 354 frames rendered 13:43:32.556]
|
352
352
|
|
353
353
|
@gfx.store_gfxinfo_usage(dummy_array)
|
354
354
|
@gfx.store_gfxinfo_usage(dummy_array)
|
355
|
-
expected_json =
|
356
|
-
|
357
|
-
|
358
|
-
|
355
|
+
expected_json = '{"cols":[{"label":"time","type":"string"},' \
|
356
|
+
'{"label":"view","type":"number"},{"label":"display_lists_kb","type":"number"}],' \
|
357
|
+
"\"rows\":[{\"c\":[{\"v\":\"#{@gfx.gfxinfo_usage[1][:time]}\"},{\"v\":465},{\"v\":38.0}]}," \
|
358
|
+
"{\"c\":[{\"v\":\"#{@gfx.gfxinfo_usage[1][:time]}\"},{\"v\":465},{\"v\":38.0}]}]}"
|
359
359
|
assert_equal(@gfx.export_as_google_api_format_gfx(@gfx.gfxinfo_usage), expected_json)
|
360
360
|
end
|
361
361
|
|
362
362
|
def test_convert_to_google_data_api_format_mem_many
|
363
|
-
dummy_array = %w
|
363
|
+
dummy_array = %w[5781894 bytes 5.51 MB 465 views 38.00 kB of display lists 354 frames rendered 13:43:32.556]
|
364
364
|
|
365
365
|
@gfx.store_gfxinfo_usage(dummy_array)
|
366
366
|
@gfx.store_gfxinfo_usage(dummy_array)
|
367
|
-
expected_json =
|
368
|
-
|
369
|
-
|
367
|
+
expected_json = '{"cols":[{"label":"time","type":"string"},' \
|
368
|
+
"{\"label\":\"total_memory\",\"type\":\"number\"}],\"rows\":[{\"c\":[{\"v\":\"#{@gfx.gfxinfo_usage[1][:time]}\"}," \
|
369
|
+
"{\"v\":5646.38}]},{\"c\":[{\"v\":\"#{@gfx.gfxinfo_usage[1][:time]}\"},{\"v\":5646.38}]}]}"
|
370
370
|
assert_equal(@gfx.export_as_google_api_format_mem(@gfx.gfxinfo_usage), expected_json)
|
371
371
|
end
|
372
372
|
|
373
373
|
def test_convert_to_google_data_api_format_frame_many
|
374
|
-
dummy_array = %w
|
374
|
+
dummy_array = %w[5781894 bytes 5.51 MB 465 views 38.00 kB of display lists 354 frames rendered 13:43:32.556]
|
375
375
|
|
376
376
|
@gfx.store_gfxinfo_usage(dummy_array)
|
377
377
|
@gfx.store_gfxinfo_usage(dummy_array)
|
378
|
-
expected_json =
|
379
|
-
|
380
|
-
|
378
|
+
expected_json = '{"cols":[{"label":"time","type":"string"},' \
|
379
|
+
"{\"label\":\"frames_rendered\",\"type\":\"number\"}],\"rows\":[{\"c\":[{\"v\":\"#{@gfx.gfxinfo_usage[1][:time]}\"}," \
|
380
|
+
"{\"v\":354}]},{\"c\":[{\"v\":\"#{@gfx.gfxinfo_usage[1][:time]}\"},{\"v\":354}]}]}"
|
381
381
|
assert_equal(@gfx.export_as_google_api_format_frame(@gfx.gfxinfo_usage), expected_json)
|
382
382
|
end
|
383
383
|
|
384
384
|
def test_convert_to_google_data_api_format_frame_many_api_23
|
385
|
-
dummy_array = %w(1926852 bytes
|
385
|
+
dummy_array = %w(1926852 bytes 1.84 MB 21 views 31.36 kB of display lists Total frames rendered: 3 Janky frames: 2 (66.67%))
|
386
386
|
@gfx.api_level = 23
|
387
387
|
|
388
388
|
@gfx.store_gfxinfo_usage(dummy_array)
|
389
389
|
@gfx.store_gfxinfo_usage(dummy_array)
|
390
|
-
expected_json =
|
391
|
-
|
392
|
-
|
393
|
-
|
390
|
+
expected_json = '{"cols":[{"label":"time","type":"string"},' \
|
391
|
+
'{"label":"frames_rendered","type":"number"},{"label":"janky_frame","type":"number"}],' \
|
392
|
+
"\"rows\":[{\"c\":[{\"v\":\"#{@gfx.gfxinfo_usage[1][:time]}\"}," \
|
393
|
+
"{\"v\":3},{\"v\":2}]},{\"c\":[{\"v\":\"#{@gfx.gfxinfo_usage[1][:time]}\"},{\"v\":3},{\"v\":2}]}]}"
|
394
394
|
assert_equal(@gfx.export_as_google_api_format_frame(@gfx.gfxinfo_usage), expected_json)
|
395
395
|
end
|
396
|
-
|
397
|
-
|
398
396
|
end
|