Skip to content

Commit

Permalink
Add support for Camelab traces
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-manes committed May 11, 2020
1 parent ddd2077 commit 47d59e0
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 5 deletions.
3 changes: 3 additions & 0 deletions checksum.xml
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,9 @@
<dependency group='gradle.plugin.com.github.spotbugs.snom' module='spotbugs-gradle-plugin' version='4.0.5'>
<sha512>559ECA3B9FC21BE76ECAAA9E0073DC2014BA50DF2A14AD8919F358C1D7761E2C492EB09DAE1099A308C2F8C0A14635AD4583FF26B7868A782DE6A16D26F7EC6C</sha512>
</dependency>
<dependency group='gradle.plugin.com.github.spotbugs.snom' module='spotbugs-gradle-plugin' version='4.0.8'>
<sha512>24498846D540C1FDA16E3F835058DEAD3FE28C8D8D1AF35D1DA40C53441876AD3022085110ED3F633685EECC56642AB7B6EC7E6F1B0A11584CF4BBB3464C435D</sha512>
</dependency>
<dependency group='gradle.plugin.com.github.spotbugs' module='spotbugs-gradle-plugin' version='2.0.0'>
<sha512>B3BFAD07E6A3D4D73CBCE802D8614CF4AC84E589166D243D41028DC077F84C027DF4D514F145360405F37DA73A8F2E7B65D90877A9EE1151174D2440530F9051</sha512>
</dependency>
Expand Down
8 changes: 4 additions & 4 deletions gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
*/
ext {
versions = [
akka: '2.6.4',
akka: '2.6.5',
cache2k: '1.3.1.Alpha',
checkerFramework: '3.3.0',
checkerFramework: '3.4.0',
collision: '0.3.3',
commonsCompress: '1.20',
commonsLang3: '3.10',
Expand Down Expand Up @@ -76,7 +76,7 @@ ext {
pluginVersions = [
apt: '0.21',
bnd: '5.0.1',
checkstyle: '8.31',
checkstyle: '8.32',
coveralls: '2.8.4',
coverity: '1.0.10',
errorprone: '1.1.1',
Expand All @@ -89,7 +89,7 @@ ext {
shadow: '5.2.0',
sonarqube: '2.8.0.1969',
spotbugs: '4.0.2',
spotbugsPlugin: '4.0.5',
spotbugsPlugin: '4.0.8',
stats: '0.2.2',
versions: '0.28.0',
]
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
distributionUrl=https\:https://services.gradle.org/distributions/gradle-6.3-bin.zip
distributionUrl=https\:https://services.gradle.org/distributions/gradle-6.4-bin.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import com.github.benmanes.caffeine.cache.simulator.parser.address.penalties.AddressPenaltiesTraceReader;
import com.github.benmanes.caffeine.cache.simulator.parser.arc.ArcTraceReader;
import com.github.benmanes.caffeine.cache.simulator.parser.cache2k.Cache2kTraceReader;
import com.github.benmanes.caffeine.cache.simulator.parser.camelab.CamelabTraceReader;
import com.github.benmanes.caffeine.cache.simulator.parser.climb.ClimbTraceReader;
import com.github.benmanes.caffeine.cache.simulator.parser.corda.CordaTraceReader;
import com.github.benmanes.caffeine.cache.simulator.parser.gradle.GradleTraceReader;
Expand Down Expand Up @@ -56,6 +57,7 @@ public enum TraceFormat {
ADAPT_SIZE(AdaptSizeReader::new),
ARC(ArcTraceReader::new),
CACHE2K(Cache2kTraceReader::new),
CAMELAB(CamelabTraceReader::new),
CLIMB(ClimbTraceReader::new),
CORDA(CordaTraceReader::new),
GRADLE(GradleTraceReader::new),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* Copyright 2020 Ben Manes. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http:https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.benmanes.caffeine.cache.simulator.parser.camelab;

import java.io.IOException;
import java.util.stream.LongStream;

import com.github.benmanes.caffeine.cache.simulator.parser.TextTraceReader;
import com.github.benmanes.caffeine.cache.simulator.parser.TraceReader.KeyOnlyTraceReader;

/**
* A reader for the trace files provided by
* <a href="https://trace.camelab.org/2016/03/01/flash.html">Camelab</a>.
*
* @author [email protected] (Ben Manes)
*/
public final class CamelabTraceReader extends TextTraceReader implements KeyOnlyTraceReader {
static final int BLOCK_SIZE = 512;

public CamelabTraceReader(String filePath) {
super(filePath);
}

@Override
public LongStream keys() throws IOException {
return lines().flatMapToLong(line -> {
String[] array = line.split(" ", 5);
char readWrite = Character.toLowerCase(array[1].charAt(0));
if (readWrite == 'w') {
return LongStream.empty();
}

long startAddress = Long.parseLong(array[2]);
int requestSize = Integer.parseInt(array[3]);
long[] blocks = new long[requestSize];
for (int i = 0; i < requestSize; i++) {
blocks[i] = startAddress + (i * BLOCK_SIZE);
}
return LongStream.of(blocks);
});
}
}
1 change: 1 addition & 0 deletions simulator/src/main/resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@ caffeine.simulator {
# address: format of UCSD program address traces
# address-penalties: format of UCSD program address traces with hit & miss penalties
# cache2k: format from the author of the Cache2k library
# camelab: format from the Camelab storage traces
# climb: format from the authors of the AdaptiveClimb algorithm
# corda: format of Corda traces
# gradle: format from the authors of the Gradle build tool
Expand Down

0 comments on commit 47d59e0

Please sign in to comment.