OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <!-- | 2 <!-- |
3 Copyright (c) 2015 The Chromium Authors. All rights reserved. | 3 Copyright (c) 2015 The Chromium Authors. All rights reserved. |
4 Use of this source code is governed by a BSD-style license that can be | 4 Use of this source code is governed by a BSD-style license that can be |
5 found in the LICENSE file. | 5 found in the LICENSE file. |
6 --> | 6 --> |
7 | 7 |
8 <link rel="import" href="/tracing/core/test_utils.html"> | 8 <link rel="import" href="/tracing/core/test_utils.html"> |
9 <link rel="import" href="/tracing/model/global_memory_dump.html"> | 9 <link rel="import" href="/tracing/model/global_memory_dump.html"> |
10 <link rel="import" href="/tracing/model/memory_dump_test_utils.html"> | 10 <link rel="import" href="/tracing/model/memory_dump_test_utils.html"> |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 test('hookUpMostRecentVmRegionsLinks_nonEmptyArray', function() { | 89 test('hookUpMostRecentVmRegionsLinks_nonEmptyArray', function() { |
90 var m = new tr.Model(); | 90 var m = new tr.Model(); |
91 | 91 |
92 // A dump with no VM regions or allocator dumps. | 92 // A dump with no VM regions or allocator dumps. |
93 var dump1 = createProcessMemoryDump(1, m); | 93 var dump1 = createProcessMemoryDump(1, m); |
94 | 94 |
95 // A dump with VM regions and malloc and Oilpan allocator dumps. | 95 // A dump with VM regions and malloc and Oilpan allocator dumps. |
96 var dump2 = createProcessMemoryDump(2, m); | 96 var dump2 = createProcessMemoryDump(2, m); |
97 dump2.vmRegions = createClassificationNode(); | 97 dump2.vmRegions = createClassificationNode(); |
98 dump2.memoryAllocatorDumps = [ | 98 dump2.memoryAllocatorDumps = [ |
99 newAllocatorDump(dump2, 'oilpan', { | 99 newAllocatorDump(dump2, 'oilpan', {numerics: { |
100 size: 1024, | 100 size: 1024, |
101 objects_count: new ScalarNumeric(unitlessNumber_smallerIsBetter, 7), | 101 objects_count: new ScalarNumeric(unitlessNumber_smallerIsBetter, 7), |
102 inner_size: 768 | 102 inner_size: 768 |
103 }), | 103 }}), |
104 newAllocatorDump(dump2, 'v8', { | 104 newAllocatorDump(dump2, 'v8', {numerics: { |
105 size: 2048, | 105 size: 2048, |
106 objects_count: new ScalarNumeric(unitlessNumber_smallerIsBetter, 15), | 106 objects_count: new ScalarNumeric(unitlessNumber_smallerIsBetter, 15), |
107 inner_size: 1999 | 107 inner_size: 1999 |
108 }) | 108 }}) |
109 ]; | 109 ]; |
110 | 110 |
111 // A dump with malloc and V8 allocator dumps. | 111 // A dump with malloc and V8 allocator dumps. |
112 var dump3 = createProcessMemoryDump(3, m); | 112 var dump3 = createProcessMemoryDump(3, m); |
113 dump3.memoryAllocatorDumps = [ | 113 dump3.memoryAllocatorDumps = [ |
114 newAllocatorDump(dump3, 'malloc', { | 114 newAllocatorDump(dump3, 'malloc', {numerics: { |
115 size: 1024, | 115 size: 1024, |
116 objects_count: new ScalarNumeric(unitlessNumber_smallerIsBetter, 7), | 116 objects_count: new ScalarNumeric(unitlessNumber_smallerIsBetter, 7), |
117 inner_size: 768 | 117 inner_size: 768 |
118 }), | 118 }}), |
119 newAllocatorDump(dump3, 'v8', { | 119 newAllocatorDump(dump3, 'v8', {numerics: { |
120 size: 2048, | 120 size: 2048, |
121 objects_count: new ScalarNumeric(unitlessNumber_smallerIsBetter, 15), | 121 objects_count: new ScalarNumeric(unitlessNumber_smallerIsBetter, 15), |
122 inner_size: 1999 | 122 inner_size: 1999 |
123 }) | 123 }}) |
124 ]; | 124 ]; |
125 | 125 |
126 // A dump with VM regions. | 126 // A dump with VM regions. |
127 var dump4 = createProcessMemoryDump(4, m); | 127 var dump4 = createProcessMemoryDump(4, m); |
128 dump4.vmRegions = createClassificationNode(); | 128 dump4.vmRegions = createClassificationNode(); |
129 | 129 |
130 var dumps = [dump1, dump2, dump3, dump4]; | 130 var dumps = [dump1, dump2, dump3, dump4]; |
131 ProcessMemoryDump.hookUpMostRecentVmRegionsLinks(dumps); | 131 ProcessMemoryDump.hookUpMostRecentVmRegionsLinks(dumps); |
132 | 132 |
133 assert.lengthOf(dumps, 4); | 133 assert.lengthOf(dumps, 4); |
134 | 134 |
135 assert.equal(dumps[0], dump1); | 135 assert.equal(dumps[0], dump1); |
136 assert.isUndefined(dump1.mostRecentVmRegions); | 136 assert.isUndefined(dump1.mostRecentVmRegions); |
137 | 137 |
138 assert.equal(dumps[1], dump2); | 138 assert.equal(dumps[1], dump2); |
139 assert.equal(dump2.mostRecentVmRegions, dump2.vmRegions); | 139 assert.equal(dump2.mostRecentVmRegions, dump2.vmRegions); |
140 | 140 |
141 assert.equal(dumps[2], dump3); | 141 assert.equal(dumps[2], dump3); |
142 assert.equal(dump3.mostRecentVmRegions, dump2.vmRegions); | 142 assert.equal(dump3.mostRecentVmRegions, dump2.vmRegions); |
143 | 143 |
144 assert.equal(dumps[3], dump4); | 144 assert.equal(dumps[3], dump4); |
145 assert.equal(dump4.mostRecentVmRegions, dump4.vmRegions); | 145 assert.equal(dump4.mostRecentVmRegions, dump4.vmRegions); |
146 }); | 146 }); |
147 | 147 |
148 test('checkDiscountTracingOverhead_undefinedFields', function() { | 148 test('checkDiscountTracingOverhead_undefinedFields', function() { |
149 var pmd = createFinalizedProcessMemoryDump(42, function(pmd) { | 149 var pmd = createFinalizedProcessMemoryDump(42, function(pmd) { |
150 pmd.memoryAllocatorDumps = [ | 150 pmd.memoryAllocatorDumps = [ |
151 newAllocatorDump(pmd, 'v8', { size: 2048 }), | 151 newAllocatorDump(pmd, 'v8', {numerics: {size: 2048}}), |
152 newAllocatorDump(pmd, 'tracing', { size: 1024 }) | 152 newAllocatorDump(pmd, 'tracing', {numerics: {size: 1024}}) |
153 ]; | 153 ]; |
154 }); | 154 }); |
155 | 155 |
156 assert.isUndefined(pmd.totals); | 156 assert.isUndefined(pmd.totals); |
157 assert.isUndefined(pmd.vmRegions); | 157 assert.isUndefined(pmd.vmRegions); |
158 | 158 |
159 var v8Dump = pmd.getMemoryAllocatorDumpByFullName('v8'); | 159 var v8Dump = pmd.getMemoryAllocatorDumpByFullName('v8'); |
160 checkDumpNumericsAndDiagnostics(v8Dump, { | 160 checkDumpNumericsAndDiagnostics(v8Dump, { |
161 'size': 2048, | 161 size: 2048, |
162 'effective_size': 2048 | 162 effective_size: 2048 |
163 }, {}); | 163 }, {}); |
164 | 164 |
165 var tracingDump = pmd.getMemoryAllocatorDumpByFullName('tracing'); | 165 var tracingDump = pmd.getMemoryAllocatorDumpByFullName('tracing'); |
166 checkDumpNumericsAndDiagnostics(tracingDump, { | 166 checkDumpNumericsAndDiagnostics(tracingDump, { |
167 'size': 1024, | 167 size: 1024, |
168 'effective_size': 1024 | 168 effective_size: 1024 |
169 }, {}); | 169 }, {}); |
170 }); | 170 }); |
171 | 171 |
172 test('checkDiscountTracingOverhead_definedFields', function() { | 172 test('checkDiscountTracingOverhead_definedFields', function() { |
173 var pmd = createFinalizedProcessMemoryDump(42, function(pmd) { | 173 var pmd = createFinalizedProcessMemoryDump(42, function(pmd) { |
174 pmd.totals = { residentBytes: 10240 }; | 174 pmd.totals = {residentBytes: 10240}; |
175 pmd.vmRegions = createClassificationNode(6000, { | 175 pmd.vmRegions = createClassificationNode(6000, { |
176 privateDirtyResident: 4096, | 176 privateDirtyResident: 4096, |
177 proportionalResident: 5120, | 177 proportionalResident: 5120, |
178 swapped: 1536 | 178 swapped: 1536 |
179 }); | 179 }); |
180 | 180 |
181 var mallocDump = newAllocatorDump(pmd, 'malloc', { size: 3072 }); | 181 var mallocDump = newAllocatorDump(pmd, 'malloc', |
182 addChildDump(mallocDump, 'allocated_objects', { size: 2560 }); | 182 {numerics: {size: 3072}}); |
| 183 addChildDump(mallocDump, 'allocated_objects', {numerics: {size: 2560}}); |
183 | 184 |
184 var tracingDump = newAllocatorDump( | 185 var tracingDump = newAllocatorDump( |
185 pmd, 'tracing', { size: 1024, resident_size: 1000 }); | 186 pmd, 'tracing', {numerics: {size: 1024, resident_size: 1000}}); |
186 | 187 |
187 pmd.memoryAllocatorDumps = [mallocDump, tracingDump]; | 188 pmd.memoryAllocatorDumps = [mallocDump, tracingDump]; |
188 }); | 189 }); |
189 | 190 |
190 assert.equal(pmd.totals.residentBytes, 9240); | 191 assert.equal(pmd.totals.residentBytes, 9240); |
191 assert.isUndefined(pmd.totals.peakResidentBytes); | 192 assert.isUndefined(pmd.totals.peakResidentBytes); |
192 | 193 |
193 var vmRegions = pmd.vmRegions; | 194 var vmRegions = pmd.vmRegions; |
194 assert.strictEqual(vmRegions.sizeInBytes, 4976); | 195 assert.strictEqual(vmRegions.sizeInBytes, 4976); |
195 assert.deepEqual(vmRegions.byteStats, { | 196 assert.deepEqual(vmRegions.byteStats, { |
(...skipping 17 matching lines...) Expand all Loading... |
213 sizeInBytes: -1024, | 214 sizeInBytes: -1024, |
214 byteStats: { | 215 byteStats: { |
215 privateDirtyResident: -1000, | 216 privateDirtyResident: -1000, |
216 proportionalResident: -1000 | 217 proportionalResident: -1000 |
217 } | 218 } |
218 } | 219 } |
219 ]); | 220 ]); |
220 | 221 |
221 var mallocDump = pmd.getMemoryAllocatorDumpByFullName('malloc'); | 222 var mallocDump = pmd.getMemoryAllocatorDumpByFullName('malloc'); |
222 checkDumpNumericsAndDiagnostics(mallocDump, { | 223 checkDumpNumericsAndDiagnostics(mallocDump, { |
223 'size': 3072, | 224 size: 3072, |
224 'effective_size': 2048 | 225 effective_size: 2048 |
225 }, {}); | 226 }, {}); |
226 assert.lengthOf( | 227 assert.lengthOf( |
227 mallocDump.children, 2 /* 'allocated_objects' and '<unspecified>' */); | 228 mallocDump.children, 2 /* 'allocated_objects' and '<unspecified>' */); |
228 | 229 |
229 var allocatedObjectsDump = pmd.getMemoryAllocatorDumpByFullName( | 230 var allocatedObjectsDump = pmd.getMemoryAllocatorDumpByFullName( |
230 'malloc/allocated_objects'); | 231 'malloc/allocated_objects'); |
231 checkDumpNumericsAndDiagnostics(allocatedObjectsDump, { | 232 checkDumpNumericsAndDiagnostics(allocatedObjectsDump, { |
232 'size': 2560, | 233 size: 2560, |
233 'effective_size': 1536 | 234 effective_size: 1536 |
234 }, {}); | 235 }, {}); |
235 assert.lengthOf( | 236 assert.lengthOf( |
236 allocatedObjectsDump.children, | 237 allocatedObjectsDump.children, |
237 2 /* 'tracing_overhead' and '<unspecified>' */); | 238 2 /* 'tracing_overhead' and '<unspecified>' */); |
238 | 239 |
239 var discountDump = pmd.getMemoryAllocatorDumpByFullName( | 240 var discountDump = pmd.getMemoryAllocatorDumpByFullName( |
240 'malloc/allocated_objects/tracing_overhead'); | 241 'malloc/allocated_objects/tracing_overhead'); |
241 assert.strictEqual(discountDump.parent, allocatedObjectsDump); | 242 assert.strictEqual(discountDump.parent, allocatedObjectsDump); |
242 assert.include(allocatedObjectsDump.children, discountDump); | 243 assert.include(allocatedObjectsDump.children, discountDump); |
243 checkDumpNumericsAndDiagnostics(discountDump, { | 244 checkDumpNumericsAndDiagnostics(discountDump, { |
244 'size': 1024, | 245 size: 1024, |
245 'effective_size': 0 | 246 effective_size: 0 |
246 }, {}); | 247 }, {}); |
247 | 248 |
248 var tracingDump = pmd.getMemoryAllocatorDumpByFullName('tracing'); | 249 var tracingDump = pmd.getMemoryAllocatorDumpByFullName('tracing'); |
249 checkDumpNumericsAndDiagnostics(tracingDump, { | 250 checkDumpNumericsAndDiagnostics(tracingDump, { |
250 'size': 1024, | 251 size: 1024, |
251 'effective_size': 1024, | 252 effective_size: 1024, |
252 'resident_size': 1000 | 253 resident_size: 1000 |
253 }, {}); | 254 }, {}); |
254 assert.strictEqual(tracingDump.owns.target, discountDump); | 255 assert.strictEqual(tracingDump.owns.target, discountDump); |
255 }); | 256 }); |
256 | 257 |
257 test('checkDiscountTracingOverhead_winheap', function() { | 258 test('checkDiscountTracingOverhead_winheap', function() { |
258 var pmd = createFinalizedProcessMemoryDump(42, function(pmd) { | 259 var pmd = createFinalizedProcessMemoryDump(42, function(pmd) { |
259 pmd.memoryAllocatorDumps = [ | 260 pmd.memoryAllocatorDumps = [ |
260 newAllocatorDump(pmd, 'tracing', { size: 2048 }), | 261 newAllocatorDump(pmd, 'tracing', {numerics: {size: 2048}}), |
261 newAllocatorDump(pmd, 'winheap', { size: 5120 }) | 262 newAllocatorDump(pmd, 'winheap', {numerics: {size: 5120}}) |
262 ]; | 263 ]; |
263 }); | 264 }); |
264 | 265 |
265 assert.isUndefined(pmd.totals); | 266 assert.isUndefined(pmd.totals); |
266 assert.isUndefined(pmd.vmRegions); | 267 assert.isUndefined(pmd.vmRegions); |
267 | 268 |
268 var winheapDump = pmd.getMemoryAllocatorDumpByFullName('winheap'); | 269 var winheapDump = pmd.getMemoryAllocatorDumpByFullName('winheap'); |
269 checkDumpNumericsAndDiagnostics(winheapDump, { | 270 checkDumpNumericsAndDiagnostics(winheapDump, { |
270 'size': 5120, | 271 size: 5120, |
271 'effective_size': 3072 | 272 effective_size: 3072 |
272 }, {}); | 273 }, {}); |
273 assert.lengthOf(winheapDump.children, | 274 assert.lengthOf(winheapDump.children, |
274 2 /* 'allocated_objects' and '<unspecified>' */); | 275 2 /* 'allocated_objects' and '<unspecified>' */); |
275 | 276 |
276 var allocatedObjectsDump = pmd.getMemoryAllocatorDumpByFullName( | 277 var allocatedObjectsDump = pmd.getMemoryAllocatorDumpByFullName( |
277 'winheap/allocated_objects'); | 278 'winheap/allocated_objects'); |
278 checkDumpNumericsAndDiagnostics(allocatedObjectsDump, { | 279 checkDumpNumericsAndDiagnostics(allocatedObjectsDump, { |
279 'size': 2048, | 280 size: 2048, |
280 'effective_size': 0 | 281 effective_size: 0 |
281 }, {}); | 282 }, {}); |
282 assert.lengthOf( | 283 assert.lengthOf( |
283 allocatedObjectsDump.children, 1 /* 'tracing_overhead' */); | 284 allocatedObjectsDump.children, 1 /* 'tracing_overhead' */); |
284 | 285 |
285 var discountDump = pmd.getMemoryAllocatorDumpByFullName( | 286 var discountDump = pmd.getMemoryAllocatorDumpByFullName( |
286 'winheap/allocated_objects/tracing_overhead'); | 287 'winheap/allocated_objects/tracing_overhead'); |
287 assert.strictEqual(discountDump.parent, allocatedObjectsDump); | 288 assert.strictEqual(discountDump.parent, allocatedObjectsDump); |
288 assert.include(allocatedObjectsDump.children, discountDump); | 289 assert.include(allocatedObjectsDump.children, discountDump); |
289 checkDumpNumericsAndDiagnostics(discountDump, { | 290 checkDumpNumericsAndDiagnostics(discountDump, { |
290 'size': 2048, | 291 size: 2048, |
291 'effective_size': 0 | 292 effective_size: 0 |
292 }, {}); | 293 }, {}); |
293 | 294 |
294 var tracingDump = pmd.getMemoryAllocatorDumpByFullName('tracing'); | 295 var tracingDump = pmd.getMemoryAllocatorDumpByFullName('tracing'); |
295 checkDumpNumericsAndDiagnostics(tracingDump, { | 296 checkDumpNumericsAndDiagnostics(tracingDump, { |
296 'size': 2048, | 297 size: 2048, |
297 'effective_size': 2048 | 298 effective_size: 2048 |
298 }, {}); | 299 }, {}); |
299 assert.strictEqual(tracingDump.owns.target, discountDump); | 300 assert.strictEqual(tracingDump.owns.target, discountDump); |
300 }); | 301 }); |
301 | 302 |
302 test('checkDiscountTracingOverhead_withMostRecentVmRegionsLinks', function() { | 303 test('checkDiscountTracingOverhead_withMostRecentVmRegionsLinks', function() { |
303 var pmds = createFinalizedProcessMemoryDumps([42, 90], function(pmds) { | 304 var pmds = createFinalizedProcessMemoryDumps([42, 90], function(pmds) { |
304 pmds[0].totals = { residentBytes: 1000, peakResidentBytes: 2000 }; | 305 pmds[0].totals = {residentBytes: 1000, peakResidentBytes: 2000}; |
305 pmds[0].vmRegions = createClassificationNode(6000, { | 306 pmds[0].vmRegions = createClassificationNode(6000, { |
306 privateDirtyResident: 4096 | 307 privateDirtyResident: 4096 |
307 }); | 308 }); |
308 pmds[0].memoryAllocatorDumps = [ | 309 pmds[0].memoryAllocatorDumps = [ |
309 newAllocatorDump(pmds[0], 'tracing', { size: 300, resident_size: 100 }) | 310 newAllocatorDump(pmds[0], 'tracing', |
| 311 {numerics: {size: 300, resident_size: 100}}) |
310 ]; | 312 ]; |
311 | 313 |
312 pmds[1].totals = { peakResidentBytes: 3000 }; | 314 pmds[1].totals = {peakResidentBytes: 3000}; |
313 pmds[1].memoryAllocatorDumps = [ | 315 pmds[1].memoryAllocatorDumps = [ |
314 newAllocatorDump(pmds[0], 'tracing', { resident_size: 200 }) | 316 newAllocatorDump(pmds[0], 'tracing', {numerics: {resident_size: 200}}) |
315 ]; | 317 ]; |
316 }); | 318 }); |
317 | 319 |
318 // First PMD: Both total resident and private dirty resident size should be | 320 // First PMD: Both total resident and private dirty resident size should be |
319 // reduced by 100. Virtual size should be reduced by 300. | 321 // reduced by 100. Virtual size should be reduced by 300. |
320 assert.strictEqual(pmds[0].totals.residentBytes, 900); | 322 assert.strictEqual(pmds[0].totals.residentBytes, 900); |
321 assert.strictEqual(pmds[0].totals.peakResidentBytes, 1900); | 323 assert.strictEqual(pmds[0].totals.peakResidentBytes, 1900); |
322 assert.strictEqual(pmds[0].vmRegions.sizeInBytes, 5700); | 324 assert.strictEqual(pmds[0].vmRegions.sizeInBytes, 5700); |
323 assert.deepEqual(pmds[0].vmRegions.byteStats, { | 325 assert.deepEqual(pmds[0].vmRegions.byteStats, { |
324 privateDirtyResident: 3996 | 326 privateDirtyResident: 3996 |
(...skipping 27 matching lines...) Expand all Loading... |
352 }); | 354 }); |
353 | 355 |
354 test('checkDiscountTracingOverhead_allDiscountedVmRegionFields', function() { | 356 test('checkDiscountTracingOverhead_allDiscountedVmRegionFields', function() { |
355 var pmd = createFinalizedProcessMemoryDump(42, function(pmd) { | 357 var pmd = createFinalizedProcessMemoryDump(42, function(pmd) { |
356 pmd.vmRegions = createClassificationNode(10000, { | 358 pmd.vmRegions = createClassificationNode(10000, { |
357 privateDirtyResident: 4096, | 359 privateDirtyResident: 4096, |
358 proportionalResident: 8192, | 360 proportionalResident: 8192, |
359 swapped: 1536 | 361 swapped: 1536 |
360 }); | 362 }); |
361 pmd.memoryAllocatorDumps = [ | 363 pmd.memoryAllocatorDumps = [ |
362 newAllocatorDump(pmd, 'tracing', { size: 1000, resident_size: 1024 }) | 364 newAllocatorDump(pmd, 'tracing', |
| 365 {numerics: {size: 1000, resident_size: 1024}}) |
363 ]; | 366 ]; |
364 }); | 367 }); |
365 | 368 |
366 var vmRegions = pmd.vmRegions; | 369 var vmRegions = pmd.vmRegions; |
367 assert.strictEqual(vmRegions.sizeInBytes, 9000); | 370 assert.strictEqual(vmRegions.sizeInBytes, 9000); |
368 assert.deepEqual(vmRegions.byteStats, { | 371 assert.deepEqual(vmRegions.byteStats, { |
369 privateDirtyResident: 3072, | 372 privateDirtyResident: 3072, |
370 proportionalResident: 7168, | 373 proportionalResident: 7168, |
371 swapped: 1536 | 374 swapped: 1536 |
372 }); | 375 }); |
(...skipping 18 matching lines...) Expand all Loading... |
391 ]); | 394 ]); |
392 }); | 395 }); |
393 | 396 |
394 test('checkDiscountTracingOverhead_twoDiscountedVmRegionField', function() { | 397 test('checkDiscountTracingOverhead_twoDiscountedVmRegionField', function() { |
395 var pmd = createFinalizedProcessMemoryDump(42, function(pmd) { | 398 var pmd = createFinalizedProcessMemoryDump(42, function(pmd) { |
396 pmd.vmRegions = createClassificationNode(10000, { | 399 pmd.vmRegions = createClassificationNode(10000, { |
397 privateDirtyResident: 4096, | 400 privateDirtyResident: 4096, |
398 swapped: 1536 | 401 swapped: 1536 |
399 }); | 402 }); |
400 pmd.memoryAllocatorDumps = [ | 403 pmd.memoryAllocatorDumps = [ |
401 newAllocatorDump(pmd, 'tracing', { size: 1000, resident_size: 1024 }) | 404 newAllocatorDump(pmd, 'tracing', |
| 405 {numerics: {size: 1000, resident_size: 1024}}) |
402 ]; | 406 ]; |
403 }); | 407 }); |
404 | 408 |
405 var vmRegions = pmd.vmRegions; | 409 var vmRegions = pmd.vmRegions; |
406 assert.strictEqual(vmRegions.sizeInBytes, 9000); | 410 assert.strictEqual(vmRegions.sizeInBytes, 9000); |
407 assert.deepEqual(vmRegions.byteStats, { | 411 assert.deepEqual(vmRegions.byteStats, { |
408 privateDirtyResident: 3072, | 412 privateDirtyResident: 3072, |
409 swapped: 1536 | 413 swapped: 1536 |
410 }); | 414 }); |
411 checkVMRegions(vmRegions, [ | 415 checkVMRegions(vmRegions, [ |
(...skipping 12 matching lines...) Expand all Loading... |
424 privateDirtyResident: -1024 | 428 privateDirtyResident: -1024 |
425 } | 429 } |
426 } | 430 } |
427 ]); | 431 ]); |
428 }); | 432 }); |
429 | 433 |
430 test('checkDiscountTracingOverhead_oneDiscountedVmRegionField', function() { | 434 test('checkDiscountTracingOverhead_oneDiscountedVmRegionField', function() { |
431 var pmd = createFinalizedProcessMemoryDump(42, function(pmd) { | 435 var pmd = createFinalizedProcessMemoryDump(42, function(pmd) { |
432 pmd.vmRegions = createClassificationNode(10000); | 436 pmd.vmRegions = createClassificationNode(10000); |
433 pmd.memoryAllocatorDumps = [ | 437 pmd.memoryAllocatorDumps = [ |
434 newAllocatorDump(pmd, 'tracing', { size: 1000, resident_size: 1024 }) | 438 newAllocatorDump(pmd, 'tracing', |
| 439 {numerics: {size: 1000, resident_size: 1024}}) |
435 ]; | 440 ]; |
436 }); | 441 }); |
437 | 442 |
438 var vmRegions = pmd.vmRegions; | 443 var vmRegions = pmd.vmRegions; |
439 assert.strictEqual(vmRegions.sizeInBytes, 9000); | 444 assert.strictEqual(vmRegions.sizeInBytes, 9000); |
440 assert.deepEqual(vmRegions.byteStats, {}); | 445 assert.deepEqual(vmRegions.byteStats, {}); |
441 checkVMRegions(vmRegions, [ | 446 checkVMRegions(vmRegions, [ |
442 { | 447 { |
443 mappedFile: 'mock.so', | 448 mappedFile: 'mock.so', |
444 sizeInBytes: 10000 | 449 sizeInBytes: 10000 |
445 }, | 450 }, |
446 { | 451 { |
447 mappedFile: '[discounted tracing overhead]', | 452 mappedFile: '[discounted tracing overhead]', |
448 sizeInBytes: -1000 | 453 sizeInBytes: -1000 |
449 } | 454 } |
450 ]); | 455 ]); |
451 }); | 456 }); |
452 | 457 |
453 test('checkDiscountTracingOverhead_noDiscountedVmRegionFields', function() { | 458 test('checkDiscountTracingOverhead_noDiscountedVmRegionFields', function() { |
454 var pmd = createFinalizedProcessMemoryDump(42, function(pmd) { | 459 var pmd = createFinalizedProcessMemoryDump(42, function(pmd) { |
455 pmd.vmRegions = createClassificationNode(undefined, { | 460 pmd.vmRegions = createClassificationNode(undefined, { |
456 swapped: 1536 | 461 swapped: 1536 |
457 }); | 462 }); |
458 pmd.memoryAllocatorDumps = [ | 463 pmd.memoryAllocatorDumps = [ |
459 newAllocatorDump(pmd, 'tracing', { size: 1000, resident_size: 1024 }) | 464 newAllocatorDump(pmd, 'tracing', |
| 465 {numerics: {size: 1000, resident_size: 1024}}) |
460 ]; | 466 ]; |
461 }); | 467 }); |
462 | 468 |
463 var vmRegions = pmd.vmRegions; | 469 var vmRegions = pmd.vmRegions; |
464 assert.isUndefined(vmRegions.sizeInBytes); | 470 assert.isUndefined(vmRegions.sizeInBytes); |
465 assert.deepEqual(vmRegions.byteStats, { | 471 assert.deepEqual(vmRegions.byteStats, { |
466 swapped: 1536 | 472 swapped: 1536 |
467 }); | 473 }); |
468 checkVMRegions(vmRegions, [ | 474 checkVMRegions(vmRegions, [ |
469 { | 475 { |
470 mappedFile: 'mock.so', | 476 mappedFile: 'mock.so', |
471 byteStats: { | 477 byteStats: { |
472 swapped: 1536 | 478 swapped: 1536 |
473 } | 479 } |
474 } | 480 } |
475 ]); | 481 ]); |
476 }); | 482 }); |
477 | 483 |
478 test('checkDiscountTracingOverhead_existingLink', function() { | 484 test('checkDiscountTracingOverhead_existingLink', function() { |
479 var pmd = createFinalizedProcessMemoryDump(42, function(pmd) { | 485 var pmd = createFinalizedProcessMemoryDump(42, function(pmd) { |
480 pmd.totals = { residentBytes: 10240 }; | 486 pmd.totals = {residentBytes: 10240}; |
481 | 487 |
482 pmd.vmRegions = createClassificationNode(6000, { | 488 pmd.vmRegions = createClassificationNode(6000, { |
483 privateDirtyResident: 4096, | 489 privateDirtyResident: 4096, |
484 swapped: 1536, | 490 swapped: 1536, |
485 proportionalResident: 5120 | 491 proportionalResident: 5120 |
486 }); | 492 }); |
487 | 493 |
488 var mallocDump = newAllocatorDump(pmd, 'malloc', { size: 3072 }); | 494 var mallocDump = newAllocatorDump(pmd, 'malloc', |
| 495 {numerics: {size: 3072}}); |
489 var tracingDump = newAllocatorDump(pmd, 'tracing', | 496 var tracingDump = newAllocatorDump(pmd, 'tracing', |
490 { size: 1024, resident_size: 1000 }); | 497 {numerics: {size: 1024, resident_size: 1000}}); |
491 var ownedDump = newAllocatorDump(pmd, 'owned'); | 498 var ownedDump = newAllocatorDump(pmd, 'owned'); |
492 | 499 |
493 // The code for discounting tracing overhead should *not* override an | 500 // The code for discounting tracing overhead should *not* override an |
494 // existing ownership. | 501 // existing ownership. |
495 addOwnershipLink(tracingDump, ownedDump); | 502 addOwnershipLink(tracingDump, ownedDump); |
496 | 503 |
497 pmd.memoryAllocatorDumps = [mallocDump, tracingDump, ownedDump]; | 504 pmd.memoryAllocatorDumps = [mallocDump, tracingDump, ownedDump]; |
498 }); | 505 }); |
499 | 506 |
500 assert.strictEqual(pmd.totals.residentBytes, 9240); | 507 assert.strictEqual(pmd.totals.residentBytes, 9240); |
(...skipping 21 matching lines...) Expand all Loading... |
522 sizeInBytes: -1024, | 529 sizeInBytes: -1024, |
523 byteStats: { | 530 byteStats: { |
524 privateDirtyResident: -1000, | 531 privateDirtyResident: -1000, |
525 proportionalResident: -1000 | 532 proportionalResident: -1000 |
526 } | 533 } |
527 } | 534 } |
528 ]); | 535 ]); |
529 | 536 |
530 var mallocDump = pmd.getMemoryAllocatorDumpByFullName('malloc'); | 537 var mallocDump = pmd.getMemoryAllocatorDumpByFullName('malloc'); |
531 checkDumpNumericsAndDiagnostics(mallocDump, { | 538 checkDumpNumericsAndDiagnostics(mallocDump, { |
532 'size': 3072, | 539 size: 3072, |
533 'effective_size': 3072 | 540 effective_size: 3072 |
534 }, {}); | 541 }, {}); |
535 assert.lengthOf(mallocDump.children, 0); | 542 assert.lengthOf(mallocDump.children, 0); |
536 | 543 |
537 var ownedDump = pmd.getMemoryAllocatorDumpByFullName('owned'); | 544 var ownedDump = pmd.getMemoryAllocatorDumpByFullName('owned'); |
538 checkDumpNumericsAndDiagnostics(ownedDump, { | 545 checkDumpNumericsAndDiagnostics(ownedDump, { |
539 'size': 1024, | 546 size: 1024, |
540 'effective_size': 0 | 547 effective_size: 0 |
541 }, {}); | 548 }, {}); |
542 assert.lengthOf(ownedDump.children, 0); | 549 assert.lengthOf(ownedDump.children, 0); |
543 | 550 |
544 var tracingDump = pmd.getMemoryAllocatorDumpByFullName('tracing'); | 551 var tracingDump = pmd.getMemoryAllocatorDumpByFullName('tracing'); |
545 checkDumpNumericsAndDiagnostics(tracingDump, { | 552 checkDumpNumericsAndDiagnostics(tracingDump, { |
546 'size': 1024, | 553 size: 1024, |
547 'effective_size': 1024, | 554 effective_size: 1024, |
548 'resident_size': 1000 | 555 resident_size: 1000 |
549 }, {}); | 556 }, {}); |
550 assert.strictEqual(tracingDump.owns.target, ownedDump); | 557 assert.strictEqual(tracingDump.owns.target, ownedDump); |
551 }); | 558 }); |
552 }); | 559 }); |
553 </script> | 560 </script> |
OLD | NEW |