mem-cache: add a prefetch useful stat
Count how many time a prefetch is useful, meaning a hit has happened on a prefetched cache block. Another stat (pfUsefulButMiss) has been added to count the special case where there is a hit on prefetched block but it is counted as a miss because the block is not in the requested coherency state. Change-Id: I253216b9ac96d5f21139b710c489d6eb3fce7136 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/47602 Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br> Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com> Maintainer: Daniel Carvalho <odanrc@yahoo.com.br> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
12
src/mem/cache/prefetch/base.cc
vendored
12
src/mem/cache/prefetch/base.cc
vendored
@@ -122,7 +122,12 @@ Base::StatGroup::StatGroup(statistics::Group *parent)
|
||||
ADD_STAT(pfIssued, statistics::units::Count::get(),
|
||||
"number of hwpf issued"),
|
||||
ADD_STAT(pfUnused, statistics::units::Count::get(),
|
||||
"number of HardPF blocks evicted w/o reference")
|
||||
"number of HardPF blocks evicted w/o reference"),
|
||||
ADD_STAT(pfUseful, statistics::units::Count::get(),
|
||||
"number of useful prefetch"),
|
||||
ADD_STAT(pfUsefulButMiss, statistics::units::Count::get(),
|
||||
"number of hit on prefetch but cache block is not in an usable "
|
||||
"state")
|
||||
{
|
||||
pfUnused.flags(statistics::nozero);
|
||||
}
|
||||
@@ -219,6 +224,11 @@ Base::probeNotify(const PacketPtr &pkt, bool miss)
|
||||
|
||||
if (hasBeenPrefetched(pkt->getAddr(), pkt->isSecure())) {
|
||||
usefulPrefetches += 1;
|
||||
prefetchStats.pfUseful++;
|
||||
if (miss)
|
||||
// This case happens when a demand hits on a prefetched line
|
||||
// that's not in the requested coherency state.
|
||||
prefetchStats.pfUsefulButMiss++;
|
||||
}
|
||||
|
||||
// Verify this access type is observed by prefetcher
|
||||
|
||||
5
src/mem/cache/prefetch/base.hh
vendored
5
src/mem/cache/prefetch/base.hh
vendored
@@ -332,6 +332,11 @@ class Base : public ClockedObject
|
||||
/** The number of times a HW-prefetched block is evicted w/o
|
||||
* reference. */
|
||||
statistics::Scalar pfUnused;
|
||||
/** The number of times a HW-prefetch is useful. */
|
||||
statistics::Scalar pfUseful;
|
||||
/** The number of times there is a hit on prefetch but cache block
|
||||
* is not in an usable state */
|
||||
statistics::Scalar pfUsefulButMiss;
|
||||
} prefetchStats;
|
||||
|
||||
/** Total prefetches issued */
|
||||
|
||||
Reference in New Issue
Block a user