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

Side by Side Diff: runtime/bin/thread_pool_test.cc

Issue 9392003: Fix x64 compilation (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 10 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "bin/thread_pool.h" 5 #include "bin/thread_pool.h"
6 #include "bin/thread.h" 6 #include "bin/thread.h"
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "platform/globals.h" 8 #include "platform/globals.h"
9 #include "vm/unit_test.h" 9 #include "vm/unit_test.h"
10 10
11 11
12 UNIT_TEST_CASE(ThreadPoolStartStop) { 12 UNIT_TEST_CASE(ThreadPoolStartStop) {
13 ThreadPool thread_pool(NULL, 10); 13 ThreadPool thread_pool(NULL, 10);
14 thread_pool.Start(); 14 thread_pool.Start();
15 thread_pool.Shutdown(); 15 thread_pool.Shutdown();
16 } 16 }
17 17
18 18
19 static dart::Monitor* monitor = NULL; 19 static dart::Monitor* monitor = NULL;
20 static uint32_t task_count = 0; 20 static uint32_t task_count = 0;
21 static uint32_t task_sum = 0; 21 static uint32_t task_sum = 0;
22 22
23 23
24 void TestTaskHandler(ThreadPool::Task args) { 24 void TestTaskHandler(ThreadPool::Task args) {
25 MonitorLocker ml(monitor); 25 MonitorLocker ml(monitor);
26 task_count++; 26 task_count++;
27 task_sum += reinterpret_cast<int>(args); 27 task_sum += reinterpret_cast<intptr_t>(args);
28 } 28 }
29 29
30 30
31 UNIT_TEST_CASE(ThreadPoolTest1) { 31 UNIT_TEST_CASE(ThreadPoolTest1) {
32 static const uint32_t kNumTestThreads = 10; 32 static const uint32_t kNumTestThreads = 10;
33 static const uint32_t kNumTestTasks = 1000; 33 static const uint32_t kNumTestTasks = 1000;
34 static const uint32_t kNumLoops = 100; 34 static const uint32_t kNumLoops = 100;
35 monitor = new dart::Monitor(); 35 monitor = new dart::Monitor();
36 ThreadPool thread_pool(&TestTaskHandler, kNumTestThreads); 36 ThreadPool thread_pool(&TestTaskHandler, kNumTestThreads);
37 uint32_t pool_start_count = 0; 37 uint32_t pool_start_count = 0;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 thread_pool.Start(); 79 thread_pool.Start();
80 thread_pool.Shutdown(ThreadPool::kDrain); 80 thread_pool.Shutdown(ThreadPool::kDrain);
81 81
82 // Check that all tasks where processed. 82 // Check that all tasks where processed.
83 EXPECT_EQ(kNumTestTasks, task_count); 83 EXPECT_EQ(kNumTestTasks, task_count);
84 EXPECT_EQ((1 + kNumTestTasks) * (kNumTestTasks / 2), task_sum); 84 EXPECT_EQ((1 + kNumTestTasks) * (kNumTestTasks / 2), task_sum);
85 85
86 delete monitor; 86 delete monitor;
87 monitor = NULL; 87 monitor = NULL;
88 } 88 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698