use of org.perf4j.StopWatch in project bioformats by openmicroscopy.
the class OpenBytesPerformanceTest method testOpenBytesAllTilesNewBuffer.
@Test(dependsOnMethods = { "setId" })
public void testOpenBytesAllTilesNewBuffer() throws Exception {
for (int series = 0; series < seriesCount; series++) {
assertSeries(series);
for (int image = 0; image < imageCount; image++) {
LOGGER.info("Reading from series {} image {}", series, image);
optimalTileWidth = reader.getOptimalTileWidth();
optimalTileHeight = reader.getOptimalTileHeight();
LOGGER.info("Optimal tile {}x{}", optimalTileWidth, optimalTileHeight);
int tilesWide = (int) Math.ceil((double) sizeX / optimalTileWidth);
int tilesHigh = (int) Math.ceil((double) sizeY / optimalTileHeight);
LOGGER.info("Tile counts {}x{}", tilesWide, tilesHigh);
int x, y = 0;
StopWatch stopWatch;
for (int tileX = 0; tileX < tilesWide; tileX++) {
for (int tileY = 0; tileY < tilesHigh; tileY++) {
x = tileX * optimalTileWidth;
y = tileY * optimalTileHeight;
int actualTileWidth = (int) Math.min(optimalTileWidth, reader.getSizeX() - x);
int actualTileHeight = (int) Math.min(optimalTileHeight, reader.getSizeY() - y);
LOGGER.info("Reading tile at {}x{}", x, y);
stopWatch = new Slf4JStopWatch(String.format("%s.alloc_tile.%s.[%d:%d]", ((ReaderWrapper) reader).unwrap().getClass().getName(), filename, series, image));
reader.openBytes(0, x, y, actualTileWidth, actualTileHeight);
stopWatch.stop();
}
}
}
}
}
Aggregations