Commit | Line | Data |
---|---|---|
200789b3 AM |
1 | /******************************************************************************* |
2 | * Copyright (c) 2012 Ericsson | |
3 | * | |
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 | |
8 | * | |
9 | * Contributors: | |
10 | * Alexandre Montplaisir - Initial API | |
11 | ******************************************************************************/ | |
12 | ||
13 | package org.eclipse.linuxtools.tmf.core.statistics; | |
14 | ||
15 | import java.util.Map; | |
16 | ||
17 | import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp; | |
1c0de632 | 18 | import org.eclipse.linuxtools.tmf.core.signal.TmfStatsUpdatedSignal; |
200789b3 AM |
19 | |
20 | /** | |
21 | * Provider for statistics, which is assigned to a trace. This can be used to | |
22 | * populate views like the Statistics View or the Histogram. | |
23 | * | |
24 | * @author Alexandre Montplaisir | |
25 | * @since 2.0 | |
26 | */ | |
27 | public interface ITmfStatistics { | |
28 | ||
1c0de632 AM |
29 | /** |
30 | * This method provides a centralized and asynchronous way of querying | |
31 | * statistics information. It is an alternative to the other get* methods, | |
32 | * and should not block the caller for too long. | |
33 | * | |
34 | * Implementors can usually call their own getEventTotal(), | |
35 | * getEventsInRange(), etc. but should do so in a separate thread, and | |
36 | * should send a {@link TmfStatsUpdatedSignal} whenever they are done (that | |
37 | * signal will carry the results). | |
38 | * | |
39 | * @param isGlobal | |
40 | * Is this for a global query (whole time range of a trace), or | |
41 | * just for a specific time range. | |
42 | * @param start | |
43 | * The start time of the query range. Has no effect if isGlobal | |
44 | * is true. | |
45 | * @param end | |
46 | * The end time of the query range. Has no effect if isGlobal is | |
47 | * true. | |
48 | */ | |
49 | public void updateStats(final boolean isGlobal, ITmfTimestamp start, | |
50 | ITmfTimestamp end); | |
51 | ||
200789b3 AM |
52 | /** |
53 | * Return the total number of events in the trace. | |
54 | * | |
55 | * @return The total number of events | |
56 | */ | |
57 | public long getEventsTotal(); | |
58 | ||
59 | /** | |
60 | * Return a Map of the total events in the trace, per event type. The event | |
61 | * type should come from ITmfEvent.getType().getName(). | |
62 | * | |
63 | * @return The map of <event_type, count>, for the whole trace | |
64 | */ | |
65 | public Map<String, Long> getEventTypesTotal(); | |
66 | ||
67 | /** | |
68 | * Retrieve the number of events in the trace in a given time interval. | |
69 | * | |
70 | * @param start | |
71 | * Start time of the time range | |
72 | * @param end | |
73 | * End time of the time range | |
74 | * @return The number of events found | |
75 | */ | |
76 | public long getEventsInRange(ITmfTimestamp start, ITmfTimestamp end); | |
77 | ||
78 | /** | |
79 | * Retrieve the number of events in the trace, per event type, in a given | |
80 | * time interval. | |
81 | * | |
82 | * @param start | |
83 | * Start time of the time range | |
84 | * @param end | |
85 | * End time of the time range | |
86 | * @return The map of <event_type, count>, for the given time range | |
87 | */ | |
88 | public Map<String, Long> getEventTypesInRange(ITmfTimestamp start, | |
89 | ITmfTimestamp end); | |
90 | } |