| OLD | NEW |
| 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 #ifndef VM_BENCHMARK_TEST_H_ | 5 #ifndef VM_BENCHMARK_TEST_H_ |
| 6 #define VM_BENCHMARK_TEST_H_ | 6 #define VM_BENCHMARK_TEST_H_ |
| 7 | 7 |
| 8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
| 9 | 9 |
| 10 #include "vm/dart.h" | 10 #include "vm/dart.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 first_ = this; | 64 first_ = this; |
| 65 } else { | 65 } else { |
| 66 tail_->next_ = this; | 66 tail_->next_ = this; |
| 67 } | 67 } |
| 68 tail_ = this; | 68 tail_ = this; |
| 69 } | 69 } |
| 70 | 70 |
| 71 // Accessors. | 71 // Accessors. |
| 72 const char* name() const { return name_; } | 72 const char* name() const { return name_; } |
| 73 const char* score_kind() const { return score_kind_; } | 73 const char* score_kind() const { return score_kind_; } |
| 74 void set_score(intptr_t value) { score_ = value; } | 74 void set_score(int64_t value) { score_ = value; } |
| 75 intptr_t score() const { return score_; } | 75 int64_t score() const { return score_; } |
| 76 Isolate* isolate() const { return reinterpret_cast<Isolate*>(isolate_); } | 76 Isolate* isolate() const { return reinterpret_cast<Isolate*>(isolate_); } |
| 77 | 77 |
| 78 Dart_Isolate CreateIsolate(const uint8_t* buffer) { | 78 Dart_Isolate CreateIsolate(const uint8_t* buffer) { |
| 79 char* err = NULL; | 79 char* err = NULL; |
| 80 isolate_ = Dart_CreateIsolate(NULL, NULL, buffer, NULL, &err); | 80 isolate_ = Dart_CreateIsolate(NULL, NULL, buffer, NULL, &err); |
| 81 EXPECT(isolate_ != NULL); | 81 EXPECT(isolate_ != NULL); |
| 82 free(err); | 82 free(err); |
| 83 return isolate_; | 83 return isolate_; |
| 84 } | 84 } |
| 85 | 85 |
| 86 void Run() { (*run_)(this); } | 86 void Run() { (*run_)(this); } |
| 87 void RunBenchmark(); | 87 void RunBenchmark(); |
| 88 | 88 |
| 89 static void RunAll(const char* executable); | 89 static void RunAll(const char* executable); |
| 90 static void SetExecutable(const char* arg) { executable_ = arg; } | 90 static void SetExecutable(const char* arg) { executable_ = arg; } |
| 91 static const char* Executable() { return executable_; } | 91 static const char* Executable() { return executable_; } |
| 92 | 92 |
| 93 private: | 93 private: |
| 94 static Benchmark* first_; | 94 static Benchmark* first_; |
| 95 static Benchmark* tail_; | 95 static Benchmark* tail_; |
| 96 static const char* executable_; | 96 static const char* executable_; |
| 97 | 97 |
| 98 RunEntry* const run_; | 98 RunEntry* const run_; |
| 99 const char* name_; | 99 const char* name_; |
| 100 const char* score_kind_; | 100 const char* score_kind_; |
| 101 intptr_t score_; | 101 int64_t score_; |
| 102 Dart_Isolate isolate_; | 102 Dart_Isolate isolate_; |
| 103 Benchmark* next_; | 103 Benchmark* next_; |
| 104 | 104 |
| 105 DISALLOW_COPY_AND_ASSIGN(Benchmark); | 105 DISALLOW_COPY_AND_ASSIGN(Benchmark); |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 | 108 |
| 109 class BenchmarkIsolateScope { | 109 class BenchmarkIsolateScope { |
| 110 public: | 110 public: |
| 111 explicit BenchmarkIsolateScope(Benchmark* benchmark) : benchmark_(benchmark) { | 111 explicit BenchmarkIsolateScope(Benchmark* benchmark) : benchmark_(benchmark) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 122 | 122 |
| 123 private: | 123 private: |
| 124 Benchmark* benchmark_; | 124 Benchmark* benchmark_; |
| 125 | 125 |
| 126 DISALLOW_COPY_AND_ASSIGN(BenchmarkIsolateScope); | 126 DISALLOW_COPY_AND_ASSIGN(BenchmarkIsolateScope); |
| 127 }; | 127 }; |
| 128 | 128 |
| 129 } // namespace dart | 129 } // namespace dart |
| 130 | 130 |
| 131 #endif // VM_BENCHMARK_TEST_H_ | 131 #endif // VM_BENCHMARK_TEST_H_ |
| OLD | NEW |