1 /*******************************************************************************
2 * Copyright (c) 2016 École Polytechnique de Montréal
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 package org
.eclipse
.tracecompass
.internal
.tmf
.analysis
.xml
.core
.pattern
.stateprovider
;
11 import org
.eclipse
.jdt
.annotation
.NonNull
;
12 import org
.eclipse
.jdt
.annotation
.Nullable
;
13 import org
.eclipse
.tracecompass
.analysis
.timing
.core
.segmentstore
.ISegmentStoreProvider
;
14 import org
.eclipse
.tracecompass
.analysis
.timing
.core
.segmentstore
.statistics
.AbstractSegmentStatisticsAnalysis
;
15 import org
.eclipse
.tracecompass
.segmentstore
.core
.ISegment
;
16 import org
.eclipse
.tracecompass
.tmf
.analysis
.xml
.core
.model
.TmfXmlPatternSegmentBuilder
;
17 import org
.eclipse
.tracecompass
.tmf
.analysis
.xml
.core
.segment
.TmfXmlPatternSegment
;
18 import org
.eclipse
.tracecompass
.tmf
.core
.trace
.ITmfTrace
;
19 import org
.eclipse
.tracecompass
.tmf
.core
.trace
.TmfTraceUtils
;
22 * Statistic analysis for segments generated by a pattern analysis
24 * @author Jean-Christian Kouame
26 public class XmlPatternLatencyStatisticsAnalysis
extends AbstractSegmentStatisticsAnalysis
{
28 private final @Nullable String fPatternAnalysisId
;
33 * @param patternAnalysisId
34 * The pattern analysis ID
36 public XmlPatternLatencyStatisticsAnalysis(@Nullable String patternAnalysisId
) {
37 fPatternAnalysisId
= patternAnalysisId
;
41 protected @Nullable String
getSegmentType(@NonNull ISegment segment
) {
42 if (segment
instanceof TmfXmlPatternSegment
) {
43 TmfXmlPatternSegment patternSegment
= (TmfXmlPatternSegment
) segment
;
44 return patternSegment
.getName().substring(TmfXmlPatternSegmentBuilder
.PATTERN_SEGMENT_NAME_PREFIX
.length());
50 protected @Nullable ISegmentStoreProvider
getSegmentProviderAnalysis(@NonNull ITmfTrace trace
) {
51 return fPatternAnalysisId
!= null ? TmfTraceUtils
.getAnalysisModuleOfClass(trace
, XmlPatternAnalysis
.class, fPatternAnalysisId
) : null;