OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "platform/assert.h" | 5 #include "platform/assert.h" |
6 #include "vm/isolate.h" | 6 #include "vm/isolate.h" |
7 #include "vm/lockers.h" | 7 #include "vm/lockers.h" |
8 #include "vm/unit_test.h" | 8 #include "vm/unit_test.h" |
9 #include "vm/profiler.h" | 9 #include "vm/profiler.h" |
10 #include "vm/safepoint.h" | 10 #include "vm/safepoint.h" |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 done_count = 0; | 313 done_count = 0; |
314 } | 314 } |
315 | 315 |
316 // Get the information for the current isolate. | 316 // Get the information for the current isolate. |
317 // We only need to check the current isolate since all tasks are spawned | 317 // We only need to check the current isolate since all tasks are spawned |
318 // inside this single isolate. | 318 // inside this single isolate. |
319 JSONStream stream; | 319 JSONStream stream; |
320 isolate->PrintJSON(&stream, false); | 320 isolate->PrintJSON(&stream, false); |
321 const char* json = stream.ToCString(); | 321 const char* json = stream.ToCString(); |
322 | 322 |
323 Thread* current_thread = Thread::Current(); | |
324 { | |
325 StackZone stack_zone(current_thread); | |
326 char* isolate_info_buf = OS::SCreate(current_thread->zone(), | |
327 "\"_memoryHighWatermark\":" | |
328 "\"%u\"", | |
329 isolate->memory_high_watermark()); | |
330 EXPECT_SUBSTRING(isolate_info_buf, json); | |
331 } | |
332 | |
333 // Confirm all expected entries are in the JSON output. | 323 // Confirm all expected entries are in the JSON output. |
334 for (intptr_t i = 0; i < kTaskCount + 1; i++) { | 324 for (intptr_t i = 0; i < kTaskCount + 1; i++) { |
335 Thread* thread = threads[i]; | 325 Thread* thread = threads[i]; |
336 Zone* top_zone = thread->zone(); | 326 Zone* top_zone = thread->zone(); |
337 | 327 |
| 328 Thread* current_thread = Thread::Current(); |
338 StackZone stack_zone(current_thread); | 329 StackZone stack_zone(current_thread); |
339 Zone* current_zone = current_thread->zone(); | 330 Zone* current_zone = current_thread->zone(); |
340 | 331 |
341 // Check that all zones are present with correct sizes. | 332 // Check that all zones are present with correct sizes. |
342 while (top_zone != NULL) { | 333 while (top_zone != NULL) { |
343 char* zone_info_buf = | 334 char* zone_info_buf = |
344 OS::SCreate(current_zone, | 335 OS::SCreate(current_zone, |
345 "\"type\":\"_Zone\"," | 336 "\"type\":\"_Zone\"," |
346 "\"capacity\":%" Pd | 337 "\"capacity\":%" Pd |
347 "," | 338 "," |
348 "\"used\":%" Pd "", | 339 "\"used\":%" Pd "", |
349 top_zone->CapacityInBytes(), top_zone->SizeInBytes()); | 340 top_zone->CapacityInBytes(), top_zone->SizeInBytes()); |
350 EXPECT_SUBSTRING(zone_info_buf, json); | 341 EXPECT_SUBSTRING(zone_info_buf, json); |
351 top_zone = top_zone->previous(); | 342 top_zone = top_zone->previous(); |
352 } | 343 } |
353 | 344 |
354 // Check the thread exists and is the correct size. | 345 // Check the thread exists and is the correct size. |
355 char* thread_info_buf = | 346 char* thread_info_buf = |
356 OS::SCreate(current_zone, | 347 OS::SCreate(current_zone, |
357 "\"type\":\"_Thread\"," | 348 "\"type\":\"_Thread\"," |
358 "\"id\":\"threads\\/%" Pd | 349 "\"id\":\"threads\\/%" Pd |
359 "\"," | 350 "\"," |
360 "\"kind\":\"%s\"," | 351 "\"kind\":\"%s\"", |
361 "\"_memoryHighWatermark\":\"%u\"", | |
362 OSThread::ThreadIdToIntPtr(thread->os_thread()->trace_id()), | 352 OSThread::ThreadIdToIntPtr(thread->os_thread()->trace_id()), |
363 Thread::TaskKindToCString(thread->task_kind()), | 353 Thread::TaskKindToCString(thread->task_kind())); |
364 thread->memory_high_watermark()); | |
365 | 354 |
366 EXPECT_SUBSTRING(thread_info_buf, json); | 355 EXPECT_SUBSTRING(thread_info_buf, json); |
367 } | 356 } |
368 | 357 |
369 // Unblock the tasks so they can finish. | 358 // Unblock the tasks so they can finish. |
370 { | 359 { |
371 MonitorLocker sync_ml(&sync); | 360 MonitorLocker sync_ml(&sync); |
372 wait = false; | 361 wait = false; |
373 sync_ml.NotifyAll(); | 362 sync_ml.NotifyAll(); |
374 } | 363 } |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
803 TransitionVMToBlocked transition(thread); | 792 TransitionVMToBlocked transition(thread); |
804 MonitorLocker ml(&done_monitor); | 793 MonitorLocker ml(&done_monitor); |
805 if (done) { | 794 if (done) { |
806 break; | 795 break; |
807 } | 796 } |
808 } | 797 } |
809 } | 798 } |
810 } | 799 } |
811 | 800 |
812 } // namespace dart | 801 } // namespace dart |
OLD | NEW |