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

Unified Diff: runtime/vm/thread_interrupter_test.cc

Issue 1423473004: Switch profiler from isolates to threads [second landing] (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/thread_interrupter_macos.cc ('k') | runtime/vm/thread_interrupter_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/thread_interrupter_test.cc
diff --git a/runtime/vm/thread_interrupter_test.cc b/runtime/vm/thread_interrupter_test.cc
deleted file mode 100644
index aeb9ff188f8d7c79bc106dc5d2430cc6def59247..0000000000000000000000000000000000000000
--- a/runtime/vm/thread_interrupter_test.cc
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-#include "platform/assert.h"
-
-#include "vm/dart_api_impl.h"
-#include "vm/dart_api_state.h"
-#include "vm/globals.h"
-#include "vm/thread_interrupter.h"
-#include "vm/unit_test.h"
-
-namespace dart {
-
-class ThreadInterrupterTestHelper : public AllStatic {
- public:
- static void InterruptTest(const intptr_t run_time, const intptr_t period) {
- const double allowed_error = 0.25; // +/- 25%
- intptr_t count = 0;
- Thread::EnsureInit();
- Thread* thread = Thread::Current();
- thread->SetThreadInterrupter(IncrementCallback, &count);
- ThreadInterrupter::SetInterruptPeriod(period);
- OS::Sleep(run_time * kMillisecondsPerSecond);
- thread->SetThreadInterrupter(NULL, NULL);
- intptr_t run_time_micros = run_time * kMicrosecondsPerSecond;
- intptr_t expected_interrupts = run_time_micros / period;
- intptr_t error = allowed_error * expected_interrupts;
- intptr_t low_bar = expected_interrupts - error;
- intptr_t high_bar = expected_interrupts + error;
- EXPECT_GE(count, low_bar);
- EXPECT_LE(count, high_bar);
- }
-
- static void IncrementCallback(const InterruptedThreadState& state,
- void* data) {
- ASSERT(data != NULL);
- intptr_t* counter = reinterpret_cast<intptr_t*>(data);
- *counter = *counter + 1;
- }
-};
-
-
-TEST_CASE(ThreadInterrupterHigh) {
- const intptr_t kRunTimeSeconds = 5;
- const intptr_t kInterruptPeriodMicros = 250;
- ThreadInterrupterTestHelper::InterruptTest(kRunTimeSeconds,
- kInterruptPeriodMicros);
-}
-
-TEST_CASE(ThreadInterrupterMedium) {
- const intptr_t kRunTimeSeconds = 5;
- const intptr_t kInterruptPeriodMicros = 500;
- ThreadInterrupterTestHelper::InterruptTest(kRunTimeSeconds,
- kInterruptPeriodMicros);
-}
-
-TEST_CASE(ThreadInterrupterLow) {
- const intptr_t kRunTimeSeconds = 5;
- const intptr_t kInterruptPeriodMicros = 1000;
- ThreadInterrupterTestHelper::InterruptTest(kRunTimeSeconds,
- kInterruptPeriodMicros);
-}
-
-
-} // namespace dart
« no previous file with comments | « runtime/vm/thread_interrupter_macos.cc ('k') | runtime/vm/thread_interrupter_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698