/*
 *  @author Ranides Atterwim <ranides@gmail.com>
 *  @copyright Ranides Atterwim
 *  @license WTFPL
 *  @url http://ranides.net/projects/assira
 */

package net.ranides.assira.time;


/**
 *
 * @author ranides
 */
public class TimeResult {
    /**
     * narzut na wykonanie pętli - nieistotne
     */
    public final long overhead;
    /**
     * czas całkowity testu - łącznie z narzutem
     */
    public final long overall;
    /**
     *
     */
    public final long time;
    public final double normalized;
    public final double persec;

    TimeResult(int repeats, long overhead, long overall) {
        this.overhead   = overhead;
        this.overall    = overall;
        this.time       = Math.max(0, overall - overhead);
        this.normalized = 1000 * this.time / (double) repeats;
        this.persec     = 1000 * repeats / (double) this.time;

    }

    @Override
    public String toString() {
        return String.format("overhead:%9d | overall:%9d | time: %9d | normalized:%9.1f | persec:%9.1f", overhead, overall, time, normalized, persec);
    }

}
