Skip to content

Commit

Permalink
'#1950: minor change to follow previous log alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
lfcnassif committed Apr 3, 2024
1 parent e345e49 commit 5b10e7f
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions iped-engine/src/main/java/iped/engine/core/Statistics.java
Original file line number Diff line number Diff line change
Expand Up @@ -248,24 +248,26 @@ public void logStatistics(Manager manager) throws Exception {
}
LocalConfig localConfig = ConfigurationManager.get().findObject(LocalConfig.class);
totalTime = totalTime / (1000000 * localConfig.getNumThreads());
LOGGER.info("Processing Times per Task:");
StringBuilder sb = new StringBuilder();
sb.append("Processing Times per Task:\n\n");
sb.append(String.format("%-30s", "TASK"));
sb.append(String.format(" %7s", "TIME(s)"));
sb.append(String.format(" %6s", "PCT(%)"));
sb.append("\n");
LOGGER.info(sb.toString());
sb.setLength(0);
sb.append(String.format("%-30s", "").replace(' ', '='));
sb.append(" ").append(String.format("%7s", "").replace(' ', '='));
sb.append(" ").append(String.format("%6s", "").replace(' ', '='));
sb.append("\n");
LOGGER.info(sb.toString());
sb.setLength(0);
for (int i = 0; i < taskTimes.length; i++) {
long sec = taskTimes[i] / (1000000 * localConfig.getNumThreads());
sb.append(String.format("%-30s", workers[0].tasks.get(i).getName()));
sb.append(String.format(" %7d", sec));
sb.append(String.format(" %6d", Math.round((100f * sec) / totalTime)));
sb.append("\n");
LOGGER.info(sb.toString());
sb.setLength(0);
}
LOGGER.info(sb.toString());

// Processing times per parser
TreeMap<String, Long> timesPerParser = new TreeMap<String, Long>();
Expand All @@ -278,24 +280,26 @@ public void logStatistics(Manager manager) throws Exception {
if (totalTime < 1)
totalTime = 1;
sb = new StringBuilder();
sb.append("Processing Times per Parser:\n\n");
LOGGER.info("Processing Times per Parser:");
sb.append(String.format("%-30s", "PARSER"));
sb.append(String.format(" %7s", "TIME(s)"));
sb.append(String.format(" %6s", "PCT(%)"));
sb.append("\n");
LOGGER.info(sb.toString());
sb.setLength(0);
sb.append(String.format("%-30s", "").replace(' ', '='));
sb.append(" ").append(String.format("%7s", "").replace(' ', '='));
sb.append(" ").append(String.format("%6s", "").replace(' ', '='));
sb.append("\n");
LOGGER.info(sb.toString());
sb.setLength(0);
for (String parserName : timesPerParser.keySet()) {
long time = timesPerParser.get(parserName);
long sec = time / (1000000 * workers.length);
sb.append(String.format("%-30s", parserName));
sb.append(String.format(" %7d", sec));
sb.append(String.format(" %6d", Math.round(100.0 * time / totalTime)));
sb.append("\n");
LOGGER.info(sb.toString());
sb.setLength(0);
}
LOGGER.info(sb.toString());
}

int numDocs;
Expand Down

0 comments on commit 5b10e7f

Please sign in to comment.