01: /*
02: * Copyright (C) 2006 Joe Walnes.
03: * Copyright (C) 2006, 2007, 2008 XStream Committers.
04: * All rights reserved.
05: *
06: * The software in this package is published under the terms of the BSD
07: * style license a copy of which has been included with this distribution in
08: * the LICENSE.txt file.
09: *
10: * Created on 15. July 2006 by Joe Walnes
11: */
12: package com.thoughtworks.xstream.tools.benchmark;
13:
14: /**
15: * A metric is what's actually recorded. This provides a strategy
16: * for what to do with an object for a given product and should
17: * return a measurable result. For example it could serialize an
18: * object against a product and return how long it took to complete
19: * the operation.
20: *
21: * @author Joe Walnes
22: * @author Jörg Schaible
23: * @see Harness
24: */
25: public interface Metric {
26:
27: /**
28: * Run the test and produce a metric.
29: *
30: * @param product Product to use in test.
31: * @param object A object to use against the product.
32: * @return The resulting metric (e.g. 12.22).
33: * @throws Exception If this metric could not be obtained. This will
34: * be reported back to the {@link Reporter}.
35: * @deprecated since 1.3
36: */
37: double run(Product product, Object object) throws Exception;
38:
39: /**
40: * Run the test and produce a metric.
41: *
42: * @param product Product to use in test.
43: * @param target A target to use against the product.
44: * @return The resulting metric (e.g. 12.22).
45: * @throws Exception If this metric could not be obtained. This will
46: * be reported back to the {@link Reporter}.
47: * @since 1.3
48: */
49: double run(Product product, Target target) throws Exception;
50:
51: /**
52: * The unit the metric is recorded in (for reporting purposes).
53: * e.g. "ms" or "bytes".
54: */
55: String unit();
56:
57: /**
58: * Whether a big result is better for this metric.
59: */
60: boolean biggerIsBetter();
61:
62: }
|