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.
@@ -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 = <<-EOS
6
- Applications Memory Usage (kB):
7
- Uptime: 69627589 Realtime: 376894346
8
-
9
- ** MEMINFO in pid 29607 [com.sample.package] **
10
- Shared Private Heap Heap Heap
11
- Pss Dirty Dirty Size Alloc Free
12
- ------ ------ ------ ------ ------ ------
13
- Native 24 8 24 11296 7927 408
14
- Dalvik 11976 4696 11916 13388 7454 5934
15
- Cursor 0 0 0
16
- Ashmem 0 0 0
17
- Other dev 56 56 0
18
- .so mmap 2507 2028 620
19
- .jar mmap 0 0 0
20
- .apk mmap 49 0 0
21
- .ttf mmap 3 0 0
22
- .dex mmap 628 0 12
23
- Other mmap 592 16 296
24
- Unknown 13094 504 13092
25
- TOTAL 28929 7308 25960 24684 15381 6342
26
-
27
- Objects
28
- Views: 115 ViewRootImpl: 1
29
- AppContexts: 6 Activities: 1
30
- Assets: 6 AssetManagers: 6
31
- Local Binders: 15 Proxy Binders: 23
32
- Death Recipients: 0
33
- OpenSSL Sockets: 3
34
-
35
- SQL
36
- MEMORY_USED: 462
37
- PAGECACHE_OVERFLOW: 83 MALLOC_SIZE: 62
38
-
39
- DATABASES
40
- pgsz dbsz Lookaside(b) cache Dbname
41
- 4 48 37 11/22/4 /data/data/com.sample.package/databases/sample.db
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 = <<-EOS
45
- Applications Memory Usage (kB):
46
- Uptime: 76485937 Realtime: 238763696
47
-
48
- ** MEMINFO in pid 30125 [com.sample.package] **
49
- Pss Private Private Swapped Heap Heap Heap
50
- Total Dirty Clean Dirty Size Alloc Free
51
- ------ ------ ------ ------ ------ ------ ------
52
- Native Heap 0 0 0 0 8948 8520 271
53
- Dalvik Heap 23195 22764 0 0 31772 29998 1774
54
- Dalvik Other 3875 3820 0 0
55
- Stack 272 272 0 0
56
- Cursor 4 4 0 0
57
- Other dev 4014 3136 20 0
58
- .so mmap 1429 1028 12 0
59
- .apk mmap 712 0 368 0
60
- .ttf mmap 594 0 308 0
61
- .dex mmap 5099 44 4648 0
62
- Other mmap 40 4 16 0
63
- Unknown 5329 5324 0 0
64
- TOTAL 44563 36396 5372 0 40720 38518 2045
65
-
66
- Objects
67
- Views: 690 ViewRootImpl: 1
68
- AppContexts: 3 Activities: 1
69
- Assets: 4 AssetManagers: 4
70
- Local Binders: 15 Proxy Binders: 23
71
- Death Recipients: 1
72
- OpenSSL Sockets: 7
73
-
74
- SQL
75
- MEMORY_USED: 329
76
- PAGECACHE_OVERFLOW: 82 MALLOC_SIZE: 62
77
-
78
- DATABASES
79
- pgsz dbsz Lookaside(b) cache Dbname
80
- 4 20 58 21/26/9 /data/data/com.sample.package/databases/sample.db
81
- Asset Allocations
82
- zip:/data/app/com.sample.package.apk:/assets/sample.ttf: 132K
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 = <<-EOS
86
- Applications Memory Usage (kB):
87
- Uptime: 166891747 Realtime: 445776902
88
-
89
- ** MEMINFO in pid 22861 [com.sample.package] **
90
- Pss Private Private Swapped Heap Heap Heap
91
- Total Dirty Clean Dirty Size Alloc Free
92
- ------ ------ ------ ------ ------ ------ ------
93
- Native Heap 24501 24240 0 13968 60416 56957 3458
94
- Dalvik Heap 16434 16400 0 484 34525 31331 3194
95
- Dalvik Other 14130 14108 0 5072
96
- Stack 1316 1316 0 0
97
- Ashmem 207 112 0 0
98
- Other dev 9 0 8 0
99
- .so mmap 18500 444 12540 2504
100
- .apk mmap 1964 0 1520 0
101
- .ttf mmap 643 0 580 0
102
- .dex mmap 18523 8 18156 4
103
- .oat mmap 2657 0 500 0
104
- .art mmap 1881 1560 16 92
105
- Other mmap 1725 12 1020 4
106
- EGL mtrack 7962 7962 0 0
107
- GL mtrack 32867 32867 0 0
108
- Unknown 2672 2672 0 108
109
- TOTAL 145991 101701 34340 22236 94941 88288 6652
110
-
111
- App Summary
112
- Pss(KB)
113
- ------
114
- Java Heap: 17976
115
- Native Heap: 24240
116
- Code: 33748
117
- Stack: 1316
118
- Graphics: 40829
119
- Private Other: 17932
120
- System: 9950
121
-
122
- TOTAL: 145991 TOTAL SWAP (KB): 22236
123
-
124
- Objects
125
- Views: 553 ViewRootImpl: 1
126
- AppContexts: 2 Activities: 1
127
- Assets: 5 AssetManagers: 2
128
- Local Binders: 37 Proxy Binders: 29
129
- Parcel memory: 11 Parcel count: 46
130
- Death Recipients: 2 OpenSSL Sockets: 10
131
-
132
- SQL
133
- MEMORY_USED: 468
134
- PAGECACHE_OVERFLOW: 113 MALLOC_SIZE: 62
135
-
136
- DATABASES
137
- pgsz dbsz Lookaside(b) cache Dbname
138
- 4 20 25 36/17/3 /data/data/com.sample.package/databases/sample1.db
139
- 4 28 62 17/26/8 /data/data/com.sample.package/databases/sample2.db
140
- 4 104 19 6/21/3 /data/data/com.sample.package/databases/sample3.db
141
- 4 104 22 2/18/3 /data/data/com.sample.package/databases/sample4.db
142
-
143
- Asset Allocations
144
- zip:/data/app/com.sample.package/base.apk:/assets/sample.ttf: 76K
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( { package: "com.android.chrome" } )
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("com.android.chrome", @memory.package)
162
- assert_equal("", @memory.device_serial)
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(Uptime: 69627589 Realtime: 376894346)
174
- assert_equal(expected,@memory.dump_memory_usage(SAMPLE_DATA_43))
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(Uptime: 76485937 Realtime: 238763696)
179
- assert_equal(expected,@memory.dump_memory_usage(SAMPLE_DATA_44))
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(TOTAL 28929 7308 25960 24684 15381 6342)
184
- assert_equal(expected,@memory.dump_memory_details_usage(SAMPLE_DATA_43))
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(TOTAL 44563 36396 5372 0 40720 38518 2045)
189
- assert_equal(expected,@memory.dump_memory_details_usage(SAMPLE_DATA_44))
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: 376894346,
197
- uptime: 69627589,
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: 28929,
209
+ pss_total: 28_929,
210
210
  shared_dirty: 7308,
