Skip to content

Commit

Permalink
Minor nits
Browse files Browse the repository at this point in the history
  • Loading branch information
ohadeytan committed Apr 25, 2021
1 parent bbd775a commit 0fd8377
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ public Stream<AccessEvent> events() throws IOException {
String[] array = line.split(" ", 3);
long startBlock = Long.parseLong(array[0]);
int sequence = Integer.parseInt(array[1]);
return LongStream.range(startBlock, startBlock + sequence).mapToObj(key -> AccessEvent.forKeyAndWeight(key, 512));
return LongStream.range(startBlock, startBlock + sequence)
.mapToObj(key -> AccessEvent.forKeyAndWeight(key, 512));
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright 2019 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://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.rewrite;

import java.io.BufferedWriter;
import java.io.IOException;

import com.github.benmanes.caffeine.cache.simulator.policy.AccessEvent;

/**
* The trace output format.
*
* @author [email protected] (Ben Manes)
*/
public enum OutputFormat {
CLIMB {
@Override public void write(BufferedWriter writer, AccessEvent event) throws IOException {
writer.write(Long.toString(event.key()));
writer.newLine();
}
},
ADAPT_SIZE {
long time = 0;
@Override public void write(BufferedWriter writer, AccessEvent event) throws IOException {
writer.write(Long.toString(time++) + " ");
writer.write(Long.toString(event.key()) + " ");
writer.write(Integer.toString(event.weight()));
writer.newLine();
}
};

public abstract void write(BufferedWriter writer, AccessEvent event) throws IOException;
}

0 comments on commit 0fd8377

Please sign in to comment.