OpenASIP 2.2
Loading...
Searching...
No Matches
ExecutionTrace.hh
Go to the documentation of this file.
1/*
2 Copyright (c) 2002-2009 Tampere University.
3
4 This file is part of TTA-Based Codesign Environment (TCE).
5
6 Permission is hereby granted, free of charge, to any person obtaining a
7 copy of this software and associated documentation files (the "Software"),
8 to deal in the Software without restriction, including without limitation
9 the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 and/or sell copies of the Software, and to permit persons to whom the
11 Software is furnished to do so, subject to the following conditions:
12
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 DEALINGS IN THE SOFTWARE.
23 */
24/**
25 * @file ExecutionTrace.hh
26 *
27 * Declaration of ExecutionTrace class.
28 *
29 * @author Pekka Jääskeläinen 2004,2009 (pjaaskel-no.spam-cs.tut.fi)
30 */
31
32#ifndef TTA_EXECUTION_TRACE_HH
33#define TTA_EXECUTION_TRACE_HH
34
35#include <string>
36#include <vector>
37#include <list>
38#include <fstream>
39
40#include "boost/tuple/tuple.hpp"
41
42#include "SimValue.hh"
43#include "FileSystem.hh"
44#include "RelationalDB.hh"
45#include "SimulatorConstants.hh"
46
47
49
50/**
51 * The main class of the Execution Trace Database (TraceDB).
52 *
53 * Access to the execution trace database happens through the interface of
54 * this class.
55 */
57public:
58
59 /// a type for storing address space identifiers
60 typedef std::string AddressSpaceID;
61
62 /// a type for storing bus identifiers
63 typedef std::string BusID;
64
65 /// a type for storing socket identifiers
66 typedef std::string SocketID;
67
68 /// a type for storing bus segment identifiers
69 typedef std::string SegmentID;
70
71 /// a type for storing function unit identifiers
72 typedef std::string FunctionUnitID;
73
74 /// a type for storing operation identifiers
75 typedef std::string OperationID;
76
77 /// a type for storing register file identifiers
78 typedef std::string RegisterFileID;
79
80 /// a type for storing register ids
81 typedef int RegisterID;
82
83 /// a type for storing memory addresses
84 typedef unsigned int MemoryAddress;
85
86 /// a type for storing data of size of the minimum addressable unit
87 typedef SimValue MAU;
88
89 /// a type for register access counts
90 typedef std::size_t RegisterAccessCount;
91
92 /// a type for operation trigger counts
94
95 /// a type for storing procedure entry type (entry/exit)
97 PT_ENTRY = 0, ///< procedure entry
98 PT_EXIT = 1 ///< procedure exit
99 };
100
101 /// type to be used as a key for storing concurrent RF access info
102 typedef boost::tuple<
103 RegisterAccessCount, /* concurrent reads */
104 RegisterAccessCount, /* concurrent writes */
106
107 /// type to be used for a list of concurrent RF accesses
108 typedef std::list<ConcurrentRFAccessCount> ConcurrentRFAccessCountList;
109
110 /// type to be used as a key for storing function unit operation execution
111 /// counts
112 typedef boost::tuple<OperationID, OperationTriggerCount>
114
115 /// type to be used for lists of function operation execution counts
116 typedef std::list<FUOperationTriggerCount> FUOperationTriggerCountList;
117
119 ClockCycleCount cycle, InstructionAddress address);
120
122 InstructionAddress address, ClockCycleCount count);
123
125 InstructionAddress firstAddress, InstructionAddress lastAddress,
126 const std::string& procedureName);
127
129
131
133 ClockCycleCount cycle,
134 const AddressSpaceID& addressSpace,
135 MemoryAddress address,
136 bool write,
137 std::size_t size,
138 const std::vector<MAU>* data = NULL);
139
141
143
144 void addBusActivity(
145 ClockCycleCount cycle, const BusID& busId, const SegmentID& segmentId,
146 bool squash, const SimValue& data = NullSimValue::instance());
147
149 RegisterFileID registerFile, RegisterAccessCount reads,
151
153 RegisterFileID registerFile, RegisterID registerIndex,
154 ClockCycleCount reads, ClockCycleCount writes);
155
157 RegisterFileID registerFile) const;
158
160 FunctionUnitID functionUnit, OperationID operation,
162
164 ClockCycleCount cycle, InstructionAddress address,
165 InstructionAddress sourceAddress, ProcedureEntryType type);
166
168 FunctionUnitID functionUnit) const;
169
171
173
174 void addBusWriteCount(BusID socket, ClockCycleCount count);
175
177
179
181
183
184 static ExecutionTrace* open(const std::string& fileName);
185
186 virtual ~ExecutionTrace();
187
188protected:
189
190 ExecutionTrace(const std::string& fileName, bool readOnly);
191 void open();
192
193private:
194 void initialize();
195
196 /// Filename of the trace database (sqlite file).
197 const std::string& fileName_;
198 /// The call trace file.
199 std::fstream callTrace_;
200 /// The instruction profile file.
202 /// Is the database access mode read-only?
204 /// Handle to the sqlite trace database.
206 /// Handle to the database connection;
208 /// Handle object for the queries of instruction executions.
210
211};
212
213#endif
UInt32 InstructionAddress
Definition BaseType.hh:175
CycleCount ClockCycleCount
Alias for ClockCycleCount.
void addBasicBlockStart(ClockCycleCount cycle, InstructionAddress address)
SimValue MAU
a type for storing data of size of the minimum addressable unit
void addLockedCycle(ClockCycleCount cycle)
RelationalDB * db_
Handle to the sqlite trace database.
void addFunctionUnitOperationTriggerCount(FunctionUnitID functionUnit, OperationID operation, OperationTriggerCount count)
std::list< ConcurrentRFAccessCount > ConcurrentRFAccessCountList
type to be used for a list of concurrent RF accesses
std::string OperationID
a type for storing operation identifiers
ProcedureEntryType
a type for storing procedure entry type (entry/exit)
@ PT_EXIT
procedure exit
@ PT_ENTRY
procedure entry
void addProcedureExit(ClockCycleCount cycle, InstructionAddress address)
void addConcurrentRegisterFileAccessCount(RegisterFileID registerFile, RegisterAccessCount reads, RegisterAccessCount writes, ClockCycleCount count)
virtual ~ExecutionTrace()
ClockCycleCount OperationTriggerCount
a type for operation trigger counts
void addProcedureTransfer(ClockCycleCount cycle, InstructionAddress address, InstructionAddress sourceAddress, ProcedureEntryType type)
boost::tuple< RegisterAccessCount, RegisterAccessCount, ClockCycleCount > ConcurrentRFAccessCount
type to be used as a key for storing concurrent RF access info
InstructionExecution * instructionExecution_
Handle object for the queries of instruction executions.
void addMemoryAccess(ClockCycleCount cycle, const AddressSpaceID &addressSpace, MemoryAddress address, bool write, std::size_t size, const std::vector< MAU > *data=NULL)
std::string AddressSpaceID
a type for storing address space identifiers
std::fstream callTrace_
The call trace file.
std::string SocketID
a type for storing socket identifiers
InstructionExecution & instructionExecutions()
void addBusActivity(ClockCycleCount cycle, const BusID &busId, const SegmentID &segmentId, bool squash, const SimValue &data=NullSimValue::instance())
std::fstream instructionProfile_
The instruction profile file.
std::string FunctionUnitID
a type for storing function unit identifiers
bool readOnly_
Is the database access mode read-only?
void addProcedureAddressRange(InstructionAddress firstAddress, InstructionAddress lastAddress, const std::string &procedureName)
ClockCycleCount simulatedCycleCount() const
ConcurrentRFAccessCountList * registerFileAccessCounts(RegisterFileID registerFile) const
std::size_t RegisterAccessCount
a type for register access counts
void addBusWriteCount(BusID socket, ClockCycleCount count)
std::string RegisterFileID
a type for storing register file identifiers
void addInstructionExecutionCount(InstructionAddress address, ClockCycleCount count)
RelationalDBConnection * dbConnection_
Handle to the database connection;.
void addRegisterAccessCount(RegisterFileID registerFile, RegisterID registerIndex, ClockCycleCount reads, ClockCycleCount writes)
void addInstructionExecution(ClockCycleCount cycle, InstructionAddress address)
void setSimulatedCycleCount(ClockCycleCount count)
std::list< FUOperationTriggerCount > FUOperationTriggerCountList
type to be used for lists of function operation execution counts
ClockCycleCount socketWriteCount(SocketID socket) const
const std::string & fileName_
Filename of the trace database (sqlite file).
int RegisterID
a type for storing register ids
FUOperationTriggerCountList * functionUnitOperationTriggerCounts(FunctionUnitID functionUnit) const
std::string BusID
a type for storing bus identifiers
void addProcedureEntry(ClockCycleCount cycle, InstructionAddress address)
ClockCycleCount busWriteCount(BusID bus) const
void addSocketWriteCount(SocketID socket, ClockCycleCount)
std::string SegmentID
a type for storing bus segment identifiers
boost::tuple< OperationID, OperationTriggerCount > FUOperationTriggerCount
type to be used as a key for storing function unit operation execution counts
unsigned int MemoryAddress
a type for storing memory addresses
static SimValue & instance()
Definition SimValue.cc:1642