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
data/test/memory_test.rb
CHANGED
@@ -1,153 +1,154 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'test/unit'
|
2
4
|
|
3
5
|
require './lib/droid/monitor/memory'
|
4
6
|
|
5
|
-
SAMPLE_DATA_43 =
|
6
|
-
Applications Memory Usage (kB):
|
7
|
-
Uptime: 69627589 Realtime: 376894346
|
8
|
-
|
9
|
-
** MEMINFO in pid 29607 [com.sample.package] **
|
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
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
7
|
+
SAMPLE_DATA_43 = <<~EOS
|
8
|
+
Applications Memory Usage (kB):
|
9
|
+
Uptime: 69627589 Realtime: 376894346
|
10
|
+
|
11
|
+
** MEMINFO in pid 29607 [com.sample.package] **
|
12
|
+
Shared Private Heap Heap Heap
|
13
|
+
Pss Dirty Dirty Size Alloc Free
|
14
|
+
------ ------ ------ ------ ------ ------
|
15
|
+
Native 24 8 24 11296 7927 408
|
16
|
+
Dalvik 11976 4696 11916 13388 7454 5934
|
17
|
+
Cursor 0 0 0
|
18
|
+
Ashmem 0 0 0
|
19
|
+
Other dev 56 56 0
|
20
|
+
.so mmap 2507 2028 620
|
21
|
+
.jar mmap 0 0 0
|
22
|
+
.apk mmap 49 0 0
|
23
|
+
.ttf mmap 3 0 0
|
24
|
+
.dex mmap 628 0 12
|
25
|
+
Other mmap 592 16 296
|
26
|
+
Unknown 13094 504 13092
|
27
|
+
TOTAL 28929 7308 25960 24684 15381 6342
|
28
|
+
|
29
|
+
Objects
|
30
|
+
Views: 115 ViewRootImpl: 1
|
31
|
+
AppContexts: 6 Activities: 1
|
32
|
+
Assets: 6 AssetManagers: 6
|
33
|
+
Local Binders: 15 Proxy Binders: 23
|
34
|
+
Death Recipients: 0
|
35
|
+
OpenSSL Sockets: 3
|
36
|
+
|
37
|
+
SQL
|
38
|
+
MEMORY_USED: 462
|
39
|
+
PAGECACHE_OVERFLOW: 83 MALLOC_SIZE: 62
|
40
|
+
|
41
|
+
DATABASES
|
42
|
+
pgsz dbsz Lookaside(b) cache Dbname
|
43
|
+
4 48 37 11/22/4 /data/data/com.sample.package/databases/sample.db
|
42
44
|
EOS
|
43
45
|
|
44
|
-
SAMPLE_DATA_44 =
|
45
|
-
Applications Memory Usage (kB):
|
46
|
-
Uptime: 76485937 Realtime: 238763696
|
47
|
-
|
48
|
-
** MEMINFO in pid 30125 [com.sample.package] **
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
46
|
+
SAMPLE_DATA_44 = <<~EOS
|
47
|
+
Applications Memory Usage (kB):
|
48
|
+
Uptime: 76485937 Realtime: 238763696
|
49
|
+
|
50
|
+
** MEMINFO in pid 30125 [com.sample.package] **
|
51
|
+
Pss Private Private Swapped Heap Heap Heap
|
52
|
+
Total Dirty Clean Dirty Size Alloc Free
|
53
|
+
------ ------ ------ ------ ------ ------ ------
|
54
|
+
Native Heap 0 0 0 0 8948 8520 271
|
55
|
+
Dalvik Heap 23195 22764 0 0 31772 29998 1774
|
56
|
+
Dalvik Other 3875 3820 0 0
|
57
|
+
Stack 272 272 0 0
|
58
|
+
Cursor 4 4 0 0
|
59
|
+
Other dev 4014 3136 20 0
|
60
|
+
.so mmap 1429 1028 12 0
|
61
|
+
.apk mmap 712 0 368 0
|
62
|
+
.ttf mmap 594 0 308 0
|
63
|
+
.dex mmap 5099 44 4648 0
|
64
|
+
Other mmap 40 4 16 0
|
65
|
+
Unknown 5329 5324 0 0
|
66
|
+
TOTAL 44563 36396 5372 0 40720 38518 2045
|
67
|
+
|
68
|
+
Objects
|
69
|
+
Views: 690 ViewRootImpl: 1
|
70
|
+
AppContexts: 3 Activities: 1
|
71
|
+
Assets: 4 AssetManagers: 4
|
72
|
+
Local Binders: 15 Proxy Binders: 23
|
73
|
+
Death Recipients: 1
|
74
|
+
OpenSSL Sockets: 7
|
75
|
+
|
76
|
+
SQL
|
77
|
+
MEMORY_USED: 329
|
78
|
+
PAGECACHE_OVERFLOW: 82 MALLOC_SIZE: 62
|
79
|
+
|
80
|
+
DATABASES
|
81
|
+
pgsz dbsz Lookaside(b) cache Dbname
|
82
|
+
4 20 58 21/26/9 /data/data/com.sample.package/databases/sample.db
|
83
|
+
Asset Allocations
|
84
|
+
zip:/data/app/com.sample.package.apk:/assets/sample.ttf: 132K
|
83
85
|
EOS
|
84
86
|
|
85
|
-
SAMPLE_DATA_60 =
|
86
|
-
Applications Memory Usage (kB):
|
87
|
-
Uptime: 166891747 Realtime: 445776902
|
88
|
-
|
89
|
-
** MEMINFO in pid 22861 [com.sample.package] **
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
87
|
+
SAMPLE_DATA_60 = <<~EOS
|
88
|
+
Applications Memory Usage (kB):
|
89
|
+
Uptime: 166891747 Realtime: 445776902
|
90
|
+
|
91
|
+
** MEMINFO in pid 22861 [com.sample.package] **
|
92
|
+
Pss Private Private Swapped Heap Heap Heap
|
93
|
+
Total Dirty Clean Dirty Size Alloc Free
|
94
|
+
------ ------ ------ ------ ------ ------ ------
|
95
|
+
Native Heap 24501 24240 0 13968 60416 56957 3458
|
96
|
+
Dalvik Heap 16434 16400 0 484 34525 31331 3194
|
97
|
+
Dalvik Other 14130 14108 0 5072
|
98
|
+
Stack 1316 1316 0 0
|
99
|
+
Ashmem 207 112 0 0
|
100
|
+
Other dev 9 0 8 0
|
101
|
+
.so mmap 18500 444 12540 2504
|
102
|
+
.apk mmap 1964 0 1520 0
|
103
|
+
.ttf mmap 643 0 580 0
|
104
|
+
.dex mmap 18523 8 18156 4
|
105
|
+
.oat mmap 2657 0 500 0
|
106
|
+
.art mmap 1881 1560 16 92
|
107
|
+
Other mmap 1725 12 1020 4
|
108
|
+
EGL mtrack 7962 7962 0 0
|
109
|
+
GL mtrack 32867 32867 0 0
|
110
|
+
Unknown 2672 2672 0 108
|
111
|
+
TOTAL 145991 101701 34340 22236 94941 88288 6652
|
112
|
+
|
113
|
+
App Summary
|
114
|
+
Pss(KB)
|
115
|
+
------
|
116
|
+
Java Heap: 17976
|
117
|
+
Native Heap: 24240
|
118
|
+
Code: 33748
|
119
|
+
Stack: 1316
|
120
|
+
Graphics: 40829
|
121
|
+
Private Other: 17932
|
122
|
+
System: 9950
|
123
|
+
|
124
|
+
TOTAL: 145991 TOTAL SWAP (KB): 22236
|
125
|
+
|
126
|
+
Objects
|
127
|
+
Views: 553 ViewRootImpl: 1
|
128
|
+
AppContexts: 2 Activities: 1
|
129
|
+
Assets: 5 AssetManagers: 2
|
130
|
+
Local Binders: 37 Proxy Binders: 29
|
131
|
+
Parcel memory: 11 Parcel count: 46
|
132
|
+
Death Recipients: 2 OpenSSL Sockets: 10
|
133
|
+
|
134
|
+
SQL
|
135
|
+
MEMORY_USED: 468
|
136
|
+
PAGECACHE_OVERFLOW: 113 MALLOC_SIZE: 62
|
137
|
+
|
138
|
+
DATABASES
|
139
|
+
pgsz dbsz Lookaside(b) cache Dbname
|
140
|
+
4 20 25 36/17/3 /data/data/com.sample.package/databases/sample1.db
|
141
|
+
4 28 62 17/26/8 /data/data/com.sample.package/databases/sample2.db
|
142
|
+
4 104 19 6/21/3 /data/data/com.sample.package/databases/sample3.db
|
143
|
+
4 104 22 2/18/3 /data/data/com.sample.package/databases/sample4.db
|
144
|
+
|
145
|
+
Asset Allocations
|
146
|
+
zip:/data/app/com.sample.package/base.apk:/assets/sample.ttf: 76K
|
145
147
|
EOS
|
146
148
|
|
147
149
|
class MemoryTest < Test::Unit::TestCase
|
148
|
-
|
149
150
|
def setup
|
150
|
-
@memory = Droid::Monitor::Memory.new(
|
151
|
+
@memory = Droid::Monitor::Memory.new(package: 'com.android.chrome')
|
151
152
|
end
|
152
153
|
|
153
154
|
def teardown
|
@@ -158,8 +159,8 @@ class MemoryTest < Test::Unit::TestCase
|
|
158
159
|
assert_instance_of(Droid::Monitor::Memory, @memory)
|
159
160
|
|
160
161
|
@memory.api_level = 19
|
161
|
-
assert_equal(
|
162
|
-
assert_equal(
|
162
|
+
assert_equal('com.android.chrome', @memory.package)
|
163
|
+
assert_equal('', @memory.device_serial)
|
163
164
|
assert_equal(19, @memory.api_level)
|
164
165
|
assert_equal([], @memory.memory_usage)
|
165
166
|
assert_equal([], @memory.memory_detail_usage)
|
@@ -170,48 +171,47 @@ class MemoryTest < Test::Unit::TestCase
|
|
170
171
|
end
|
171
172
|
|
172
173
|
def test_dump_memory_usage_under_api_level18
|
173
|
-
expected = %w
|
174
|
-
assert_equal(expected
|
174
|
+
expected = %w[Uptime: 69627589 Realtime: 376894346]
|
175
|
+
assert_equal(expected, @memory.dump_memory_usage(SAMPLE_DATA_43))
|
175
176
|
end
|
176
177
|
|
177
178
|
def test_dump_memory_usage_over_api_level18
|
178
|
-
expected = %w
|
179
|
-
assert_equal(expected
|
179
|
+
expected = %w[Uptime: 76485937 Realtime: 238763696]
|
180
|
+
assert_equal(expected, @memory.dump_memory_usage(SAMPLE_DATA_44))
|
180
181
|
end
|
181
182
|
|
182
183
|
def test_dump_memory_detail_usage_under_api_level18
|
183
|
-
expected = %w
|
184
|
-
assert_equal(expected
|
184
|
+
expected = %w[TOTAL 28929 7308 25960 24684 15381 6342]
|
185
|
+
assert_equal(expected, @memory.dump_memory_details_usage(SAMPLE_DATA_43))
|
185
186
|
end
|
186
187
|
|
187
188
|
def test_dump_memory_detail_usage_over_api_level18
|
188
|
-
expected = %w
|
189
|
-
assert_equal(expected
|
189
|
+
expected = %w[TOTAL 44563 36396 5372 0 40720 38518 2045]
|
190
|
+
assert_equal(expected, @memory.dump_memory_details_usage(SAMPLE_DATA_44))
|
190
191
|
end
|
191
192
|
|
192
193
|
def test_memory_usage
|
193
194
|
@memory.api_level = 18
|
194
195
|
|
195
196
|
expected = {
|
196
|
-
realtime:
|
197
|
-
uptime:
|
197
|
+
realtime: 376_894_346,
|
198
|
+
uptime: 69_627_589
|
198
199
|
}
|
199
200
|
|
200
201
|
result = @memory.transfer_total_memory_to_hash(@memory.dump_memory_usage(SAMPLE_DATA_43))
|
201
202
|
assert_equal(result, expected)
|
202
203
|
end
|
203
204
|
|
204
|
-
|
205
205
|
def test_memory_details_api_level18
|
206
206
|
@memory.api_level = 18
|
207
207
|
|
208
208
|
expected = {
|
209
|
-
pss_total:
|
209
|
+
pss_total: 28_929,
|
210
210
|
shared_dirty: 7308,
|
211
|
-
private_dirty:
|
212
|
-
heap_size:
|
213
|
-
heap_alloc:
|
214
|
-
heap_free: 6342
|
211
|
+
private_dirty: 25_960,
|
212
|
+
heap_size: 24_684,
|
213
|
+
heap_alloc: 15_381,
|
214
|
+
heap_free: 6342
|
215
215
|
}
|
216
216
|
|
217
217
|
result = @memory.transfer_total_memory_details_to_hash(@memory.dump_memory_details_usage(SAMPLE_DATA_43))
|
@@ -222,13 +222,13 @@ class MemoryTest < Test::Unit::TestCase
|
|
222
222
|
@memory.api_level = 19
|
223
223
|
|
224
224
|
expected = {
|
225
|
-
pss_total:
|
226
|
-
private_dirty:
|
225
|
+
pss_total: 44_563,
|
226
|
+
private_dirty: 36_396,
|
227
227
|
private_clean: 5372,
|
228
228
|
swapped_dirty: 0,
|
229
|
-
heap_size:
|
230
|
-
heap_alloc:
|
231
|
-
heap_free: 2045
|
229
|
+
heap_size: 40_720,
|
230
|
+
heap_alloc: 38_518,
|
231
|
+
heap_free: 2045
|
232
232
|
}
|
233
233
|
result = @memory.transfer_total_memory_details_to_hash(@memory.dump_memory_details_usage(SAMPLE_DATA_44))
|
234
234
|
assert_equal(result, expected)
|
@@ -238,13 +238,13 @@ class MemoryTest < Test::Unit::TestCase
|
|
238
238
|
@memory.api_level = 23
|
239
239
|
|
240
240
|
expected = {
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
241
|
+
pss_total: 145_991,
|
242
|
+
private_dirty: 101_701,
|
243
|
+
private_clean: 34_340,
|
244
|
+
swapped_dirty: 22_236,
|
245
|
+
heap_size: 94_941,
|
246
|
+
heap_alloc: 88_288,
|
247
|
+
heap_free: 6652
|
248
248
|
}
|
249
249
|
result = @memory.transfer_total_memory_details_to_hash(@memory.dump_memory_details_usage(SAMPLE_DATA_60))
|
250
250
|
assert_equal(result, expected)
|
@@ -253,7 +253,7 @@ class MemoryTest < Test::Unit::TestCase
|
|
253
253
|
def test_transfer_from_hash_empty_to_json_memory_api_level18
|
254
254
|
@memory.api_level = 18
|
255
255
|
|
256
|
-
dummy_array = %w
|
256
|
+
dummy_array = %w[]
|
257
257
|
|
258
258
|
@memory.store_memory_usage(dummy_array)
|
259
259
|
|
@@ -264,12 +264,12 @@ class MemoryTest < Test::Unit::TestCase
|
|
264
264
|
def test_transfer_from_hash_empty_to_json_memory_details_api_level18
|
265
265
|
@memory.api_level = 18
|
266
266
|
|
267
|
-
dummy_array = %w
|
267
|
+
dummy_array = %w[]
|
268
268
|
|
269
269
|
@memory.store_memory_details_usage(dummy_array)
|
270
270
|
|
271
|
-
expected_json =
|
272
|
-
|
271
|
+
expected_json = '[{"pss_total":0,"shared_dirty":0,"private_dirty":0,' \
|
272
|
+
"\"heap_size\":0,\"heap_alloc\":0,\"heap_free\":0,\"time\":\"#{@memory.memory_detail_usage[0][:time]}\"}]"
|
273
273
|
assert_equal(expected_json, JSON.generate(@memory.memory_detail_usage))
|
274
274
|
end
|
275
275
|
|
@@ -281,36 +281,35 @@ class MemoryTest < Test::Unit::TestCase
|
|
281
281
|
@memory.store_memory_details_usage(result)
|
282
282
|
@memory.store_memory_details_usage(result)
|
283
283
|
|
284
|
-
expected_json =
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
284
|
+
expected_json = '[{"pss_total":28929,"shared_dirty":7308,"private_dirty":25960,' \
|
285
|
+
'"heap_size":24684,"heap_alloc":15381,"heap_free":6342,' \
|
286
|
+
"\"time\":\"#{@memory.memory_detail_usage[0][:time]}\"}," \
|
287
|
+
'{"pss_total":28929,"shared_dirty":7308,"private_dirty":25960,' \
|
288
|
+
'"heap_size":24684,"heap_alloc":15381,"heap_free":6342,' \
|
289
|
+
"\"time\":\"#{@memory.memory_detail_usage[1][:time]}\"}]"
|
290
290
|
|
291
291
|
assert_equal(expected_json, JSON.generate(@memory.memory_detail_usage))
|
292
292
|
|
293
|
-
expected_google =
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
293
|
+
expected_google = '{"cols":[{"label":"time","type":"string"},{"label":"pss_total",' \
|
294
|
+
'"type":"number"},{"label":"shared_dirty","type":"number"},{"label":"private_dirty",' \
|
295
|
+
'"type":"number"},{"label":"heap_size","type":"number"},{"label":"heap_alloc",' \
|
296
|
+
'"type":"number"},{"label":"heap_free","type":"number"}],' \
|
297
|
+
"\"rows\":[{\"c\":[{\"v\":\"#{@memory.memory_detail_usage[0][:time]}\"},{\"v\":28929}," \
|
298
|
+
'{"v":7308},{"v":25960},{"v":24684},{"v":15381},{"v":6342}]},' \
|
299
|
+
"{\"c\":[{\"v\":\"#{@memory.memory_detail_usage[1][:time]}\"},{\"v\":28929},{\"v\":7308},{\"v\":25960}," \
|
300
|
+
'{"v":24684},{"v":15381},{"v":6342}]}]}'
|
301
301
|
assert_equal(expected_google, @memory.export_as_google_api_format(@memory.memory_detail_usage))
|
302
302
|
end
|
303
303
|
|
304
|
-
|
305
304
|
def test_transfer_from_hash_empty_to_json_memory_details_api_level19
|
306
305
|
@memory.api_level = 19
|
307
306
|
|
308
|
-
dummy_array = %w
|
307
|
+
dummy_array = %w[13:43:32.556]
|
309
308
|
|
310
309
|
@memory.store_memory_details_usage(dummy_array)
|
311
|
-
expected_json =
|
312
|
-
|
313
|
-
|
310
|
+
expected_json = '[{"pss_total":0,"private_dirty":0,"private_clean":0,' \
|
311
|
+
'"swapped_dirty":0,"heap_size":0,"heap_alloc":0,"heap_free":0,' \
|
312
|
+
"\"time\":\"#{@memory.memory_detail_usage[0][:time]}\"}]"
|
314
313
|
assert_equal(expected_json, JSON.generate(@memory.memory_detail_usage))
|
315
314
|
end
|
316
315
|
|
@@ -322,26 +321,25 @@ class MemoryTest < Test::Unit::TestCase
|
|
322
321
|
@memory.store_memory_details_usage(result)
|
323
322
|
@memory.store_memory_details_usage(result)
|
324
323
|
|
325
|
-
expected_json =
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
324
|
+
expected_json = '[{"pss_total":44563,"private_dirty":36396,"private_clean":5372,"swapped_dirty":0,' \
|
325
|
+
'"heap_size":40720,"heap_alloc":38518,"heap_free":2045,' \
|
326
|
+
"\"time\":\"#{@memory.memory_detail_usage[0][:time]}\"}," \
|
327
|
+
'{"pss_total":44563,"private_dirty":36396,' \
|
328
|
+
'"private_clean":5372,"swapped_dirty":0,' \
|
329
|
+
'"heap_size":40720,"heap_alloc":38518,"heap_free":2045,' \
|
330
|
+
"\"time\":\"#{@memory.memory_detail_usage[1][:time]}\"}]"
|
332
331
|
|
333
332
|
assert_equal(expected_json, JSON.generate(@memory.memory_detail_usage))
|
334
333
|
|
335
|
-
expected_google =
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
334
|
+
expected_google = '{"cols":[{"label":"time","type":"string"},{"label":"pss_total",' \
|
335
|
+
'"type":"number"},{"label":"private_dirty","type":"number"},{"label":"private_clean",' \
|
336
|
+
'"type":"number"},{"label":"swapped_dirty","type":"number"},{"label":"heap_size",' \
|
337
|
+
'"type":"number"},{"label":"heap_alloc","type":"number"},{"label":"heap_free",' \
|
338
|
+
"\"type\":\"number\"}],\"rows\":[{\"c\":[{\"v\":\"#{@memory.memory_detail_usage[0][:time]}\"}," \
|
339
|
+
'{"v":44563},{"v":36396},{"v":5372},{"v":0},{"v":40720},{"v":38518},{"v":2045}]},' \
|
340
|
+
"{\"c\":[{\"v\":\"#{@memory.memory_detail_usage[1][:time]}\"},{\"v\":44563},{\"v\":36396}," \
|
341
|
+
'{"v":5372},{"v":0},{"v":40720},{"v":38518},{"v":2045}]}]}'
|
343
342
|
|
344
343
|
assert_equal(expected_google, @memory.export_as_google_api_format(@memory.memory_detail_usage))
|
345
344
|
end
|
346
|
-
|
347
|
-
end
|
345
|
+
end
|