Example usage for java.util.concurrent TimeUnit NANOSECONDS

List of usage examples for java.util.concurrent TimeUnit NANOSECONDS

Introduction

In this page you can find the example usage for java.util.concurrent TimeUnit NANOSECONDS.

Prototype

TimeUnit NANOSECONDS

To view the source code for java.util.concurrent TimeUnit NANOSECONDS.

Click Source Link

Document

Time unit representing one thousandth of a microsecond.

Usage

From source file:io.anserini.util.SearchTimeUtil.java

public static void main(String[] args) throws IOException, ParseException, ClassNotFoundException,
        NoSuchMethodException, InvocationTargetException, IllegalAccessException, InstantiationException {

    if (args.length != 1) {
        System.err.println("Usage: SearchTimeUtil <indexDir>");
        System.err.println("indexDir: index directory");
        System.exit(1);/*  w  w w  . ja  va 2 s  .  co m*/
    }

    String[] topics = { "topics.web.1-50.txt", "topics.web.51-100.txt", "topics.web.101-150.txt",
            "topics.web.151-200.txt", "topics.web.201-250.txt", "topics.web.251-300.txt" };

    SearchWebCollection searcher = new SearchWebCollection(args[0]);

    for (String topicFile : topics) {
        Path topicsFile = Paths.get("src/resources/topics-and-qrels/", topicFile);
        TopicReader tr = (TopicReader) Class.forName("io.anserini.search.query." + "Webxml" + "TopicReader")
                .getConstructor(Path.class).newInstance(topicsFile);
        SortedMap<Integer, String> queries = tr.read();
        for (int i = 1; i <= 3; i++) {
            final long start = System.nanoTime();
            String submissionFile = File.createTempFile(topicFile + "_" + i, ".tmp").getAbsolutePath();
            RerankerCascade cascade = new RerankerCascade();
            cascade.add(new IdentityReranker());
            searcher.search(queries, submissionFile, new BM25Similarity(0.9f, 0.4f), 1000, cascade);
            final long durationMillis = TimeUnit.MILLISECONDS.convert(System.nanoTime() - start,
                    TimeUnit.NANOSECONDS);
            System.out.println(topicFile + "_" + i + " search completed in "
                    + DurationFormatUtils.formatDuration(durationMillis, "mm:ss:SSS"));
        }
    }

    searcher.close();
}

From source file:net.yacy.cora.document.id.DigestURLHashPerfTest.java

/**
 * Run and measure the {@link DigestURL#hash()} method on a list of urls
 * provided in a given file (one URL per line). When an output file path is
 * provided, generated hashes are written to it.
 *
 * @param args/*from   w w  w.j av  a 2 s  .  c o  m*/
 *            parameters
 * @throws IOException
 */
public static void main(final String[] args) throws IOException {
    if (args.length < 1) {
        System.out.println("Usage : java DigestURLHashPerfTest <urlsFilePath> [outputFilePath]");
        return;
    }

    final File inFile = new File(args[0]);
    final List<String> urls = FileUtils.getListArray(inFile);

    System.out.println(urls.size() + " URLs loaded from " + inFile.getAbsolutePath());

    try (OutputStream outStream = args.length >= 2 ? new FileOutputStream(args[1]) : new NullOutputStream();
            OutputStreamWriter writer = new OutputStreamWriter(outStream, StandardCharsets.UTF_8.name());
            BufferedWriter out = new BufferedWriter(writer);) {

        if (args.length >= 2) {
            System.out.println("Writing URL hashes to " + args[1]);
        }
        byte[] hash;
        DigestURL url;
        long beginTime = System.nanoTime(), time, minTime = Long.MAX_VALUE, maxTime = 0, meanTime = 0,
                totalTime = 0;
        int step = 0;
        for (final String urlStr : urls) {
            try {
                url = new DigestURL(urlStr);
                beginTime = System.nanoTime();
                hash = url.hash();
                time = System.nanoTime() - beginTime;
                minTime = Math.min(minTime, time);
                maxTime = Math.max(maxTime, time);
                totalTime += time;
                out.write(ASCII.String(hash));
                out.newLine();
                step++;
            } catch (final MalformedURLException e) {
                e.printStackTrace();
            }
        }
        if (step > 0) {
            meanTime = totalTime / step;
        } else {
            meanTime = totalTime;
        }

        System.out.println("Hash generation total time (ms) : " + TimeUnit.NANOSECONDS.toMillis(totalTime)
                + " on " + step + " urls.");
        System.out.println("Render mean time (ms) : " + TimeUnit.NANOSECONDS.toMillis(meanTime));
        System.out.println("Render min time (ms) : " + TimeUnit.NANOSECONDS.toMillis(minTime));
        System.out.println("Render max time (ms) : " + TimeUnit.NANOSECONDS.toMillis(maxTime));
    } finally {
        try {
            Domains.close();
        } finally {
            ConcurrentLog.shutdown();
        }
    }

}

