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

openllet.profiler.statistical.ReleaseStatistics Maven / Gradle / Ivy

There is a newer version: 2.6.5
Show newest version
package openllet.profiler.statistical;

import java.util.LinkedHashMap;
import java.util.Map;
import openllet.profiler.Result;
import openllet.profiler.ProfileKB.Task;
import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;

/**
 * Provides some statistics about the performance of a certain task
 * 
 * @author Pedro Oliveira 
 */
public class ReleaseStatistics
{

	private final Task _task;
	private final Map _memStats;
	private final Map _timeStats;

	public ReleaseStatistics(final Task task)
	{
		this._task = task;
		_memStats = new LinkedHashMap<>();
		_timeStats = new LinkedHashMap<>();
	}

	public ReleaseStatistics(final Result task)
	{
		this(task.getTask());

		final DescriptiveStatistics mem = task.getMemory();
		addMemStat("avg", mem.getMean());
		addMemStat("var", mem.getVariance());
		addMemStat("n", mem.getN());

		final DescriptiveStatistics time = task.getTime();
		addTimeStat("avg", time.getMean());
		addTimeStat("var", mem.getVariance());
		addTimeStat("n", mem.getN());
	}

	public Task getTask()
	{
		return _task;
	}

	public double getMemStat(final String name)
	{
		return _memStats.get(name);
	}

	public double getTimeStat(final String name)
	{
		return _timeStats.get(name);
	}

	public Map getMemStats()
	{
		return _memStats;
	}

	public Map getTimeStats()
	{
		return _timeStats;
	}

	public void addMemStat(final String name, final double value)
	{
		_memStats.put(name, value);
	}

	public void addTimeStat(final String name, final double value)
	{
		_timeStats.put(name, value);
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy