}
//reads file and generates graph. Code linked with code of CSVOutputReader.
private void loadCSV() throws IOException, ParseException {
File measureFile = new File(filename);
VerboseCSVMeasureOutputReader reader = new VerboseCSVMeasureOutputReader(measureFile, measureDefinition.getLogDecimalSeparator(),measureDefinition.getLogCsvDelimiter());
statistics = new SampleStatistics();
// Skips header.
updateProgress(0.0);
reader.openFile(start > 1 ? start : 1);
try {
long lastUpdateTime = System.currentTimeMillis();
while(reader.hasMoreLines()) {
reader.readLine();
statistics.putNewSample(reader.getParsedSample(), reader.getParsedWeight());
// Fills distribution if present
if (dist != null) {
dist.addSample(reader.getParsedSample(), reader.getParsedWeight());
}
if (System.currentTimeMillis() - lastUpdateTime > UPDATE_PCT_MILLIS) {
updateProgress(reader.getParsedPercentage());
lastUpdateTime = System.currentTimeMillis();
}
if (end > 0 && reader.getLineNumber() >= end) {
break;
}
}
// If totalLines was not set, count them.
if (totalLines <= 0) {
while(reader.hasMoreLines()) {
reader.readLine();
}
totalLines = reader.getLineNumber();
}
} finally {
reader.closeFile();
updateProgress(100.0);
}
}