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

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

Issue 2680213002: Updated MallocHooks to collect stack traces when memory is allocated. (Closed)
Patch Set: Updated MallocHooks to collect stack traces when memory is allocated. Created 3 years, 9 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 | runtime/vm/dart.cc » ('j') | 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 #ifndef RUNTIME_VM_BENCHMARK_TEST_H_ 5 #ifndef RUNTIME_VM_BENCHMARK_TEST_H_
6 #define RUNTIME_VM_BENCHMARK_TEST_H_ 6 #define RUNTIME_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"
11 #include "vm/globals.h" 11 #include "vm/globals.h"
12 #include "vm/heap.h" 12 #include "vm/heap.h"
13 #include "vm/isolate.h" 13 #include "vm/isolate.h"
14 #include "vm/malloc_hooks.h"
14 #include "vm/object.h" 15 #include "vm/object.h"
15 #include "vm/zone.h" 16 #include "vm/zone.h"
16 17
17 namespace dart { 18 namespace dart {
18 19
19 DECLARE_FLAG(int, code_heap_size); 20 DECLARE_FLAG(int, code_heap_size);
20 DECLARE_FLAG(int, old_gen_growth_space_ratio); 21 DECLARE_FLAG(int, old_gen_growth_space_ratio);
21 22
22 namespace bin { 23 namespace bin {
23 // Snapshot pieces if we link in a snapshot, otherwise initialized to NULL. 24 // Snapshot pieces if we link in a snapshot, otherwise initialized to NULL.
24 extern const uint8_t* vm_snapshot_data; 25 extern const uint8_t* vm_snapshot_data;
25 extern const uint8_t* vm_snapshot_instructions; 26 extern const uint8_t* vm_snapshot_instructions;
26 extern const uint8_t* core_isolate_snapshot_data; 27 extern const uint8_t* core_isolate_snapshot_data;
27 extern const uint8_t* core_isolate_snapshot_instructions; 28 extern const uint8_t* core_isolate_snapshot_instructions;
28 } 29 }
29 30
30 // The BENCHMARK macros are used for benchmarking a specific functionality 31 // The BENCHMARK macros are used for benchmarking a specific functionality
31 // of the VM. 32 // of the VM.
32 #define BENCHMARK_HELPER(name, kind) \ 33 #define BENCHMARK_HELPER(name, kind) \
33 void Dart_Benchmark##name(Benchmark* benchmark); \ 34 void Dart_Benchmark##name(Benchmark* benchmark); \
34 static Benchmark kRegister##name(Dart_Benchmark##name, #name, kind); \ 35 static Benchmark kRegister##name(Dart_Benchmark##name, #name, kind); \
35 static void Dart_BenchmarkHelper##name(Benchmark* benchmark, \ 36 static void Dart_BenchmarkHelper##name(Benchmark* benchmark, \
36 Thread* thread); \ 37 Thread* thread); \
37 void Dart_Benchmark##name(Benchmark* benchmark) { \ 38 void Dart_Benchmark##name(Benchmark* benchmark) { \
39 bool __stack_trace_collection_enabled__ = \
40 MallocHooks::stack_trace_collection_enabled(); \
41 MallocHooks::set_stack_trace_collection_enabled(false); \
38 FLAG_old_gen_growth_space_ratio = 100; \ 42 FLAG_old_gen_growth_space_ratio = 100; \
39 BenchmarkIsolateScope __isolate__(benchmark); \ 43 BenchmarkIsolateScope __isolate__(benchmark); \
40 Thread* __thread__ = Thread::Current(); \ 44 Thread* __thread__ = Thread::Current(); \
41 ASSERT(__thread__->isolate() == benchmark->isolate()); \ 45 ASSERT(__thread__->isolate() == benchmark->isolate()); \
42 StackZone __zone__(__thread__); \ 46 StackZone __zone__(__thread__); \
43 HandleScope __hs__(__thread__); \ 47 HandleScope __hs__(__thread__); \
44 Dart_BenchmarkHelper##name(benchmark, __thread__); \ 48 Dart_BenchmarkHelper##name(benchmark, __thread__); \
49 MallocHooks::set_stack_trace_collection_enabled( \
50 __stack_trace_collection_enabled__); \
45 } \ 51 } \
46 static void Dart_BenchmarkHelper##name(Benchmark* benchmark, Thread* thread) 52 static void Dart_BenchmarkHelper##name(Benchmark* benchmark, Thread* thread)
47 53
48 #define BENCHMARK(name) BENCHMARK_HELPER(name, "RunTime") 54 #define BENCHMARK(name) BENCHMARK_HELPER(name, "RunTime")
49 #define BENCHMARK_SIZE(name) BENCHMARK_HELPER(name, "CodeSize") 55 #define BENCHMARK_SIZE(name) BENCHMARK_HELPER(name, "CodeSize")
50 #define BENCHMARK_MEMORY(name) BENCHMARK_HELPER(name, "MemoryUse") 56 #define BENCHMARK_MEMORY(name) BENCHMARK_HELPER(name, "MemoryUse")
51 57
52 inline Dart_Handle NewString(const char* str) { 58 inline Dart_Handle NewString(const char* str) {
53 return Dart_NewStringFromCString(str); 59 return Dart_NewStringFromCString(str);
54 } 60 }
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 129
124 private: 130 private:
125 Benchmark* benchmark_; 131 Benchmark* benchmark_;
126 132
127 DISALLOW_COPY_AND_ASSIGN(BenchmarkIsolateScope); 133 DISALLOW_COPY_AND_ASSIGN(BenchmarkIsolateScope);
128 }; 134 };
129 135
130 } // namespace dart 136 } // namespace dart
131 137
132 #endif // RUNTIME_VM_BENCHMARK_TEST_H_ 138 #endif // RUNTIME_VM_BENCHMARK_TEST_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/dart.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698