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

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

Issue 20147002: Add a VM benchmark for creating the local MirrorSystem. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 5 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 "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 9
10 #include "platform/assert.h" 10 #include "platform/assert.h"
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 Api::CheckIsolateState(Isolate::Current()); 448 Api::CheckIsolateState(Isolate::Current());
449 449
450 // Write snapshot with object content. 450 // Write snapshot with object content.
451 FullSnapshotWriter writer(&buffer, &malloc_allocator); 451 FullSnapshotWriter writer(&buffer, &malloc_allocator);
452 writer.WriteFullSnapshot(); 452 writer.WriteFullSnapshot();
453 const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer); 453 const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer);
454 ASSERT(snapshot->kind() == Snapshot::kFull); 454 ASSERT(snapshot->kind() == Snapshot::kFull);
455 benchmark->set_score(snapshot->length()); 455 benchmark->set_score(snapshot->length());
456 } 456 }
457 457
458
459 BENCHMARK(CreateMirrorSystem) {
460 const char* kScriptChars =
461 "import 'dart:mirrors';\n"
462 "\n"
463 "void benchmark() {\n"
464 " currentMirrorSystem();\n"
465 "}\n";
466
467 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
468 Dart_Handle args[0];
469
470 Timer timer(true, "currentMirrorSystem() benchmark");
471 timer.Start();
472 Dart_Invoke(lib, NewString("benchmark"), 0, args);
473 timer.Stop();
474 int64_t elapsed_time = timer.TotalElapsedTime();
475 benchmark->set_score(elapsed_time);
476 }
477
458 } // namespace dart 478 } // 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