pseudo_inst.cc (2654:9559cfa91b9d) pseudo_inst.cc (2665:a124942bacb8)
1/*
2 * Copyright (c) 2003-2006 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

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

19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1/*
2 * Copyright (c) 2003-2006 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

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

19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * Authors: Nathan Binkert
27 */
28
29#include <errno.h>
30#include <fcntl.h>
31#include <unistd.h>
32
33#include <string>
34
35#include "sim/pseudo_inst.hh"
36#include "arch/vtophys.hh"
37#include "cpu/base.hh"
38#include "cpu/sampler/sampler.hh"
39#include "cpu/exec_context.hh"
29 */
30
31#include <errno.h>
32#include <fcntl.h>
33#include <unistd.h>
34
35#include <string>
36
37#include "sim/pseudo_inst.hh"
38#include "arch/vtophys.hh"
39#include "cpu/base.hh"
40#include "cpu/sampler/sampler.hh"
41#include "cpu/exec_context.hh"
40#include "cpu/quiesce_event.hh"
41#include "kern/kernel_stats.hh"
42#include "sim/param.hh"
43#include "sim/serialize.hh"
44#include "sim/sim_exit.hh"
45#include "sim/stat_control.hh"
46#include "sim/stats.hh"
47#include "sim/system.hh"
48#include "sim/debug.hh"

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

59{
60 bool doStatisticsInsts;
61 bool doCheckpointInsts;
62 bool doQuiesce;
63
64 void
65 arm(ExecContext *xc)
66 {
42#include "kern/kernel_stats.hh"
43#include "sim/param.hh"
44#include "sim/serialize.hh"
45#include "sim/sim_exit.hh"
46#include "sim/stat_control.hh"
47#include "sim/stats.hh"
48#include "sim/system.hh"
49#include "sim/debug.hh"

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

60{
61 bool doStatisticsInsts;
62 bool doCheckpointInsts;
63 bool doQuiesce;
64
65 void
66 arm(ExecContext *xc)
67 {
67 if (xc->getKernelStats())
68 xc->getKernelStats()->arm();
68 xc->getCpuPtr()->kernelStats->arm();
69 }
70
71 void
72 quiesce(ExecContext *xc)
73 {
74 if (!doQuiesce)
75 return;
76
77 xc->suspend();
69 }
70
71 void
72 quiesce(ExecContext *xc)
73 {
74 if (!doQuiesce)
75 return;
76
77 xc->suspend();
78 if (xc->getKernelStats())
79 xc->getKernelStats()->quiesce();
78 xc->getCpuPtr()->kernelStats->quiesce();
80 }
81
82 void
83 quiesceNs(ExecContext *xc, uint64_t ns)
84 {
85 if (!doQuiesce || ns == 0)
86 return;
87
79 }
80
81 void
82 quiesceNs(ExecContext *xc, uint64_t ns)
83 {
84 if (!doQuiesce || ns == 0)
85 return;
86
88 EndQuiesceEvent *quiesceEvent = xc->getQuiesceEvent();
87 Event *quiesceEvent = xc->getQuiesceEvent();
89
90 if (quiesceEvent->scheduled())
91 quiesceEvent->reschedule(curTick + Clock::Int::ns * ns);
92 else
93 quiesceEvent->schedule(curTick + Clock::Int::ns * ns);
94
95 xc->suspend();
88
89 if (quiesceEvent->scheduled())
90 quiesceEvent->reschedule(curTick + Clock::Int::ns * ns);
91 else
92 quiesceEvent->schedule(curTick + Clock::Int::ns * ns);
93
94 xc->suspend();
96 if (xc->getKernelStats())
97 xc->getKernelStats()->quiesce();
95 xc->getCpuPtr()->kernelStats->quiesce();
98 }
99
100 void
101 quiesceCycles(ExecContext *xc, uint64_t cycles)
102 {
103 if (!doQuiesce || cycles == 0)
104 return;
105
96 }
97
98 void
99 quiesceCycles(ExecContext *xc, uint64_t cycles)
100 {
101 if (!doQuiesce || cycles == 0)
102 return;
103
106 EndQuiesceEvent *quiesceEvent = xc->getQuiesceEvent();
104 Event *quiesceEvent = xc->getQuiesceEvent();
107
108 if (quiesceEvent->scheduled())
109 quiesceEvent->reschedule(curTick +
110 xc->getCpuPtr()->cycles(cycles));
111 else
112 quiesceEvent->schedule(curTick +
113 xc->getCpuPtr()->cycles(cycles));
114
115 xc->suspend();
105
106 if (quiesceEvent->scheduled())
107 quiesceEvent->reschedule(curTick +
108 xc->getCpuPtr()->cycles(cycles));
109 else
110 quiesceEvent->schedule(curTick +
111 xc->getCpuPtr()->cycles(cycles));
112
113 xc->suspend();
116 if (xc->getKernelStats())
117 xc->getKernelStats()->quiesce();
114 xc->getCpuPtr()->kernelStats->quiesce();
118 }
119
120 uint64_t
121 quiesceTime(ExecContext *xc)
122 {
123 return (xc->readLastActivate() - xc->readLastSuspend()) / Clock::Int::ns;
124 }
125
126 void
127 ivlb(ExecContext *xc)
128 {
115 }
116
117 uint64_t
118 quiesceTime(ExecContext *xc)
119 {
120 return (xc->readLastActivate() - xc->readLastSuspend()) / Clock::Int::ns;
121 }
122
123 void
124 ivlb(ExecContext *xc)
125 {
129 if (xc->getKernelStats())
130 xc->getKernelStats()->ivlb();
126 xc->getCpuPtr()->kernelStats->ivlb();
131 }
132
133 void
134 ivle(ExecContext *xc)
135 {
136 }
137
138 void

--- 152 unchanged lines hidden ---
127 }
128
129 void
130 ivle(ExecContext *xc)
131 {
132 }
133
134 void

--- 152 unchanged lines hidden ---