Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(517)

Side by Side Diff: runtime/vm/thread_test.cc

Issue 1412733008: Switch profiler from isolates to threads (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/thread_pool.h" 10 #include "vm/thread_pool.h"
(...skipping 21 matching lines...) Expand all
32 Dart_ShutdownIsolate(); 32 Dart_ShutdownIsolate();
33 delete mutex; 33 delete mutex;
34 } 34 }
35 35
36 36
37 UNIT_TEST_CASE(Monitor) { 37 UNIT_TEST_CASE(Monitor) {
38 // This unit test case needs a running isolate. 38 // This unit test case needs a running isolate.
39 Dart_CreateIsolate( 39 Dart_CreateIsolate(
40 NULL, NULL, bin::isolate_snapshot_buffer, NULL, NULL, NULL); 40 NULL, NULL, bin::isolate_snapshot_buffer, NULL, NULL, NULL);
41 Thread* thread = Thread::Current(); 41 Thread* thread = Thread::Current();
42 Isolate* isolate = thread->isolate(); 42 thread->DisableThreadInterrupts();
43 // Thread interrupter interferes with this test, disable interrupts.
Ivan Posva 2015/10/28 19:31:54 We might want to keep this comment.
Cutch 2015/10/28 19:50:33 Done.
44 thread->SetThreadInterrupter(NULL, NULL);
45 Profiler::EndExecution(isolate);
46 Monitor* monitor = new Monitor(); 43 Monitor* monitor = new Monitor();
47 monitor->Enter(); 44 monitor->Enter();
48 monitor->Exit(); 45 monitor->Exit();
49 46
50 const int kNumAttempts = 5; 47 const int kNumAttempts = 5;
51 int attempts = 0; 48 int attempts = 0;
52 while (attempts < kNumAttempts) { 49 while (attempts < kNumAttempts) {
53 MonitorLocker ml(monitor); 50 MonitorLocker ml(monitor);
54 int64_t start = OS::GetCurrentTimeMillis(); 51 int64_t start = OS::GetCurrentTimeMillis();
55 int64_t wait_time = 2017; 52 int64_t wait_time = 2017;
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 isolate->thread_registry()->CheckSafepoint(); 578 isolate->thread_registry()->CheckSafepoint();
582 MonitorLocker ml(&done_monitor); 579 MonitorLocker ml(&done_monitor);
583 if (done) { 580 if (done) {
584 break; 581 break;
585 } 582 }
586 } 583 }
587 } 584 }
588 } 585 }
589 586
590 } // namespace dart 587 } // namespace dart
OLDNEW
« runtime/vm/thread_interrupter_win.cc ('K') | « runtime/vm/thread_interrupter_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698