gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CacheRecorder.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 1999-2012 Mark D. Hill and David A. Wood
3  * Copyright (c) 2010 Advanced Micro Devices, Inc.
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are
8  * met: redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer;
10  * redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution;
13  * neither the name of the copyright holders nor the names of its
14  * contributors may be used to endorse or promote products derived from
15  * this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 /*
31  * Recording cache requests made to a ruby cache at certain ruby
32  * time. Also dump the requests to a gziped file.
33  */
34 
35 #ifndef __MEM_RUBY_RECORDER_CACHERECORDER_HH__
36 #define __MEM_RUBY_RECORDER_CACHERECORDER_HH__
37 
38 #include <vector>
39 
40 #include "base/types.hh"
41 #include "mem/protocol/RubyRequestType.hh"
45 
46 class Sequencer;
47 
54 class TraceRecord {
55  public:
60  RubyRequestType m_type;
61  uint8_t m_data[0];
62 
63  void print(std::ostream& out) const;
64 };
65 
67 {
68  public:
69  CacheRecorder();
71 
72  CacheRecorder(uint8_t* uncompressed_trace,
73  uint64_t uncompressed_trace_size,
74  std::vector<Sequencer*>& SequencerMap,
75  uint64_t block_size_bytes);
76  void addRecord(int cntrl, Addr data_addr, Addr pc_addr,
77  RubyRequestType type, Tick time, DataBlock& data);
78 
79  uint64_t aggregateRecords(uint8_t **data, uint64_t size);
80 
90 
99 
100  private:
101  // Private copy constructor and assignment operator
102  CacheRecorder(const CacheRecorder& obj);
104 
109  uint64_t m_bytes_read;
110  uint64_t m_records_read;
113 };
114 
115 inline bool
117 {
118  return n1->m_time > n2->m_time;
119 }
120 
121 inline std::ostream&
122 operator<<(std::ostream& out, const TraceRecord& obj)
123 {
124  obj.print(out);
125  out << std::flush;
126  return out;
127 }
128 
129 #endif // __MEM_RUBY_RECORDER_CACHERECORDER_HH__
void enqueueNextFetchRequest()
Function for fetching warming up the memory and the caches.
void print(std::ostream &out) const
uint64_t aggregateRecords(uint8_t **data, uint64_t size)
void addRecord(int cntrl, Addr data_addr, Addr pc_addr, RubyRequestType type, Tick time, DataBlock &data)
std::vector< TraceRecord * > m_records
const char data[]
Definition: circlebuf.cc:43
RubyRequestType m_type
uint64_t m_bytes_read
Addr m_data_address
Class for recording cache contents.
std::vector< Sequencer * > m_seq_map
void enqueueNextFlushRequest()
Function for flushing the memory contents of the caches to the main memory.
uint64_t m_records_flushed
uint64_t Tick
Tick count type.
Definition: types.hh:63
uint64_t m_block_size_bytes
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,16,32,64}_t.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
bool compareTraceRecords(const TraceRecord *n1, const TraceRecord *n2)
uint8_t * m_uncompressed_trace
type
Definition: misc.hh:728
int size()
Definition: pagetable.hh:146
std::ostream & operator<<(std::ostream &out, const TraceRecord &obj)
uint64_t m_uncompressed_trace_size
uint64_t m_records_read
CacheRecorder & operator=(const CacheRecorder &obj)
uint8_t m_data[0]

Generated on Fri Jun 9 2017 13:03:50 for gem5 by doxygen 1.8.6