OpenASIP  2.0
ProximSocketDetailsCmd.cc
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 ProximSocketDetailsCmd.cc
26  *
27  * Implementation of ProximSocketDetailsCmd class.
28  *
29  * @author Veli-Pekka Jääskeläinen 2005 (vjaaskel-no.spam-cs.tut.fi)
30  * @note rating: red
31  */
32 
33 #include <string>
36 #include "ProximToolbox.hh"
37 #include "Socket.hh"
39 #include "Conversion.hh"
40 #include "ProximConstants.hh"
41 #include "UtilizationStats.hh"
42 
43 using std::string;
44 using namespace TTAMachine;
45 
46 /**
47  * The Constructor.
48  *
49  * @param bus Socket to display.
50  */
52  const TTAMachine::Socket& socket) :
53  ComponentCommand(), socket_(socket) {
54 }
55 
56 
57 /**
58  * The Destructor.
59  */
61 }
62 
63 /**
64  * Executes the command.
65  */
66 bool
68 
69  string socketName = socket_.name();
70 
72  const UtilizationStats& stats =
74 
75  // Append component type and name to the details widget.
77  machineWin->appendDetails(socketName + "\n\n");
78 
79  // Append utlization statistics.
80  ClockCycleCount writes = stats.socketWrites(socketName);
81  machineWin->appendUtilizationData(
83  machineWin->appendUtilizationData(Conversion::toString(writes));
84 
86  double percent = 0;
87  if (cycles > 0) {
88  percent = (100.0 * writes) / cycles;
89  }
90  machineWin->appendUtilizationData(
91  " (" + Conversion::toString(percent) + "%)");
92 
93  return true;
94 }
ProximToolbox::frontend
static TracedSimulatorFrontend * frontend()
Definition: ProximToolbox.cc:223
TTAMachine::Component::name
virtual TCEString name() const
Definition: MachinePart.cc:125
ProximMachineStateWindow.hh
UtilizationStats::socketWrites
ClockCycleCount socketWrites(const std::string &socketName) const
Definition: UtilizationStats.cc:206
ProximMachineStateWindow::appendDetails
void appendDetails(std::string text)
Definition: ProximMachineStateWindow.cc:479
ProximMachineStateWindow
Definition: ProximMachineStateWindow.hh:56
Socket.hh
Conversion::toString
static std::string toString(const T &source)
ProximToolbox.hh
Conversion.hh
SimulatorFrontend::utilizationStatistics
const UtilizationStats & utilizationStatistics(int core=-1)
Definition: SimulatorFrontend.cc:2155
ProximSocketDetailsCmd.hh
TTAMachine::Socket
Definition: Socket.hh:53
ProximConstants::MACH_WIN_SOCKET_LABEL
static const std::string MACH_WIN_SOCKET_LABEL
Label precing socket names in the machine state window.
Definition: ProximConstants.hh:212
ComponentCommand
Definition: ComponentCommand.hh:46
ProximMachineStateWindow::appendUtilizationData
void appendUtilizationData(std::string text)
Definition: ProximMachineStateWindow.cc:467
ProximSocketDetailsCmd::socket_
const TTAMachine::Socket & socket_
Socket to display.
Definition: ProximSocketDetailsCmd.hh:53
ProximToolbox::machineStateWindow
static ProximMachineStateWindow * machineStateWindow()
Definition: ProximToolbox.cc:123
UtilizationStats.hh
TracedSimulatorFrontend.hh
SimulatorFrontend::cycleCount
ClockCycleCount cycleCount() const
Definition: SimulatorFrontend.cc:1194
ProximSocketDetailsCmd::~ProximSocketDetailsCmd
virtual ~ProximSocketDetailsCmd()
Definition: ProximSocketDetailsCmd.cc:60
ProximConstants.hh
ClockCycleCount
CycleCount ClockCycleCount
Alias for ClockCycleCount.
Definition: SimulatorConstants.hh:57
TTAMachine
Definition: Assembler.hh:48
ProximConstants::MACH_WIN_SOCKET_WRITES_LABEL
static const std::string MACH_WIN_SOCKET_WRITES_LABEL
Label for the machine state window socket write count.
Definition: ProximConstants.hh:226
ProximSocketDetailsCmd::Do
virtual bool Do()
Definition: ProximSocketDetailsCmd.cc:67
UtilizationStats
Definition: UtilizationStats.hh:50
ProximSocketDetailsCmd::ProximSocketDetailsCmd
ProximSocketDetailsCmd(const TTAMachine::Socket &socket)
Definition: ProximSocketDetailsCmd.cc:51