package cz.moneta.test.harness.performance;

public class PerformanceReportEntry {
    private final String key;
    private final long start;
    private final long end;
    private final boolean successful;
    private final String threadName;

    public PerformanceReportEntry(String key, long start, long end, boolean successful) {
        this.key = key;
        this.start = start;
        this.end = end;
        this.successful = successful;
        this.threadName = Thread.currentThread().getName();
    }

    public String getKey() {
        return key;
    }

    public long getStart() {
        return start;
    }

    public long getEnd() {
        return end;
    }

    public boolean isSuccessful() {
        return successful;
    }

    public String asReportLine() {
        return String.format("<sample t=\"%d\" ts=\"%d\" s=\"%s\" lb=\"%s\" tn=\"%s\" />",
                (end - start),
                start,
                successful,
                key,
                threadName);
    }
}
