sub_system.cc (11420:b48c0ba4f524) sub_system.cc (11424:e07fd01651f3)
1/*
1/*
2 * Copyright (c) 2014 ARM Limited
2 * Copyright (c) 2014-2015 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated

--- 21 unchanged lines hidden (view full) ---

32 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 *
37 * Authors: Geoffrey Blake
38 */
39
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated

--- 21 unchanged lines hidden (view full) ---

32 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 *
37 * Authors: Geoffrey Blake
38 */
39
40#include "sim/sub_system.hh"
41
40#include "params/SubSystem.hh"
41#include "sim/sub_system.hh"
42#include "params/SubSystem.hh"
43#include "sim/sub_system.hh"
44#include "sim/power/power_model.hh"
42#include "sim/power/thermal_domain.hh"
43
44SubSystem::SubSystem(const Params *p)
45 : SimObject(p)
46{
47 // Link thermalDomain <-> SubSystem
48 if (p->thermal_domain)
49 p->thermal_domain->setSubSystem(this);
50}
51
45#include "sim/power/thermal_domain.hh"
46
47SubSystem::SubSystem(const Params *p)
48 : SimObject(p)
49{
50 // Link thermalDomain <-> SubSystem
51 if (p->thermal_domain)
52 p->thermal_domain->setSubSystem(this);
53}
54
55double
56SubSystem::getDynamicPower() const
57{
58 double ret = 0.0f;
59 for (auto &obj: powerProducers)
60 ret += obj->getDynamicPower();
61 return ret;
62}
63
64double
65SubSystem::getStaticPower() const
66{
67 double ret = 0.0f;
68 for (auto &obj: powerProducers)
69 ret += obj->getStaticPower();
70 return ret;
71}
72
52SubSystem *
53SubSystemParams::create()
54{
55 return new SubSystem(this);
56}
73SubSystem *
74SubSystemParams::create()
75{
76 return new SubSystem(this);
77}