Deleted Added
sdiff udiff text old ( 2669:f2b336e89d2a ) new ( 2674:6d4afef73a20 )
full compact
1
2#include "base/timebuf.hh"
3#include "cpu/activity.hh"
4
5ActivityRecorder::ActivityRecorder(int num_stages, int longest_latency,
6 int activity)
7 : activityBuffer(longest_latency, 0), longestLatency(longest_latency),
8 activityCount(activity), numStages(num_stages)
9{
10 stageActive = new bool[numStages];
11 memset(stageActive, 0, numStages);
12}
13
14void
15ActivityRecorder::activity()
16{
17 if (activityBuffer[0]) {
18 return;
19 }
20
21 activityBuffer[0] = true;
22
23 ++activityCount;
24
25 DPRINTF(Activity, "Activity: %i\n", activityCount);
26}
27
28void
29ActivityRecorder::advance()
30{
31 if (activityBuffer[-longestLatency]) {
32 --activityCount;
33
34 assert(activityCount >= 0);
35
36 DPRINTF(Activity, "Activity: %i\n", activityCount);
37
38 if (activityCount == 0) {
39 DPRINTF(Activity, "No activity left!\n");
40 }
41 }
42
43 activityBuffer.advance();
44}
45
46void
47ActivityRecorder::activateStage(const int idx)
48{
49 if (!stageActive[idx]) {
50 ++activityCount;
51
52 stageActive[idx] = true;
53
54 DPRINTF(Activity, "Activity: %i\n", activityCount);
55 } else {
56 DPRINTF(Activity, "Stage %i already active.\n", idx);
57 }
58
59// assert(activityCount < longestLatency + numStages + 1);
60}
61
62void
63ActivityRecorder::deactivateStage(const int idx)
64{
65 if (stageActive[idx]) {
66 --activityCount;
67
68 stageActive[idx] = false;
69
70 DPRINTF(Activity, "Activity: %i\n", activityCount);
71 } else {
72 DPRINTF(Activity, "Stage %i already inactive.\n", idx);

--- 50 unchanged lines hidden ---