211
- private_dirty: 25960,
212
- heap_size: 24684,
213
- heap_alloc: 15381,
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: 44563,
226
- private_dirty: 36396,
225
+ pss_total: 44_563,
226
+ private_dirty: 36_396,
227
227
  private_clean: 5372,
228
228
  swapped_dirty: 0,
229
- heap_size: 40720,
230
- heap_alloc: 38518,
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
- pss_total: 145991,
242
- private_dirty: 101701,
243
- private_clean: 34340,
244
- swapped_dirty: 22236,
245
- heap_size: 94941,
246
- heap_alloc: 88288,
247
- heap_free: 6652,
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 = "[{\"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]}\"}]"
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 = "[{\"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]}\"}]"
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 = "{\"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}]}]}"
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(13:43:32.556)
307
+ dummy_array = %w[13:43:32.556]
309
308
 
310
309
  @memory.store_memory_details_usage(dummy_array)
311
- expected_json = "[{\"pss_total\":0,\"private_dirty\":0,\"private_clean\":0," +
312
- "\"swapped_dirty\":0,\"heap_size\":0,\"heap_alloc\":0,\"heap_free\":0," +
313
- "\"time\":\"#{@memory.memory_detail_usage[0][:time]}\"}]"
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 = "[{\"pss_total\":44563,\"private_dirty\":36396,\"private_clean\":5372,\"swapped_dirty\":0," +
326
- "\"heap_size\":40720,\"heap_alloc\":38518,\"heap_free\":2045," +
327
- "\"time\":\"#{@memory.memory_detail_usage[0][:time]}\"}," +
328
- "{\"pss_total\":44563,\"private_dirty\":36396," +
329
- "\"private_clean\":5372,\"swapped_dirty\":0," +
330
- "\"heap_size\":40720,\"heap_alloc\":38518,\"heap_free\":2045," +
331
- "\"time\":\"#{@memory.memory_detail_usage[1][:time]}\"}]"
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 = "{\"cols\":[{\"label\":\"time\",\"type\":\"string\"},{\"label\":\"pss_total\"," +
336
- "\"type\":\"number\"},{\"label\":\"private_dirty\",\"type\":\"number\"},{\"label\":\"private_clean\"," +
337
- "\"type\":\"number\"},{\"label\":\"swapped_dirty\",\"type\":\"number\"},{\"label\":\"heap_size\"," +
338
- "\"type\":\"number\"},{\"label\":\"heap_alloc\",\"type\":\"number\"},{\"label\":\"heap_free\"," +
339
- "\"type\":\"number\"}],\"rows\":[{\"c\":[{\"v\":\"#{@memory.memory_detail_usage[0][:time]}\"}," +
340
- "{\"v\":44563},{\"v\":36396},{\"v\":5372},{\"v\":0},{\"v\":40720},{\"v\":38518},{\"v\":2045}]}," +
341
- "{\"c\":[{\"v\":\"#{@memory.memory_detail_usage[1][:time]}\"},{\"v\":44563},{\"v\":36396}," +
342
- "{\"v\":5372},{\"v\":0},{\"v\":40720},{\"v\":38518},{\"v\":2045}]}]}"
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