Skip to content

Commit

Permalink
Add TPS to JSON profiler output. Pretty print JSON profiler output.
Browse files Browse the repository at this point in the history
Signed-off-by: Ross Allan <rallanpcl@gmail.com>
  • Loading branch information
LunNova committed Jun 9, 2013
1 parent 17e2fda commit df3f2da
Showing 1 changed file with 8 additions and 1 deletion.
Expand Up @@ -16,6 +16,7 @@

import me.nallar.tickprofiler.minecraft.TickProfiler;
import me.nallar.tickprofiler.minecraft.commands.ProfileCommand;
import me.nallar.tickprofiler.util.CollectionsUtil;
import me.nallar.tickprofiler.util.MappingUtil;
import me.nallar.tickprofiler.util.TableFormatter;
import me.nallar.tickprofiler.util.stringfillers.StringFiller;
Expand Down Expand Up @@ -225,7 +226,13 @@ public void writeJSONData(File file) throws IOException {
tf.recordTables();
writeData(tf, 20);
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.writeValue(file, tf.getTables());
List<Object> tables = tf.getTables();
long timeProfiled = System.currentTimeMillis() - startTime;
float tps = ticks * 1000f / timeProfiled;
tables.add(0, CollectionsUtil.map(
"TPS", tps
));
objectMapper.writerWithDefaultPrettyPrinter().writeValue(file, tables);
}

private static <T> List<T> sortedKeys(Map<T, ? extends Comparable<?>> map, int elements) {
Expand Down

0 comments on commit df3f2da

Please sign in to comment.