Main.java

56 lines | 1.836 kB Blame History Raw Download
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package br.ufrgs.inf.prosoft.trace.tools;

/**
 * @author romulo
 */
public class Main {

    public static void main(String[] args) {
        System.setProperty("java.util.logging.SimpleFormatter.format", "[%1$tF %1$tT+%1$tL] [%4$-7s] [Trace] %5$s %n");
        if (args.length < 2) {
            System.err.println("check <TracePath>");
            System.err.println("diff <FirstTracePath> <SecondTracePath>");
            System.err.println("hash <InputTracePath> <OutputTracePath>");
            System.err.println("average <TracePath> <ReducePath> <Prefix>");
            System.err.println("distribution <TracePath> <OutputPath> <Prefix>");
            System.exit(1);
        }
        String tool = args[0];
        String firstPath = args[1];
        if (tool.equals("check")) {
            CheckTraces.check(firstPath);
            return;
        }
        if (args.length < 3) {
            System.err.println("wrong input");
            System.exit(1);
        }
        String secondPath = args[2];
        if (tool.equals("diff")) {
            DiffTraces.diff(firstPath, secondPath);
            return;
        }
        if (tool.equals("hash")) {
            HashFile.convert(firstPath, secondPath);
            return;
        }
        String prefix = args[3] != null ? args[3] : "";
        if (tool.equals("average")) {
            CalculateMetrics.calculateAverageExecutionTime(firstPath, secondPath, prefix);
            return;
        }
        if (tool.equals("distribution")) {
            Distribution.exportDistributions(firstPath, secondPath, prefix);
            return;
        }
        System.err.println("option not found");
        System.exit(1);
    }

}