Skip to content

Commit 47d59e0

Browse files
committed
Add support for Camelab traces
1 parent ddd2077 commit 47d59e0

File tree

6 files changed

+66
-5
lines changed

6 files changed

+66
-5
lines changed

checksum.xml

+3
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,9 @@
248248
<dependency group='gradle.plugin.com.github.spotbugs.snom' module='spotbugs-gradle-plugin' version='4.0.5'>
249249
<sha512>559ECA3B9FC21BE76ECAAA9E0073DC2014BA50DF2A14AD8919F358C1D7761E2C492EB09DAE1099A308C2F8C0A14635AD4583FF26B7868A782DE6A16D26F7EC6C</sha512>
250250
</dependency>
251+
<dependency group='gradle.plugin.com.github.spotbugs.snom' module='spotbugs-gradle-plugin' version='4.0.8'>
252+
<sha512>24498846D540C1FDA16E3F835058DEAD3FE28C8D8D1AF35D1DA40C53441876AD3022085110ED3F633685EECC56642AB7B6EC7E6F1B0A11584CF4BBB3464C435D</sha512>
253+
</dependency>
251254
<dependency group='gradle.plugin.com.github.spotbugs' module='spotbugs-gradle-plugin' version='2.0.0'>
252255
<sha512>B3BFAD07E6A3D4D73CBCE802D8614CF4AC84E589166D243D41028DC077F84C027DF4D514F145360405F37DA73A8F2E7B65D90877A9EE1151174D2440530F9051</sha512>
253256
</dependency>

gradle/dependencies.gradle

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
*/
2626
ext {
2727
versions = [
28-
akka: '2.6.4',
28+
akka: '2.6.5',
2929
cache2k: '1.3.1.Alpha',
30-
checkerFramework: '3.3.0',
30+
checkerFramework: '3.4.0',
3131
collision: '0.3.3',
3232
commonsCompress: '1.20',
3333
commonsLang3: '3.10',
@@ -76,7 +76,7 @@ ext {
7676
pluginVersions = [
7777
apt: '0.21',
7878
bnd: '5.0.1',
79-
checkstyle: '8.31',
79+
checkstyle: '8.32',
8080
coveralls: '2.8.4',
8181
coverity: '1.0.10',
8282
errorprone: '1.1.1',
@@ -89,7 +89,7 @@ ext {
8989
shadow: '5.2.0',
9090
sonarqube: '2.8.0.1969',
9191
spotbugs: '4.0.2',
92-
spotbugsPlugin: '4.0.5',
92+
spotbugsPlugin: '4.0.8',
9393
stats: '0.2.2',
9494
versions: '0.28.0',
9595
]

gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-bin.zip
1+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-bin.zip
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME

simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/TraceFormat.java

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import com.github.benmanes.caffeine.cache.simulator.parser.address.penalties.AddressPenaltiesTraceReader;
3030
import com.github.benmanes.caffeine.cache.simulator.parser.arc.ArcTraceReader;
3131
import com.github.benmanes.caffeine.cache.simulator.parser.cache2k.Cache2kTraceReader;
32+
import com.github.benmanes.caffeine.cache.simulator.parser.camelab.CamelabTraceReader;
3233
import com.github.benmanes.caffeine.cache.simulator.parser.climb.ClimbTraceReader;
3334
import com.github.benmanes.caffeine.cache.simulator.parser.corda.CordaTraceReader;
3435
import com.github.benmanes.caffeine.cache.simulator.parser.gradle.GradleTraceReader;
@@ -56,6 +57,7 @@ public enum TraceFormat {
5657
ADAPT_SIZE(AdaptSizeReader::new),
5758
ARC(ArcTraceReader::new),
5859
CACHE2K(Cache2kTraceReader::new),
60+
CAMELAB(CamelabTraceReader::new),
5961
CLIMB(ClimbTraceReader::new),
6062
CORDA(CordaTraceReader::new),
6163
GRADLE(GradleTraceReader::new),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
* Copyright 2020 Ben Manes. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package com.github.benmanes.caffeine.cache.simulator.parser.camelab;
17+
18+
import java.io.IOException;
19+
import java.util.stream.LongStream;
20+
21+
import com.github.benmanes.caffeine.cache.simulator.parser.TextTraceReader;
22+
import com.github.benmanes.caffeine.cache.simulator.parser.TraceReader.KeyOnlyTraceReader;
23+
24+
/**
25+
* A reader for the trace files provided by
26+
* <a href="https://trace.camelab.org/2016/03/01/flash.html">Camelab</a>.
27+
*
28+
* @author ben.manes@gmail.com (Ben Manes)
29+
*/
30+
public final class CamelabTraceReader extends TextTraceReader implements KeyOnlyTraceReader {
31+
static final int BLOCK_SIZE = 512;
32+
33+
public CamelabTraceReader(String filePath) {
34+
super(filePath);
35+
}
36+
37+
@Override
38+
public LongStream keys() throws IOException {
39+
return lines().flatMapToLong(line -> {
40+
String[] array = line.split(" ", 5);
41+
char readWrite = Character.toLowerCase(array[1].charAt(0));
42+
if (readWrite == 'w') {
43+
return LongStream.empty();
44+
}
45+
46+
long startAddress = Long.parseLong(array[2]);
47+
int requestSize = Integer.parseInt(array[3]);
48+
long[] blocks = new long[requestSize];
49+
for (int i = 0; i < requestSize; i++) {
50+
blocks[i] = startAddress + (i * BLOCK_SIZE);
51+
}
52+
return LongStream.of(blocks);
53+
});
54+
}
55+
}

simulator/src/main/resources/reference.conf

+1
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,7 @@ caffeine.simulator {
447447
# address: format of UCSD program address traces
448448
# address-penalties: format of UCSD program address traces with hit & miss penalties
449449
# cache2k: format from the author of the Cache2k library
450+
# camelab: format from the Camelab storage traces
450451
# climb: format from the authors of the AdaptiveClimb algorithm
451452
# corda: format of Corda traces
452453
# gradle: format from the authors of the Gradle build tool

0 commit comments

Comments
 (0)