ticked_object.cc (12113:bdf1545c9919) ticked_object.cc (12125:0066d9926c1a)
1/*
2 * Copyright (c) 2013-2014, 2017 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

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

41
42#include "params/TickedObject.hh"
43#include "sim/clocked_object.hh"
44
45Ticked::Ticked(ClockedObject &object_,
46 Stats::Scalar *imported_num_cycles,
47 Event::Priority priority) :
48 object(object_),
1/*
2 * Copyright (c) 2013-2014, 2017 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

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

41
42#include "params/TickedObject.hh"
43#include "sim/clocked_object.hh"
44
45Ticked::Ticked(ClockedObject &object_,
46 Stats::Scalar *imported_num_cycles,
47 Event::Priority priority) :
48 object(object_),
49 event(*this, priority),
49 event([this]{ processClockEvent(); }, name(), false, priority),
50 running(false),
51 lastStopped(0),
52 /* Allocate numCycles if an external stat wasn't passed in */
53 numCyclesLocal((imported_num_cycles ? NULL : new Stats::Scalar)),
54 numCycles((imported_num_cycles ? *imported_num_cycles :
55 *numCyclesLocal))
56{ }
57
58void
50 running(false),
51 lastStopped(0),
52 /* Allocate numCycles if an external stat wasn't passed in */
53 numCyclesLocal((imported_num_cycles ? NULL : new Stats::Scalar)),
54 numCycles((imported_num_cycles ? *imported_num_cycles :
55 *numCyclesLocal))
56{ }
57
58void
59Ticked::processClockEvent() {
60 ++tickCycles;
61 ++numCycles;
62 countCycles(Cycles(1));
63 evaluate();
64 if (running)
65 object.schedule(event, object.clockEdge(Cycles(1)));
66}
67
68void
59Ticked::regStats()
60{
61 if (numCyclesLocal) {
62 numCycles
63 .name(object.name() + ".totalTickCycles")
64 .desc("Number of cycles that the object ticked or was stopped");
65 }
66

--- 60 unchanged lines hidden ---
69Ticked::regStats()
70{
71 if (numCyclesLocal) {
72 numCycles
73 .name(object.name() + ".totalTickCycles")
74 .desc("Number of cycles that the object ticked or was stopped");
75 }
76

--- 60 unchanged lines hidden ---