OpenASIP  2.0
CallPathTracker.hh
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2010 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 CallPathTracker.hh
26  *
27  * @author Pekka Jääskeläinen 2010
28  */
29 
30 #ifndef TTA_CALL_PATH_TRACKER_HH
31 #define TTA_CALL_PATH_TRACKER_HH
32 
33 #include <deque>
34 
35 #include "Listener.hh"
36 #include "SimulatorConstants.hh"
38 
39 class SimulatorFrontend;
40 
41 namespace TTAProgram {
42  class Instruction;
43 }
44 
45 /**
46  * Tracks procedure transfers in the simulated program and stores
47  * them in memory for quick viewing during simulation/debugging.
48  *
49  * There should be one instance of this tracker for each tracked core.
50  */
52 public:
57  bool isEntry;
58  };
59 
60  typedef std::deque<ProcedureTransfer> ProcedureTransferQueue;
61 
63  SimulatorFrontend& subject,
64  unsigned,
65  int historyLength) :
66  ProcedureTransferTracker(subject),
67  historyLength_(historyLength) {}
68  virtual ~CallPathTracker() {}
69 
70  virtual void addProcedureTransfer(
71  ClockCycleCount cycle,
72  InstructionAddress address,
73  InstructionAddress sourceAddress,
74  bool isEntry);
75 
76  const ProcedureTransferQueue& transfers() const { return transfers_; }
77 
78  const ProcedureTransferQueue backTrace() const;
79 
80 private:
81  /// max number of last calls/returns to store
82  std::size_t historyLength_;
83  /// the transfers are stored in a queue of which size is kept
84  /// under historyLength_
86 };
87 
88 #endif
TTAProgram
Definition: Estimator.hh:65
ProcedureTransferTracker
Definition: ProcedureTransferTracker.hh:51
InstructionAddress
UInt32 InstructionAddress
Definition: BaseType.hh:175
CallPathTracker::CallPathTracker
CallPathTracker(SimulatorFrontend &subject, unsigned, int historyLength)
Definition: CallPathTracker.hh:62
CallPathTracker::ProcedureTransfer::sourceAddress
InstructionAddress sourceAddress
Definition: CallPathTracker.hh:56
CallPathTracker::transfers_
ProcedureTransferQueue transfers_
the transfers are stored in a queue of which size is kept under historyLength_
Definition: CallPathTracker.hh:85
CallPathTracker::transfers
const ProcedureTransferQueue & transfers() const
Definition: CallPathTracker.hh:76
CallPathTracker::ProcedureTransferQueue
std::deque< ProcedureTransfer > ProcedureTransferQueue
Definition: CallPathTracker.hh:60
CallPathTracker::ProcedureTransfer::cycle
ClockCycleCount cycle
Definition: CallPathTracker.hh:54
SimulatorConstants.hh
CallPathTracker
Definition: CallPathTracker.hh:51
CallPathTracker::ProcedureTransfer::address
InstructionAddress address
Definition: CallPathTracker.hh:55
ProcedureTransferTracker.hh
CallPathTracker::historyLength_
std::size_t historyLength_
max number of last calls/returns to store
Definition: CallPathTracker.hh:82
CallPathTracker::ProcedureTransfer
Definition: CallPathTracker.hh:53
CallPathTracker::addProcedureTransfer
virtual void addProcedureTransfer(ClockCycleCount cycle, InstructionAddress address, InstructionAddress sourceAddress, bool isEntry)
Definition: CallPathTracker.cc:33
CallPathTracker::ProcedureTransfer::isEntry
bool isEntry
Definition: CallPathTracker.hh:57
CallPathTracker::backTrace
const ProcedureTransferQueue backTrace() const
Definition: CallPathTracker.cc:54
CallPathTracker::~CallPathTracker
virtual ~CallPathTracker()
Definition: CallPathTracker.hh:68
ClockCycleCount
CycleCount ClockCycleCount
Alias for ClockCycleCount.
Definition: SimulatorConstants.hh:57
SimulatorFrontend
Definition: SimulatorFrontend.hh:89
Listener.hh