Encapsulate this variable to facilitate polymorphism.
- task_id was renamed to _taskId and was privatized.
- The task id should only be modified at 2 specific moments:
insertion and invalidation of the block; thus, its setter
is not public.
Change-Id: If9c49c22117ef5d7f25163ec94bf8b174f221e39
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/34956
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
if (blk->isSecure())
req->setFlags(Request::SECURE);
- req->taskId(blk->task_id);
+ req->taskId(blk->getTaskId());
PacketPtr pkt =
new Packet(req, blk->isDirty() ?
if (blk->isSecure()) {
req->setFlags(Request::SECURE);
}
- req->taskId(blk->task_id);
+ req->taskId(blk->getTaskId());
PacketPtr pkt = new Packet(req, MemCmd::WriteClean, blkSize, id);
RequestPtr request = std::make_shared<Request>(
regenerateBlkAddr(&blk), blkSize, 0, Request::funcRequestorId);
- request->taskId(blk.task_id);
+ request->taskId(blk.getTaskId());
if (blk.isSecure()) {
request->setFlags(Request::SECURE);
}
if (blk->isSecure())
req->setFlags(Request::SECURE);
- req->taskId(blk->task_id);
+ req->taskId(blk->getTaskId());
PacketPtr pkt = new Packet(req, MemCmd::CleanEvict);
pkt->allocate();
srcRequestorId = src_requestor_ID;
// Set task ID
- task_id = task_ID;
+ setTaskId(task_ID);
// Set insertion tick as current tick
tickInserted = curTick();
class CacheBlk : public ReplaceableEntry
{
public:
- /** Task Id associated with this block */
- uint32_t task_id;
-
/**
* Contains a copy of the data in this block for easy access. This is used
* for efficient execution when the data could be actually stored in
virtual void invalidate()
{
setTag(MaxAddr);
- task_id = ContextSwitchTaskId::Unknown;
+ setTaskId(ContextSwitchTaskId::Unknown);
status = 0;
whenReady = MaxTick;
refCount = 0;
whenReady = tick;
}
+ /** Get the task id associated to this block. */
+ uint32_t getTaskId() const { return _taskId; }
+
/**
* Checks if the given information corresponds to this block's.
*
}
}
+ protected:
+ /** Set the task id value. */
+ void setTaskId(const uint32_t task_id) { _taskId = task_id; }
+
private:
/** Data block tag value. */
Addr _tag;
+
+ /** Task Id associated with this block */
+ uint32_t _taskId;
};
/**
BaseTags::computeStatsVisitor(CacheBlk &blk)
{
if (blk.isValid()) {
- assert(blk.task_id < ContextSwitchTaskId::NumTaskId);
- stats.occupanciesTaskId[blk.task_id]++;
+ const uint32_t task_id = blk.getTaskId();
+ assert(task_id < ContextSwitchTaskId::NumTaskId);
+ stats.occupanciesTaskId[task_id]++;
assert(blk.tickInserted <= curTick());
Tick age = curTick() - blk.tickInserted;
} else
age_index = 4; // >10ms
- stats.ageTaskId[blk.task_id][age_index]++;
+ stats.ageTaskId[task_id][age_index]++;
}
}