37 virtual bool eof()
const = 0;
49 bool eof()
const override
51 if constexpr (champsim::is_detected_v<has_eof, T>)
57 std::unique_ptr<reader_concept>
pimpl_;
67 auto retval = (*pimpl_)();
75 template <
typename T,
typename F>
78 static_assert(std::is_trivial_v<T>);
79 static_assert(std::is_standard_layout_v<T>);
100 template <
typename It>
103 std::reverse_iterator rbegin{end}, rend{begin};
107 template <
typename T,
typename F>
110 if (std::size(instr_buffer) <= refresh_thresh) {
111 std::array<T, buffer_size - refresh_thresh> trace_read_buf;
112 std::array<char, std::size(trace_read_buf) *
sizeof(T)> raw_buf;
113 std::size_t bytes_read;
116 trace_file.read(std::data(raw_buf), std::size(raw_buf));
117 bytes_read =
static_cast<std::size_t
>(trace_file.gcount());
118 eof_ = trace_file.eof();
121 std::memcpy(std::data(trace_read_buf), std::data(raw_buf), bytes_read);
124 auto begin = std::begin(trace_read_buf);
125 auto end = std::next(begin, bytes_read /
sizeof(T));
126 std::transform(begin, end, std::back_inserter(instr_buffer), [cpu = this->cpu](T t) {
return ooo_model_instr{cpu, t}; });
132 auto retval = instr_buffer.front();
133 instr_buffer.pop_front();
Definition: tracereader.h:77
F trace_file
Definition: tracereader.h:83
bulk_tracereader(uint8_t cpu_idx, std::string tf)
Definition: tracereader.h:92
bulk_tracereader(uint8_t cpu_idx, F &&file)
Definition: tracereader.h:93
bool eof_
Definition: tracereader.h:82
constexpr static std::size_t buffer_size
Definition: tracereader.h:85
std::deque< ooo_model_instr > instr_buffer
Definition: tracereader.h:87
bool eof() const
Definition: tracereader.h:95
constexpr static std::size_t refresh_thresh
Definition: tracereader.h:86
uint8_t cpu
Definition: tracereader.h:78
ooo_model_instr operator()()
Definition: tracereader.h:108
Definition: tracereader.h:32
std::unique_ptr< reader_concept > pimpl_
Definition: tracereader.h:57
auto eof() const
Definition: tracereader.h:72
auto operator()()
Definition: tracereader.h:65
tracereader(T &&val)
Definition: tracereader.h:61
static uint64_t instr_unique_id
Definition: tracereader.h:33
Definition: champsim.h:24
void set_branch_targets(It begin, It end)
Definition: tracereader.h:101
ooo_model_instr apply_branch_target(ooo_model_instr branch, const ooo_model_instr &target)
Definition: tracereader.cc:29
std::string get_fptr_cmd(std::string_view fname)
Definition: tracereader.h:34
virtual ~reader_concept()=default
virtual bool eof() const =0
virtual ooo_model_instr operator()()=0
Definition: tracereader.h:41
reader_model(T &&val)
Definition: tracereader.h:43
decltype(std::declval< U >().eof()) has_eof
Definition: tracereader.h:46
T intern_
Definition: tracereader.h:42
ooo_model_instr operator()() override
Definition: tracereader.h:48
bool eof() const override
Definition: tracereader.h:49
Definition: instruction.h:41
champsim::tracereader get_tracereader(std::string fname, uint8_t cpu, bool is_cloudsuite, bool repeat)
Definition: tracereader.cc:56