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

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

Issue 1684073007: Disable background compilation for compile all benchmarks (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: const Created 4 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
« 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 "vm/benchmark_test.h" 5 #include "vm/benchmark_test.h"
6 6
7 #include "bin/builtin.h" 7 #include "bin/builtin.h"
8 #include "bin/file.h" 8 #include "bin/file.h"
9 #include "bin/isolate_data.h" 9 #include "bin/isolate_data.h"
10 10
11 #include "platform/assert.h" 11 #include "platform/assert.h"
12 #include "platform/globals.h" 12 #include "platform/globals.h"
13 13
14 #include "vm/compiler_stats.h" 14 #include "vm/compiler_stats.h"
15 #include "vm/dart_api_impl.h" 15 #include "vm/dart_api_impl.h"
16 #include "vm/stack_frame.h" 16 #include "vm/stack_frame.h"
17 #include "vm/unit_test.h" 17 #include "vm/unit_test.h"
18 18
19 using dart::bin::File; 19 using dart::bin::File;
20 20
21 namespace dart { 21 namespace dart {
22 22
23 DECLARE_FLAG(bool, background_compilation);
24
23 Benchmark* Benchmark::first_ = NULL; 25 Benchmark* Benchmark::first_ = NULL;
24 Benchmark* Benchmark::tail_ = NULL; 26 Benchmark* Benchmark::tail_ = NULL;
25 const char* Benchmark::executable_ = NULL; 27 const char* Benchmark::executable_ = NULL;
26 28
27 void Benchmark::RunAll(const char* executable) { 29 void Benchmark::RunAll(const char* executable) {
28 SetExecutable(executable); 30 SetExecutable(executable);
29 Benchmark* benchmark = first_; 31 Benchmark* benchmark = first_;
30 while (benchmark != NULL) { 32 while (benchmark != NULL) {
31 benchmark->RunBenchmark(); 33 benchmark->RunBenchmark();
32 benchmark = benchmark->next_; 34 benchmark = benchmark->next_;
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 reinterpret_cast<Dart_NativeEntryResolver>(NativeResolver)); 333 reinterpret_cast<Dart_NativeEntryResolver>(NativeResolver));
332 EXPECT_VALID(lib); 334 EXPECT_VALID(lib);
333 } else { 335 } else {
334 Dart_Handle lib = TestCase::LoadTestScript( 336 Dart_Handle lib = TestCase::LoadTestScript(
335 "import 'pkg/compiler/lib/compiler.dart';", 337 "import 'pkg/compiler/lib/compiler.dart';",
336 reinterpret_cast<Dart_NativeEntryResolver>(NativeResolver)); 338 reinterpret_cast<Dart_NativeEntryResolver>(NativeResolver));
337 EXPECT_VALID(lib); 339 EXPECT_VALID(lib);
338 } 340 }
339 Timer timer(true, "Compile all of dart2js benchmark"); 341 Timer timer(true, "Compile all of dart2js benchmark");
340 timer.Start(); 342 timer.Start();
343 const bool old_flag = FLAG_background_compilation;
344 FLAG_background_compilation = false;
341 Dart_Handle result = Dart_CompileAll(); 345 Dart_Handle result = Dart_CompileAll();
346 FLAG_background_compilation = old_flag;
342 EXPECT_VALID(result); 347 EXPECT_VALID(result);
343 timer.Stop(); 348 timer.Stop();
344 int64_t elapsed_time = timer.TotalElapsedTime(); 349 int64_t elapsed_time = timer.TotalElapsedTime();
345 benchmark->set_score(elapsed_time); 350 benchmark->set_score(elapsed_time);
346 free(dart_root); 351 free(dart_root);
347 free(script); 352 free(script);
348 } 353 }
349 354
350 355
351 BENCHMARK(Dart2JSCompilerStats) { 356 BENCHMARK(Dart2JSCompilerStats) {
(...skipping 14 matching lines...) Expand all
366 Dart_Handle lib = TestCase::LoadTestScript( 371 Dart_Handle lib = TestCase::LoadTestScript(
367 "import 'pkg/compiler/lib/compiler.dart';", 372 "import 'pkg/compiler/lib/compiler.dart';",
368 reinterpret_cast<Dart_NativeEntryResolver>(NativeResolver)); 373 reinterpret_cast<Dart_NativeEntryResolver>(NativeResolver));
369 EXPECT_VALID(lib); 374 EXPECT_VALID(lib);
370 } 375 }
371 CompilerStats* stats = thread->isolate()->compiler_stats(); 376 CompilerStats* stats = thread->isolate()->compiler_stats();
372 ASSERT(stats != NULL); 377 ASSERT(stats != NULL);
373 stats->EnableBenchmark(); 378 stats->EnableBenchmark();
374 Timer timer(true, "Compile all of dart2js benchmark"); 379 Timer timer(true, "Compile all of dart2js benchmark");
375 timer.Start(); 380 timer.Start();
381 const bool old_flag = FLAG_background_compilation;
382 FLAG_background_compilation = false;
376 Dart_Handle result = Dart_CompileAll(); 383 Dart_Handle result = Dart_CompileAll();
384 FLAG_background_compilation = old_flag;
377 EXPECT_VALID(result); 385 EXPECT_VALID(result);
378 timer.Stop(); 386 timer.Stop();
379 int64_t elapsed_time = timer.TotalElapsedTime(); 387 int64_t elapsed_time = timer.TotalElapsedTime();
380 benchmark->set_score(elapsed_time); 388 benchmark->set_score(elapsed_time);
381 free(dart_root); 389 free(dart_root);
382 free(script); 390 free(script);
383 } 391 }
384 392
385 393
386 // 394 //
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 thread); 709 thread);
702 reader.ReadObject(); 710 reader.ReadObject();
703 free(buffer); 711 free(buffer);
704 } 712 }
705 timer.Stop(); 713 timer.Stop();
706 int64_t elapsed_time = timer.TotalElapsedTime(); 714 int64_t elapsed_time = timer.TotalElapsedTime();
707 benchmark->set_score(elapsed_time); 715 benchmark->set_score(elapsed_time);
708 } 716 }
709 717
710 } // namespace dart 718 } // namespace dart
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