OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_BASIC_BLOCK_PROFILER_H_ | 5 #ifndef V8_BASIC_BLOCK_PROFILER_H_ |
6 #define V8_BASIC_BLOCK_PROFILER_H_ | 6 #define V8_BASIC_BLOCK_PROFILER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 | 9 |
10 #include "src/v8.h" | 10 #include "src/v8.h" |
11 | 11 |
12 namespace v8 { | 12 namespace v8 { |
13 namespace internal { | 13 namespace internal { |
14 | 14 |
15 class Schedule; | 15 class Schedule; |
16 class Graph; | 16 class Graph; |
17 | 17 |
18 class BasicBlockProfiler { | 18 class BasicBlockProfiler { |
19 public: | 19 public: |
20 class Data { | 20 class Data { |
21 public: | 21 public: |
22 size_t n_blocks() const { return n_blocks_; } | 22 size_t n_blocks() const { return n_blocks_; } |
23 const uint32_t* counts() const { return &counts_[0]; } | 23 const uint32_t* counts() const { return &counts_[0]; } |
24 | 24 |
25 void SetCode(OStringStream* os); | 25 void SetCode(OStringStream* os); |
26 void SetFunctionName(OStringStream* os); | 26 void SetFunctionName(OStringStream* os); |
27 void SetSchedule(OStringStream* os); | 27 void SetSchedule(OStringStream* os); |
28 void SetBlockId(size_t offset, int block_id); | 28 void SetBlockId(size_t offset, size_t block_id); |
29 uint32_t* GetCounterAddress(size_t offset); | 29 uint32_t* GetCounterAddress(size_t offset); |
30 | 30 |
31 private: | 31 private: |
32 friend class BasicBlockProfiler; | 32 friend class BasicBlockProfiler; |
33 friend OStream& operator<<(OStream& os, const BasicBlockProfiler::Data& s); | 33 friend OStream& operator<<(OStream& os, const BasicBlockProfiler::Data& s); |
34 | 34 |
35 explicit Data(size_t n_blocks); | 35 explicit Data(size_t n_blocks); |
36 ~Data(); | 36 ~Data(); |
37 | 37 |
38 void ResetCounts(); | 38 void ResetCounts(); |
39 | 39 |
40 const size_t n_blocks_; | 40 const size_t n_blocks_; |
41 std::vector<int> block_ids_; | 41 std::vector<size_t> block_ids_; |
42 std::vector<uint32_t> counts_; | 42 std::vector<uint32_t> counts_; |
43 std::string function_name_; | 43 std::string function_name_; |
44 std::string schedule_; | 44 std::string schedule_; |
45 std::string code_; | 45 std::string code_; |
46 DISALLOW_COPY_AND_ASSIGN(Data); | 46 DISALLOW_COPY_AND_ASSIGN(Data); |
47 }; | 47 }; |
48 | 48 |
49 typedef std::list<Data*> DataList; | 49 typedef std::list<Data*> DataList; |
50 | 50 |
51 BasicBlockProfiler(); | 51 BasicBlockProfiler(); |
(...skipping 12 matching lines...) Expand all Loading... |
64 DISALLOW_COPY_AND_ASSIGN(BasicBlockProfiler); | 64 DISALLOW_COPY_AND_ASSIGN(BasicBlockProfiler); |
65 }; | 65 }; |
66 | 66 |
67 OStream& operator<<(OStream& os, const BasicBlockProfiler& s); | 67 OStream& operator<<(OStream& os, const BasicBlockProfiler& s); |
68 OStream& operator<<(OStream& os, const BasicBlockProfiler::Data& s); | 68 OStream& operator<<(OStream& os, const BasicBlockProfiler::Data& s); |
69 | 69 |
70 } // namespace internal | 70 } // namespace internal |
71 } // namespace v8 | 71 } // namespace v8 |
72 | 72 |
73 #endif // V8_BASIC_BLOCK_PROFILER_H_ | 73 #endif // V8_BASIC_BLOCK_PROFILER_H_ |
OLD | NEW |