OpenASIP  2.0
UtilizationStats.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 UtilizationStats.hh
26  *
27  * Declaration of UtilizationStats class.
28  *
29  * @author Pekka Jääskeläinen 2005 (pjaaskel-no.spam-cs.tut.fi)
30  * @note rating: red
31  */
32 
33 #ifndef TTA_UTILIZATION_STATS_HH
34 #define TTA_UTILIZATION_STATS_HH
35 
36 #include <map>
37 #include <string>
38 
40 #include "SimulatorConstants.hh"
41 
42 namespace TTAMachine {
43  class Guard;
44 }
45 
46 /**
47  * Calculates processor utilization data from instructions and their
48  * execution counts.
49  */
51 public:
52  /// Index for connecting component names to utilization counts.
53  typedef std::map<std::string, ClockCycleCount> ComponentUtilizationIndex;
54  /// Index for connecting register indices to utilization counts.
55  /// The first number in the pair is the count of reads, and the second
56  /// is the count of writes.
57  typedef std::map<int, std::pair<ClockCycleCount, ClockCycleCount> >
59  /// Index for connecting function unit and operations implemented in them
60  /// to utilization counts.
61  typedef std::map<std::string, ComponentUtilizationIndex>
63  /// Index for connecting register files and register utilization indices
64  /// in them.
65  typedef std::map<std::string, RegisterUtilizationIndex>
67 
69  virtual ~UtilizationStats();
70 
71  virtual void calculateForInstruction(
72  const TTAProgram::Instruction& instructionData,
73  const ExecutableInstruction& executionCounts);
74 
75  ClockCycleCount busWrites(const std::string& busName) const;
76  ClockCycleCount socketWrites(const std::string& socketName) const;
77  ClockCycleCount triggerCount(const std::string& fuName) const;
79  const std::string& operationName) const;
81  const std::string& fuName, const std::string& operationName) const;
83  const std::string& rfName,
84  int registerIndex) const;
86  const std::string& rfName,
87  int registerIndex) const;
89  const std::string& rfName,
90  int registerIndex) const;
92  const std::string& fuName,
93  const std::string& fuPort) const;
94 
96 
97  int highestUsedRegisterIndex() const;
98 
99 private:
100  /// Socket write counts.
102  /// Bus write counts.
104  /// Function unit utilizations, i.e., total operation triggerings.
106  /// Operation utilizations (started operations).
108  /// Index for operation utilizations for each function unit.
110  /// Register read and write data for each register in each register file.
112 
113  /// Guard register accesses for each register in a RF.
115  /// Guard FU port accesses
117 
118  /// The highest register index used. This is an uglish way to fetch
119  /// register access info for sequential simulation.
121 };
122 
123 #endif
ExecutableInstruction
Definition: ExecutableInstruction.hh:49
UtilizationStats::triggerCount
ClockCycleCount triggerCount(const std::string &fuName) const
Definition: UtilizationStats.cc:220
UtilizationStats::guardRegisterReads
ClockCycleCount guardRegisterReads(const std::string &rfName, int registerIndex) const
Definition: UtilizationStats.cc:292
UtilizationStats::RFRegisterUtilizationIndex
std::map< std::string, RegisterUtilizationIndex > RFRegisterUtilizationIndex
Index for connecting register files and register utilization indices in them.
Definition: UtilizationStats.hh:66
TTAProgram::Instruction
Definition: Instruction.hh:57
UtilizationStats::socketWrites
ClockCycleCount socketWrites(const std::string &socketName) const
Definition: UtilizationStats.cc:206
UtilizationStats::calculateForInstruction
virtual void calculateForInstruction(const TTAProgram::Instruction &instructionData, const ExecutableInstruction &executionCounts)
Definition: UtilizationStats.cc:74
UtilizationStats::fus_
ComponentUtilizationIndex fus_
Function unit utilizations, i.e., total operation triggerings.
Definition: UtilizationStats.hh:105
UtilizationStats::FUGuardAccesses
FUOperationUtilizationIndex FUGuardAccesses() const
Definition: UtilizationStats.cc:355
SimulationStatisticsCalculator
Definition: SimulationStatisticsCalculator.hh:49
UtilizationStats::guardRfAccesses_
RFRegisterUtilizationIndex guardRfAccesses_
Guard register accesses for each register in a RF.
Definition: UtilizationStats.hh:114
SimulatorConstants.hh
UtilizationStats::FUOperationUtilizationIndex
std::map< std::string, ComponentUtilizationIndex > FUOperationUtilizationIndex
Index for connecting function unit and operations implemented in them to utilization counts.
Definition: UtilizationStats.hh:62
SimulationStatisticsCalculator.hh
UtilizationStats::fuOperations_
FUOperationUtilizationIndex fuOperations_
Index for operation utilizations for each function unit.
Definition: UtilizationStats.hh:109
UtilizationStats::busWrites
ClockCycleCount busWrites(const std::string &busName) const
Definition: UtilizationStats.cc:192
UtilizationStats::operationExecutions
ClockCycleCount operationExecutions(const std::string &operationName) const
Definition: UtilizationStats.cc:234
UtilizationStats::~UtilizationStats
virtual ~UtilizationStats()
Definition: UtilizationStats.cc:60
UtilizationStats::UtilizationStats
UtilizationStats()
Definition: UtilizationStats.cc:54
UtilizationStats::RegisterUtilizationIndex
std::map< int, std::pair< ClockCycleCount, ClockCycleCount > > RegisterUtilizationIndex
Index for connecting register indices to utilization counts. The first number in the pair is the coun...
Definition: UtilizationStats.hh:58
UtilizationStats::registerWrites
ClockCycleCount registerWrites(const std::string &rfName, int registerIndex) const
Definition: UtilizationStats.cc:314
UtilizationStats::sockets_
ComponentUtilizationIndex sockets_
Socket write counts.
Definition: UtilizationStats.hh:101
UtilizationStats::buses_
ComponentUtilizationIndex buses_
Bus write counts.
Definition: UtilizationStats.hh:103
UtilizationStats::operations_
ComponentUtilizationIndex operations_
Operation utilizations (started operations).
Definition: UtilizationStats.hh:107
ClockCycleCount
CycleCount ClockCycleCount
Alias for ClockCycleCount.
Definition: SimulatorConstants.hh:57
UtilizationStats::registerReads
ClockCycleCount registerReads(const std::string &rfName, int registerIndex) const
Definition: UtilizationStats.cc:270
UtilizationStats::highestRegister_
int highestRegister_
The highest register index used. This is an uglish way to fetch register access info for sequential s...
Definition: UtilizationStats.hh:120
TTAMachine
Definition: Assembler.hh:48
UtilizationStats::rfAccesses_
RFRegisterUtilizationIndex rfAccesses_
Register read and write data for each register in each register file.
Definition: UtilizationStats.hh:111
UtilizationStats::ComponentUtilizationIndex
std::map< std::string, ClockCycleCount > ComponentUtilizationIndex
Index for connecting component names to utilization counts.
Definition: UtilizationStats.hh:53
UtilizationStats::highestUsedRegisterIndex
int highestUsedRegisterIndex() const
Definition: UtilizationStats.cc:367
UtilizationStats
Definition: UtilizationStats.hh:50
UtilizationStats::guardFUAccesses_
FUOperationUtilizationIndex guardFUAccesses_
Guard FU port accesses.
Definition: UtilizationStats.hh:116