Commit | Line | Data |
---|---|---|
1c0de632 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 and implementation | |
11 | *******************************************************************************/ | |
12 | ||
13 | package org.eclipse.linuxtools.tmf.core.signal; | |
14 | ||
15 | import java.util.Map; | |
16 | ||
17 | import org.eclipse.linuxtools.tmf.core.statistics.ITmfStatistics; | |
18 | import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace; | |
19 | ||
20 | /** | |
21 | * Signal sent when a call to {@link ITmfStatistics#updateStats} has completed. | |
22 | * | |
23 | * @author Alexandre Montplaisir | |
24 | * @version 1.0 | |
25 | * @since 2.0 | |
26 | */ | |
27 | public class TmfStatsUpdatedSignal extends TmfSignal { | |
28 | ||
29 | private final ITmfTrace trace; | |
30 | private final boolean isGlobal; | |
31 | private final long eventTotal; | |
32 | private final Map<String, Long> eventsPerType; | |
33 | ||
34 | /** | |
35 | * Constructor | |
36 | * | |
37 | * @param source | |
38 | * Object sending this signal | |
39 | * @param trace | |
40 | * The trace for which we track the statistics | |
41 | * @param isGlobal | |
42 | * Is this a global query (whole range of the trace), or not | |
43 | * @param eventTotal | |
44 | * The total number of events. This should be equal to the sum of | |
45 | * the values in eventsPerType. | |
46 | * @param eventsPerType | |
47 | * The map representing the number of events of each type | |
48 | * | |
49 | * @since 2.0 | |
50 | */ | |
51 | public TmfStatsUpdatedSignal(Object source, ITmfTrace trace, boolean isGlobal, | |
52 | long eventTotal, Map<String, Long> eventsPerType) { | |
53 | super(source); | |
54 | this.trace = trace; | |
55 | this.isGlobal = isGlobal; | |
56 | this.eventTotal = eventTotal; | |
57 | this.eventsPerType = eventsPerType; | |
58 | } | |
59 | ||
60 | /** | |
61 | * @return The trace referred to by this signal | |
62 | */ | |
63 | public ITmfTrace getTrace() { | |
64 | return trace; | |
65 | } | |
66 | ||
67 | /** | |
68 | * @return True if it's a global query, false if it's for the current time | |
69 | * range | |
70 | */ | |
71 | public boolean isGlobal() { | |
72 | return isGlobal; | |
73 | } | |
74 | ||
75 | /** | |
76 | * @return The total number of events for this query | |
77 | */ | |
78 | public long getEventTotal() { | |
79 | return eventTotal; | |
80 | } | |
81 | ||
82 | /** | |
83 | * @return The map representing the number of events per type for this query | |
84 | */ | |
85 | public Map<String, Long> getEventsPerType() { | |
86 | return eventsPerType; | |
87 | } | |
88 | ||
89 | @Override | |
90 | public String toString() { | |
91 | return "[TmfStatsUpdatedSignal (trace = " + trace.toString() + //$NON-NLS-1$ | |
92 | ", total = " + eventTotal + ")]"; //$NON-NLS-1$ //$NON-NLS-2$ | |
93 | } | |
94 | ||
95 | } |