From source file:ch.windmobile.server.socialmodel.mogodb.HeavyLoadTest.java

public static void main(String[] args) {
    try {/*  w  w w .  j a va  2  s  . co  m*/
        HeavyLoadTest test = new HeavyLoadTest();
        test.beforeTest();
        long before = System.nanoTime();
        test.testFullChatCycle();
        System.out.println("Time : " + TimeUnit.NANOSECONDS.toMicros((System.nanoTime() - before)) + " s");
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:gobblin.compaction.hive.CompactionRunner.java

public static void main(String[] args) throws IOException, ConfigurationException {

    properties = CliOptions.parseArgs(MRCompactionRunner.class, args);

    File compactionConfigDir = new File(properties.getProperty(COMPACTION_CONFIG_DIR));
    File[] listOfFiles = compactionConfigDir.listFiles();
    if (listOfFiles == null || listOfFiles.length == 0) {
        System.err.println("No compaction configuration files found under " + compactionConfigDir);
        System.exit(1);/*from w  w w.j a  va2  s. c  om*/
    }

    int numOfJobs = 0;
    for (File file : listOfFiles) {
        if (file.isFile() && !file.getName().startsWith(".")) {
            numOfJobs++;
        }
    }
    LOG.info("Found " + numOfJobs + " compaction tasks.");
    try (PrintWriter pw = new PrintWriter(new OutputStreamWriter(
            new FileOutputStream(properties.getProperty(TIMING_FILE, TIMING_FILE_DEFAULT)),
            Charset.forName("UTF-8")))) {

        for (File file : listOfFiles) {
            if (file.isFile() && !file.getName().startsWith(".")) {
                Configuration jobConfig = new PropertiesConfiguration(file.getAbsolutePath());
                jobProperties = ConfigurationConverter.getProperties(jobConfig);
                long startTime = System.nanoTime();
                compact();
                long endTime = System.nanoTime();
                long elapsedTime = endTime - startTime;
                double seconds = TimeUnit.NANOSECONDS.toSeconds(elapsedTime);
                pw.printf("%s: %f%n", file.getAbsolutePath(), seconds);
            }
        }
    }
}

From source file:gobblin.compaction.CompactionRunner.java

public static void main(String[] args) throws ConfigurationException, IOException, SQLException {

    if (args.length != 1) {
        LOG.info("Proper usage: java -jar compaction.jar <global-config-file>\n" + "or\n"
                + "hadoop jar compaction.jar <global-config-file>\n" + "or\n"
                + "yarn jar compaction.jar <global-config-file>\n");
        System.exit(1);//ww w .j  av  a  2  s.co  m
    }

    Configuration globalConfig = new PropertiesConfiguration(args[0]);
    properties = ConfigurationConverter.getProperties(globalConfig);

    File compactionConfigDir = new File(properties.getProperty(COMPACTION_CONFIG_DIR));
    File[] listOfFiles = compactionConfigDir.listFiles();
    if (listOfFiles == null || listOfFiles.length == 0) {
        System.err.println("No compaction configuration files found under " + compactionConfigDir);
        System.exit(1);
    }

    int numOfJobs = 0;
    for (File file : listOfFiles) {
        if (file.isFile() && !file.getName().startsWith(".")) {
            numOfJobs++;
        }
    }
    LOG.info("Found " + numOfJobs + " compaction tasks.");
    PrintWriter pw = new PrintWriter(new OutputStreamWriter(
            new FileOutputStream(properties.getProperty(TIMING_FILE, TIMING_FILE_DEFAULT)),
            Charset.forName("UTF-8")));

    for (File file : listOfFiles) {
        if (file.isFile() && !file.getName().startsWith(".")) {
            Configuration jobConfig = new PropertiesConfiguration(file.getAbsolutePath());
            jobProperties = ConfigurationConverter.getProperties(jobConfig);
            long startTime = System.nanoTime();
            compact();
            long endTime = System.nanoTime();
            long elapsedTime = endTime - startTime;
            double seconds = TimeUnit.NANOSECONDS.toSeconds(elapsedTime);
            pw.printf("%s: %f%n", file.getAbsolutePath(), seconds);
        }
    }

    pw.close();
}

From source file:fr.tpt.s3.mcdag.scheduling.Main.java

public static void main(String[] args) throws IOException, InterruptedException {

    /* Command line options */
    Options options = new Options();

    Option input = new Option("i", "input", true, "MC-DAG XML Models");
    input.setRequired(true);/*w  w w.  j  a v  a  2  s .  c  om*/
    input.setArgs(Option.UNLIMITED_VALUES); // Sets maximum number of threads to be launched
    options.addOption(input);

    Option outSched = new Option("os", "out-scheduler", false, "Write the scheduling tables into a file.");
    outSched.setRequired(false);
    options.addOption(outSched);

    Option outPrism = new Option("op", "out-prism", false, "Write PRISM model into a file.");
    outPrism.setRequired(false);
    options.addOption(outPrism);

    Option jobs = new Option("j", "jobs", true, "Number of threads to be launched.");
    jobs.setRequired(false);
    options.addOption(jobs);

    Option debugOpt = new Option("d", "debug", false, "Enabling debug.");
    debugOpt.setRequired(false);
    options.addOption(debugOpt);

    Option preemptOpt = new Option("p", "preempt", false, "Count for preemptions.");
    preemptOpt.setRequired(false);
    options.addOption(preemptOpt);

    CommandLineParser parser = new DefaultParser();
    HelpFormatter formatter = new HelpFormatter();
    CommandLine cmd;

    try {
        cmd = parser.parse(options, args);
    } catch (ParseException e) {
        System.err.println(e.getMessage());
        formatter.printHelp("MC-DAG framework", options);

        System.exit(1);
        return;
    }

    String inputFilePath[] = cmd.getOptionValues("input");
    boolean bOutSched = cmd.hasOption("out-scheduler");
    boolean bOutPrism = cmd.hasOption("out-prism");
    boolean debug = cmd.hasOption("debug");
    boolean preempt = cmd.hasOption("preempt");
    boolean levels = cmd.hasOption("n-levels");
    int nbFiles = inputFilePath.length;

    int nbJobs = 1;
    if (cmd.hasOption("jobs"))
        nbJobs = Integer.parseInt(cmd.getOptionValue("jobs"));

    if (debug)
        System.out.println("[DEBUG] Launching " + inputFilePath.length + " thread(s).");

    int i_files = 0;
    ExecutorService executor = Executors.newFixedThreadPool(nbJobs);

    /* Launch threads to solve allocation */
    while (i_files != nbFiles) {
        SchedulingThread ft = new SchedulingThread(inputFilePath[i_files], bOutSched, bOutPrism, debug,
                preempt);

        ft.setLevels(levels);
        executor.execute(ft);
        i_files++;
    }

    executor.shutdown();
    executor.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS);
    System.out.println("[FRAMEWORK Main] DONE");
}

From source file:net.sf.sessionAnalysis.SessionAnalyzer.java

public static void main(String[] args) throws IOException {

    final SessionDatReader sessionDatReader = new SessionDatReader(INPUT_SESSIONS_DAT_FN);

    final SessionVisitorSessionLengthNumActionsStatistics sessionVisitorSessionLengthStatistics = new SessionVisitorSessionLengthNumActionsStatistics();
    sessionDatReader.registerVisitor(sessionVisitorSessionLengthStatistics);

    final SessionVisitorSessionLengthNanosStatistics sessionVisitorSessionLengthNanosStatistics = new SessionVisitorSessionLengthNanosStatistics();
    sessionDatReader.registerVisitor(sessionVisitorSessionLengthNanosStatistics);

    final SessionVisitorMinMaxTimeStamp sessionVisitorMinMaxTimeStamp = new SessionVisitorMinMaxTimeStamp();
    sessionDatReader.registerVisitor(sessionVisitorMinMaxTimeStamp);

    final SessionVisitorResponseTimes sessionVisitorResponseTimes = new SessionVisitorResponseTimes();
    sessionDatReader.registerVisitor(sessionVisitorResponseTimes);

    final SessionVisitorArrivalAndCompletionRate sessionVisitorArrivalAndCompletionRate = new SessionVisitorArrivalAndCompletionRate(
            1, TimeUnit.MINUTES);
    sessionDatReader.registerVisitor(sessionVisitorArrivalAndCompletionRate);

    SessionVisitorRequestTypeCounter sessionVisitorRequestTypeCounter = new SessionVisitorRequestTypeCounter();
    sessionDatReader.registerVisitor(sessionVisitorRequestTypeCounter);

    final SessionVisitorDistinctSessions sessionVisitorDistinctSessions = new SessionVisitorDistinctSessions();
    sessionDatReader.registerVisitor(sessionVisitorDistinctSessions);

    final SessionVisitorBehaviorMix sessionVisitorBehaviorMix = new SessionVisitorBehaviorMix();
    sessionDatReader.registerVisitor(sessionVisitorBehaviorMix);

    sessionDatReader.read();/*from w  w w .  j  a  v a 2 s .  c o m*/

    /*
     * Session length histogram. Results can be compared analysis on raw
     * data: cat
     * ../evaluation/SPECjEnterprise-data/kieker-20110929-14382537-
     * UTC-blade3-KIEKER-SPECjEnterprise2010-20-min-excerpt-sessions.dat |
     * awk -F ";" '{print NF-1}' | sort -n | uniq -c | wc -l
     */
    System.out.println(
            "Num sessions: " + sessionVisitorArrivalAndCompletionRate.getCompletionTimestamps().length);
    System.out.println("Num distinct sessions: " + sessionVisitorDistinctSessions.numDistinctSessions());
    System.out
            .println("Length histogram: " + sessionVisitorSessionLengthStatistics.getSessionLengthHistogram());
    sessionVisitorSessionLengthStatistics.writeSessionsOverTime(OUTPUT_DIR);
    //System.out.println("Length vector: " + ArrayUtils.toString(sessionVisitorSessionLengthStatistics.computeLengthVector()));
    System.out.println("Mean length (# user actions): "
            + sessionVisitorSessionLengthStatistics.computeSessionLengthMean());
    System.out.println("Standard dev (# user actions): "
            + sessionVisitorSessionLengthStatistics.computeSessionLengthStdDev());
    sessionVisitorSessionLengthNanosStatistics.writeSessionsOverTime(OUTPUT_DIR);
    System.out.println("Mean length (milliseconds): " + TimeUnit.MILLISECONDS.convert(
            (long) sessionVisitorSessionLengthNanosStatistics.computeSessionLengthMean(),
            TimeUnit.NANOSECONDS));
    System.out.println("Standard dev (milliseconds): " + TimeUnit.MILLISECONDS.convert(
            (long) sessionVisitorSessionLengthNanosStatistics.computeSessionLengthStdDev(),
            TimeUnit.NANOSECONDS));
    System.out.println(
            "Average Session Duration: " + sessionVisitorMinMaxTimeStamp.getAverageSessionTimeLength());
    System.out.println("Timespan (nanos since epoche): " + sessionVisitorMinMaxTimeStamp.getMinTimeStamp()
            + " - " + sessionVisitorMinMaxTimeStamp.getMaxTimeStamp());
    System.out.println("Timespan (local date/time): " + sessionVisitorMinMaxTimeStamp.getMinDateTime() + " - "
            + sessionVisitorMinMaxTimeStamp.getMaxDateTime());
    {
        System.out.println("Arrival rates: "
                + ArrayUtils.toString(sessionVisitorArrivalAndCompletionRate.getArrivalRates()));
        System.out.println("Session duration rates: "
                + ArrayUtils.toString(sessionVisitorArrivalAndCompletionRate.getSessionDuration()));
        System.out.println("User action rates: "
                + ArrayUtils.toString(sessionVisitorArrivalAndCompletionRate.getUserActionRates()));
        System.out.println("Completion rates: "
                + ArrayUtils.toString(sessionVisitorArrivalAndCompletionRate.getCompletionRates()));
        System.out.println("Max number of sessions per time interval: "
                + ArrayUtils.toString(sessionVisitorArrivalAndCompletionRate.getMaxNumSessionsPerInterval()));
        sessionVisitorArrivalAndCompletionRate.writeArrivalCompletionRatesAndMaxNumSessions(OUTPUT_DIR);
    }
    {
        //System.out.println("Concurrent number of sessions over time" + sessionVisitorArrivalAndCompletionRate.getNumConcurrentSessionsOverTime());
        sessionVisitorArrivalAndCompletionRate.writeSessionsOverTime(OUTPUT_DIR);
    }
    {
        sessionVisitorRequestTypeCounter.writeCallFrequencies(OUTPUT_DIR);
    }
    {
        sessionVisitorDistinctSessions.writeDistinctSessions(OUTPUT_DIR);
    }
    sessionVisitorResponseTimes.printResponseTimes();
    sessionVisitorBehaviorMix.printRequestTypes();
}

From source file:ch.windmobile.server.socialmodel.mogodb.FavoritesTest.java

public static void main(String[] args) {
    try {/*from w w  w . j  a  v a2  s  .  c o m*/
        FavoritesTest test = new FavoritesTest();
        test.beforeTest();
        long before = System.nanoTime();
        test.testAddToFavorites();
        test.testAddToFavorites();
        test.testRemoveFromFavorites();
        test.testClearFavorites();
        test.testGetFavorites();
        System.out.println("Time : " + TimeUnit.NANOSECONDS.toMicros((System.nanoTime() - before)) + " ms");
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:DIA_Umpire_To_Skyline.DIA_Umpire_To_Skyline.java

/**
 * @param args the command line arguments
 *//*from   w w w  .ja  v  a  2 s.  c o m*/
public static void main(String[] args) throws FileNotFoundException, IOException, Exception {
    System.out.println(
            "=================================================================================================");
    System.out.println("DIA-Umpire_To_Skyline (version: " + UmpireInfo.GetInstance().Version + ")");
    if (args.length < 1) {
        System.out.println(
                "command format error, it should be like: java -jar -Xmx20G DIA_Umpire_To_Skyline.jar Path NoThreads");
        System.out.println("command : java -jar -Xmx20G DIA_Umpire_To_Skyline.jar Path [Option]\n");
        System.out.println("\nOptions");
        System.out.println("\t-t\tNo. of threads, Ex: -t4 (using four threads, default value)");
        System.out.println(
                "\t-cP\tPath of msconvert.exe for mzXML conversion, Ex: -cP (using four threads, default value)");
        return;
    }
    try {
        ConsoleLogger.SetConsoleLogger(Level.DEBUG);
        ConsoleLogger.SetFileLogger(Level.DEBUG,
                FilenameUtils.getFullPath(args[0]) + "diaumpire_to_skyline.log");
    } catch (Exception e) {
        System.out.println("Logger initialization failed");
    }

    Logger.getRootLogger().info("Path:" + args[0]);
    String msconvertpath = "C:/inetpub/tpp-bin/msconvert";

    String WorkFolder = args[0];
    int NoCPUs = 4;

    for (int i = 1; i < args.length; i++) {
        if (args[i].startsWith("-")) {
            if (args[i].startsWith("-cP")) {
                msconvertpath = args[i].substring(3);
                Logger.getRootLogger().info("MSConvert path: " + msconvertpath);
            }
            if (args[i].startsWith("-t")) {
                NoCPUs = Integer.parseInt(args[i].substring(2));
                Logger.getRootLogger().info("No. of threads: " + NoCPUs);
            }
        }
    }

    HashMap<String, File> AssignFiles = new HashMap<>();

    try {
        File folder = new File(WorkFolder);
        if (!folder.exists()) {
            Logger.getRootLogger().info("Path: " + folder.getAbsolutePath() + " cannot be found.");
        }
        for (final File fileEntry : folder.listFiles()) {
            if (fileEntry.isFile() && fileEntry.getAbsolutePath().toLowerCase().endsWith(".mzxml")
                    && !fileEntry.getAbsolutePath().toLowerCase().endsWith("q1.mzxml")
                    && !fileEntry.getAbsolutePath().toLowerCase().endsWith("q2.mzxml")
                    && !fileEntry.getAbsolutePath().toLowerCase().endsWith("q3.mzxml")) {
                AssignFiles.put(fileEntry.getAbsolutePath(), fileEntry);
            }
            if (fileEntry.isDirectory()) {
                for (final File fileEntry2 : fileEntry.listFiles()) {
                    if (fileEntry2.isFile() && fileEntry2.getAbsolutePath().toLowerCase().endsWith(".mzxml")
                            && !fileEntry2.getAbsolutePath().toLowerCase().endsWith("q1.mzxml")
                            && !fileEntry2.getAbsolutePath().toLowerCase().endsWith("q2.mzxml")
                            && !fileEntry2.getAbsolutePath().toLowerCase().endsWith("q3.mzxml")) {
                        AssignFiles.put(fileEntry2.getAbsolutePath(), fileEntry2);
                    }
                }
            }
        }

        Logger.getRootLogger().info("No. of files assigned :" + AssignFiles.size());
        for (File fileEntry : AssignFiles.values()) {
            Logger.getRootLogger().info(fileEntry.getAbsolutePath());
        }

        ExecutorService executorPool = null;
        executorPool = Executors.newFixedThreadPool(3);

        for (File fileEntry : AssignFiles.values()) {
            String mzXMLFile = fileEntry.getAbsolutePath();
            FileThread thread = new FileThread(mzXMLFile, NoCPUs, msconvertpath);
            executorPool.execute(thread);
        }
        executorPool.shutdown();
        try {
            executorPool.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS);
        } catch (InterruptedException e) {
            Logger.getRootLogger().info("interrupted..");
        }
    } catch (Exception e) {
        Logger.getRootLogger().error(e.getMessage());
        throw e;
    }
    Logger.getRootLogger().info("Job done");
    Logger.getRootLogger().info(
            "=================================================================================================");

}

From source file:fr.tpt.s3.mcdag.bench.MainBench.java

public static void main(String[] args) throws IOException, InterruptedException {

    // Command line options
    Options options = new Options();

    Option input = new Option("i", "input", true, "MC-DAG XML models");
    input.setRequired(true);//from  ww w .j a v  a2s  . c  om
    input.setArgs(Option.UNLIMITED_VALUES);
    options.addOption(input);

    Option output = new Option("o", "output", true, "Folder where results have to be written.");
    output.setRequired(true);
    options.addOption(output);

    Option uUti = new Option("u", "utilization", true, "Utilization.");
    uUti.setRequired(true);
    options.addOption(uUti);

    Option output2 = new Option("ot", "output-total", true, "File where total results are being written");
    output2.setRequired(true);
    options.addOption(output2);

    Option oCores = new Option("c", "cores", true, "Cores given to the test");
    oCores.setRequired(true);
    options.addOption(oCores);

    Option oLvls = new Option("l", "levels", true, "Levels tested for the system");
    oLvls.setRequired(true);
    options.addOption(oLvls);

    Option jobs = new Option("j", "jobs", true, "Number of threads to be launched.");
    jobs.setRequired(false);
    options.addOption(jobs);

    Option debug = new Option("d", "debug", false, "Debug logs.");
    debug.setRequired(false);
    options.addOption(debug);

    /*
     * Parsing of the command line
     */
    CommandLineParser parser = new DefaultParser();
    HelpFormatter formatter = new HelpFormatter();
    CommandLine cmd;

    try {
        cmd = parser.parse(options, args);
    } catch (ParseException e) {
        System.err.println(e.getMessage());
        formatter.printHelp("Benchmarks MultiDAG", options);
        System.exit(1);
        return;
    }

    String inputFilePath[] = cmd.getOptionValues("input");
    String outputFilePath = cmd.getOptionValue("output");
    String outputFilePathTotal = cmd.getOptionValue("output-total");
    double utilization = Double.parseDouble(cmd.getOptionValue("utilization"));
    boolean boolDebug = cmd.hasOption("debug");
    int nbLvls = Integer.parseInt(cmd.getOptionValue("levels"));
    int nbJobs = 1;
    int nbFiles = inputFilePath.length;

    if (cmd.hasOption("jobs"))
        nbJobs = Integer.parseInt(cmd.getOptionValue("jobs"));

    int nbCores = Integer.parseInt(cmd.getOptionValue("cores"));

    /*
     *  While files need to be allocated
     *  run the tests in the pool of threads
     */

    // For dual-criticality systems we call a specific thread
    if (nbLvls == 2) {

        System.out.println(">>>>>>>>>>>>>>>>>>>>> NB levels " + nbLvls);

        int i_files2 = 0;
        String outFile = outputFilePath.substring(0, outputFilePath.lastIndexOf('.'))
                .concat("-schedulability.csv");
        PrintWriter writer = new PrintWriter(outFile, "UTF-8");
        writer.println(
                "Thread; File; FSched (%); FPreempts; FAct; LSched (%); LPreempts; LAct; ESched (%); EPreempts; EAct; HSched(%); HPreempts; HAct; Utilization");
        writer.close();

        ExecutorService executor2 = Executors.newFixedThreadPool(nbJobs);
        while (i_files2 != nbFiles) {
            BenchThreadDualCriticality bt2 = new BenchThreadDualCriticality(inputFilePath[i_files2], outFile,
                    nbCores, boolDebug);

            executor2.execute(bt2);
            i_files2++;
        }

        executor2.shutdown();
        executor2.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS);

        int fedTotal = 0;
        int laxTotal = 0;
        int edfTotal = 0;
        int hybridTotal = 0;
        int fedPreempts = 0;
        int laxPreempts = 0;
        int edfPreempts = 0;
        int hybridPreempts = 0;
        int fedActiv = 0;
        int laxActiv = 0;
        int edfActiv = 0;
        int hybridActiv = 0;
        // Read lines in file and do average
        int i = 0;
        File f = new File(outFile);
        @SuppressWarnings("resource")
        Scanner line = new Scanner(f);
        while (line.hasNextLine()) {
            String s = line.nextLine();
            if (i > 0) { // To skip the first line
                try (Scanner inLine = new Scanner(s).useDelimiter("; ")) {
                    int j = 0;

                    while (inLine.hasNext()) {
                        String val = inLine.next();
                        if (j == 2) {
                            fedTotal += Integer.parseInt(val);
                        } else if (j == 3) {
                            fedPreempts += Integer.parseInt(val);
                        } else if (j == 4) {
                            fedActiv += Integer.parseInt(val);
                        } else if (j == 5) {
                            laxTotal += Integer.parseInt(val);
                        } else if (j == 6) {
                            laxPreempts += Integer.parseInt(val);
                        } else if (j == 7) {
                            laxActiv += Integer.parseInt(val);
                        } else if (j == 8) {
                            edfTotal += Integer.parseInt(val);
                        } else if (j == 9) {
                            edfPreempts += Integer.parseInt(val);
                        } else if (j == 10) {
                            edfActiv += Integer.parseInt(val);
                        } else if (j == 11) {
                            hybridTotal += Integer.parseInt(val);
                        } else if (j == 12) {
                            hybridPreempts += Integer.parseInt(val);
                        } else if (j == 13) {
                            hybridActiv += Integer.parseInt(val);
                        }
                        j++;
                    }
                }
            }
            i++;
        }

        // Write percentage
        double fedPerc = (double) fedTotal / nbFiles;
        double laxPerc = (double) laxTotal / nbFiles;
        double edfPerc = (double) edfTotal / nbFiles;
        double hybridPerc = (double) hybridTotal / nbFiles;

        double fedPercPreempts = (double) fedPreempts / fedActiv;
        double laxPercPreempts = (double) laxPreempts / laxActiv;
        double edfPercPreempts = (double) edfPreempts / edfActiv;
        double hybridPercPreempts = (double) hybridPreempts / hybridActiv;

        Writer wOutput = new BufferedWriter(new FileWriter(outputFilePathTotal, true));
        wOutput.write(Thread.currentThread().getName() + "; " + utilization + "; " + fedPerc + "; "
                + fedPreempts + "; " + fedActiv + "; " + fedPercPreempts + "; " + laxPerc + "; " + laxPreempts
                + "; " + laxActiv + "; " + laxPercPreempts + "; " + edfPerc + "; " + edfPreempts + "; "
                + edfActiv + "; " + edfPercPreempts + "; " + hybridPerc + "; " + hybridPreempts + "; "
                + hybridActiv + "; " + hybridPercPreempts + "\n");
        wOutput.close();

    } else if (nbLvls > 2) {
        int i_files2 = 0;
        String outFile = outputFilePath.substring(0, outputFilePath.lastIndexOf('.'))
                .concat("-schedulability.csv");
        PrintWriter writer = new PrintWriter(outFile, "UTF-8");
        writer.println(
                "Thread; File; LSched (%); LPreempts; LAct; ESched (%); EPreempts; EAct; HSched(%); HPreempts; HAct; Utilization");
        writer.close();

        ExecutorService executor2 = Executors.newFixedThreadPool(nbJobs);
        while (i_files2 != nbFiles) {
            BenchThreadNLevels bt2 = new BenchThreadNLevels(inputFilePath[i_files2], outFile, nbCores,
                    boolDebug);

            executor2.execute(bt2);
            i_files2++;
        }

        executor2.shutdown();
        executor2.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS);

        int laxTotal = 0;
        int edfTotal = 0;
        int hybridTotal = 0;
        int laxPreempts = 0;
        int edfPreempts = 0;
        int hybridPreempts = 0;
        int laxActiv = 0;
        int edfActiv = 0;
        int hybridActiv = 0;
        // Read lines in file and do average
        int i = 0;
        File f = new File(outFile);
        @SuppressWarnings("resource")
        Scanner line = new Scanner(f);
        while (line.hasNextLine()) {
            String s = line.nextLine();
            if (i > 0) { // To skip the first line
                try (Scanner inLine = new Scanner(s).useDelimiter("; ")) {
                    int j = 0;

                    while (inLine.hasNext()) {
                        String val = inLine.next();
                        if (j == 2) {
                            laxTotal += Integer.parseInt(val);
                        } else if (j == 3) {
                            laxPreempts += Integer.parseInt(val);
                        } else if (j == 4) {
                            laxActiv += Integer.parseInt(val);
                        } else if (j == 5) {
                            edfTotal += Integer.parseInt(val);
                        } else if (j == 6) {
                            edfPreempts += Integer.parseInt(val);
                        } else if (j == 7) {
                            edfActiv += Integer.parseInt(val);
                        } else if (j == 8) {
                            hybridTotal += Integer.parseInt(val);
                        } else if (j == 9) {
                            hybridPreempts += Integer.parseInt(val);
                        } else if (j == 10) {
                            hybridActiv += Integer.parseInt(val);
                        }
                        j++;
                    }
                }
            }
            i++;
        }

        // Write percentage
        double laxPerc = (double) laxTotal / nbFiles;
        double edfPerc = (double) edfTotal / nbFiles;
        double hybridPerc = (double) hybridTotal / nbFiles;

        double laxPercPreempts = (double) laxPreempts / laxActiv;
        double edfPercPreempts = (double) edfPreempts / edfActiv;
        double hybridPercPreempts = (double) hybridPreempts / hybridActiv;

        Writer wOutput = new BufferedWriter(new FileWriter(outputFilePathTotal, true));
        wOutput.write(Thread.currentThread().getName() + "; " + utilization + "; " + laxPerc + "; "
                + laxPreempts + "; " + laxActiv + "; " + laxPercPreempts + "; " + edfPerc + "; " + edfPreempts
                + "; " + edfActiv + "; " + edfPercPreempts + "; " + hybridPerc + "; " + hybridPreempts + "; "
                + hybridActiv + "; " + hybridPercPreempts + "\n");
        wOutput.close();

    } else {
        System.err.println("Wrong number of levels");
        System.exit(-1);
    }

    System.out.println("[BENCH Main] Done benchmarking U = " + utilization + " Levels " + nbLvls);
}