Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef V8_BASIC_BLOCK_PROFILER_H_ | |
| 6 #define V8_BASIC_BLOCK_PROFILER_H_ | |
| 7 | |
| 8 #include <list> | |
| 9 | |
| 10 #include "src/v8.h" | |
| 11 | |
| 12 namespace v8 { | |
| 13 namespace internal { | |
| 14 | |
| 15 class Schedule; | |
| 16 class Graph; | |
| 17 | |
| 18 class BasicBlockProfiler { | |
| 19 public: | |
| 20 class Data { | |
| 21 public: | |
| 22 void SetCode(OStringStream* os); | |
| 23 void SetFunctionName(OStringStream* os); | |
| 24 void SetSchedule(OStringStream* os); | |
| 25 size_t n_blocks() const { return n_blocks_; } | |
| 26 int* block_ids() { return &block_ids_[0]; } | |
|
titzer
2014/09/24 14:59:31
set_block_id(int block, int id) and hide it?
dcarney
2014/09/25 08:15:14
Done.
| |
| 27 const int* block_ids() const { return &block_ids_[0]; } | |
| 28 uint32_t* counts() { return &counts_[0]; } | |
| 29 const uint32_t* counts() const { return &counts_[0]; } | |
| 30 | |
| 31 private: | |
| 32 friend class BasicBlockProfiler; | |
| 33 friend OStream& operator<<(OStream& os, const BasicBlockProfiler::Data& s); | |
| 34 | |
| 35 explicit Data(size_t n_blocks); | |
| 36 ~Data(); | |
| 37 | |
| 38 void ResetCounts(); | |
| 39 | |
| 40 const size_t n_blocks_; | |
| 41 std::vector<int> block_ids_; | |
| 42 std::vector<uint32_t> counts_; | |
| 43 std::string function_name_; | |
| 44 std::string schedule_; | |
| 45 std::string code_; | |
| 46 DISALLOW_COPY_AND_ASSIGN(Data); | |
| 47 }; | |
| 48 | |
| 49 typedef std::list<Data*> DataList; | |
| 50 | |
| 51 BasicBlockProfiler(); | |
| 52 ~BasicBlockProfiler(); | |
| 53 | |
| 54 Data* NewData(size_t n_blocks); | |
| 55 void ResetCounts(); | |
| 56 | |
| 57 const DataList* data_list() { return &data_list_; } | |
| 58 | |
| 59 private: | |
| 60 friend OStream& operator<<(OStream& os, const BasicBlockProfiler& s); | |
| 61 | |
| 62 DataList data_list_; | |
| 63 | |
| 64 DISALLOW_COPY_AND_ASSIGN(BasicBlockProfiler); | |
| 65 }; | |
| 66 | |
| 67 OStream& operator<<(OStream& os, const BasicBlockProfiler& s); | |
| 68 OStream& operator<<(OStream& os, const BasicBlockProfiler::Data& s); | |
| 69 | |
| 70 } // namespace internal | |
| 71 } // namespace v8 | |
| 72 | |
| 73 #endif // V8_BASIC_BLOCK_PROFILER_H_ | |
| OLD | NEW |