1 /*******************************************************************************
2 * Copyright (c) 2012 Ericsson
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Alexandre Montplaisir - Initial API
11 ******************************************************************************/
13 package org
.eclipse
.linuxtools
.tmf
.core
.statistics
;
15 import java
.util
.List
;
18 import org
.eclipse
.linuxtools
.tmf
.core
.event
.ITmfTimestamp
;
19 import org
.eclipse
.linuxtools
.tmf
.core
.signal
.TmfStatsUpdatedSignal
;
22 * Provider for statistics, which is assigned to a trace. This can be used to
23 * populate views like the Statistics View or the Histogram.
25 * As a guideline, since any trace type can use this interface, all timestamps
26 * should be normalized to nanoseconds when using these methods
27 * ({@link ITmfTimestamp#NANOSECOND_SCALE}).
29 * @author Alexandre Montplaisir
32 public interface ITmfStatistics
{
35 * This method provides a centralized and asynchronous way of querying
36 * statistics information. It is an alternative to the other get* methods,
37 * and should not block the caller for too long.
39 * Implementors can usually call their own getEventTotal(),
40 * getEventsInRange(), etc. but should do so in a separate thread, and
41 * should send a {@link TmfStatsUpdatedSignal} whenever they are done (that
42 * signal will carry the results).
45 * Is this for a global query (whole time range of a trace), or
46 * just for a specific time range.
48 * The start time of the query range. Has no effect if isGlobal
51 * The end time of the query range. Has no effect if isGlobal is
54 public void updateStats(boolean isGlobal
, long start
, long end
);
57 * Run a histogram query on the statistics back-end. This means, return the
58 * total number of events in a series of 'nb' equal-sized ranges between
59 * 'start' and 'end'. As its name implies, this is typically used to fill
60 * the histogram data (where each range represents one pixel on the
63 * Unlike {@link #updateStats}, this method will block the caller until the
64 * results are returned, so it should not be called from a signal handler or
68 * Start time of the query
70 * End time of the query
72 * The number of ranges to separate the complete time range into.
73 * It will be the size() of the returned array.
74 * @return The array representing the number of events found in each
77 public List
<Long
> histogramQuery(long start
, long end
, int nb
);
80 * Return the total number of events in the trace.
82 * @return The total number of events
84 public long getEventsTotal();
87 * Return a Map of the total events in the trace, per event type. The event
88 * type should come from ITmfEvent.getType().getName().
90 * @return The map of <event_type, count>, for the whole trace
92 public Map
<String
, Long
> getEventTypesTotal();
95 * Retrieve the number of events in the trace in a given time interval.
98 * Start time of the time range
100 * End time of the time range
101 * @return The number of events found
103 public long getEventsInRange(long start
, long end
);
106 * Retrieve the number of events in the trace, per event type, in a given
110 * Start time of the time range
112 * End time of the time range
113 * @return The map of <event_type, count>, for the given time range
115 public Map
<String
, Long
> getEventTypesInRange(long start
, long end
);
118 * Notify the statistics back-end that the trace is being closed, so it
119 * should dispose itself as appropriate (release file descriptors, etc.)
121 public void dispose();
This page took 0.036218 seconds and 6 git commands to generate.