All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.custardsource.parfait.timing.ThreadMetricSuite Maven / Gradle / Ivy

The newest version!
package com.custardsource.parfait.timing;

import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;

public class ThreadMetricSuite {
    private final List metrics;
    
    private ThreadMetricSuite(Collection metrics) {
        this.metrics = new CopyOnWriteArrayList(metrics);
    }
    
    public final void addMetric(ThreadMetric metric) {
        metrics.add(metric);
    }

    public final void addAllMetrics(Collection metrics) {
        this.metrics.addAll(metrics);
    }
    
    public final List metrics() {
        return Collections.unmodifiableList(metrics);
    }

    public static ThreadMetricSuite blank() {
        return new ThreadMetricSuite(Collections.emptyList());
    }

    public static ThreadMetricSuite withDefaultMetrics() {
        return new ThreadMetricSuite(StandardThreadMetrics.defaults());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy