From 3ef292581aed1922d5b45a00b0758566a25814ec Mon Sep 17 00:00:00 2001 From: EshedHere <140636322+EshedHere@users.noreply.github.com> Date: Sat, 24 Feb 2024 16:18:02 +0200 Subject: [PATCH] Merge remote-tracking branch 'origin/BranchOne_SuperPolicy' into BranchOne_SuperPolicy --- .../cache/simulator/policy/Policy.java | 5 +++++ .../simulator/policy/esp/PipelinePolicy.java | 20 +++++++++++++----- .../cache/simulator/parser/lirs/esp.trace.gz | Bin 0 -> 49 bytes simulator/src/main/resources/reference.conf | 2 +- 4 files changed, 21 insertions(+), 6 deletions(-) create mode 100644 simulator/src/main/resources/com/github/benmanes/caffeine/cache/simulator/parser/lirs/esp.trace.gz diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/Policy.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/Policy.java index 952ce8cb1f..fd5d2b0bcf 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/Policy.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/Policy.java @@ -32,6 +32,7 @@ public interface Policy { /** Records that the entry was accessed. */ void record(AccessEvent event); + void evict(AccessEvent event); /** Indicates that the recording has completed. */ default void finished() {} @@ -72,6 +73,10 @@ interface KeyOnlyPolicy extends Policy { @Override default void record(AccessEvent event) { record(event.key()); } + @Override default void evict(AccessEvent event){ + evict(event.key()); + } void record(long key); + void evict(long key); } } diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/esp/PipelinePolicy.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/esp/PipelinePolicy.java index e3fffff266..069bf1db00 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/esp/PipelinePolicy.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/esp/PipelinePolicy.java @@ -104,6 +104,15 @@ public void record(long key) { if(lookUptable.get(key) != null) { pipeLineStats.recordOperation(); pipeLineStats.recordHit(); + int blockIndex = lookUptable.get(key); + if (pipelinePolicies.get(blockIndex) instanceof KeyOnlyPolicy) { + // Handle the event as a key-only event + ((KeyOnlyPolicy) pipelinePolicies.get(blockIndex)).evict(key); + } else { + // Handle the event for a generic policy + AccessEvent event = new AccessEvent(key/* Additional details here */); + pipelinePolicies.get(blockIndex).evict(event); + } //PROPAGATION @@ -149,13 +158,12 @@ public void record(long key) { } } + } + @Override + public void evict(long key) { - - - - - } + } @Override @@ -172,6 +180,8 @@ public void finished() { superPolicy.twoQueuePolicy.finished(); } + + } diff --git a/simulator/src/main/resources/com/github/benmanes/caffeine/cache/simulator/parser/lirs/esp.trace.gz b/simulator/src/main/resources/com/github/benmanes/caffeine/cache/simulator/parser/lirs/esp.trace.gz new file mode 100644 index 0000000000000000000000000000000000000000..9753314aff804bf87e8b6a22146f25532e689a1c GIT binary patch literal 49 zcmb2|=3oE=X5%MMjUGKUdiK=l;ZvihPmLZwHG2MZ(}Sl*Do!#7*%*Z9SaP`mRRRF= CqZ7UW literal 0 HcmV?d00001 diff --git a/simulator/src/main/resources/reference.conf b/simulator/src/main/resources/reference.conf index ebbbda2a3e..66e76459a5 100644 --- a/simulator/src/main/resources/reference.conf +++ b/simulator/src/main/resources/reference.conf @@ -513,7 +513,7 @@ caffeine.simulator { files { # The paths to the trace files or the file names if in the format's package. To use a mix of # formats, specify the entry in the form "{format}:{path}", e.g. "lirs:loop.trace.gz". - paths = [ multi1.trace.gz ] + paths = [ esp.trace.gz ] # arc: format from the authors of the ARC algorithm # adapt-size: format from the authors of the AdaptSize algorithm