Commit | Line | Data |
---|---|---|
792d23c2 BH |
1 | /******************************************************************************* |
2 | * Copyright (c) 2016 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 | package org.eclipse.tracecompass.internal.lttng2.ust.ui.analysis.callstack; | |
10 | ||
11 | import static org.eclipse.tracecompass.common.core.NonNullUtils.nullToEmptyString; | |
12 | ||
9aedec8e | 13 | import java.util.Collection; |
792d23c2 BH |
14 | import java.util.Set; |
15 | ||
16 | import org.eclipse.jdt.annotation.NonNull; | |
17 | import org.eclipse.jdt.annotation.NonNullByDefault; | |
18 | import org.eclipse.tracecompass.lttng2.ust.core.trace.layout.ILttngUstEventLayout; | |
19 | import org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAnalysisEventFieldRequirement; | |
20 | import org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAnalysisRequirement; | |
9aedec8e | 21 | import org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfCompositeAnalysisRequirement; |
792d23c2 BH |
22 | |
23 | import com.google.common.collect.ImmutableSet; | |
24 | ||
25 | /** | |
26 | * Analysis requirement implementation for LTTng Call Stack Analysis. | |
27 | * | |
28 | * @author Bernd Hufmann | |
29 | * | |
30 | */ | |
31 | @NonNullByDefault | |
9aedec8e | 32 | public class LttngUstCallStackAnalysisRequirement extends TmfCompositeAnalysisRequirement { |
792d23c2 | 33 | |
792d23c2 BH |
34 | /** |
35 | * Constructor | |
36 | * | |
37 | * @param layout | |
38 | * The event layout (non-null) | |
39 | */ | |
40 | public LttngUstCallStackAnalysisRequirement(ILttngUstEventLayout layout) { | |
9aedec8e | 41 | super(getSubRequirements(layout), PriorityLevel.AT_LEAST_ONE); |
792d23c2 | 42 | |
9aedec8e GB |
43 | addInformation(nullToEmptyString(Messages.LttnUstCallStackAnalysisModule_EventsLoadingInformation)); |
44 | } | |
45 | ||
46 | private static Collection<TmfAnalysisRequirement> getSubRequirements(ILttngUstEventLayout layout) { | |
792d23c2 BH |
47 | Set<@NonNull String> requiredEventsFields = ImmutableSet.of( |
48 | layout.contextProcname(), | |
49 | layout.contextVtid()); | |
9aedec8e GB |
50 | |
51 | // Requirement for the cyg_profile events | |
52 | TmfAnalysisEventFieldRequirement entryReq = new TmfAnalysisEventFieldRequirement( | |
792d23c2 BH |
53 | layout.eventCygProfileFuncEntry(), |
54 | requiredEventsFields, | |
66ee355d | 55 | PriorityLevel.MANDATORY); |
792d23c2 | 56 | |
9aedec8e GB |
57 | TmfAnalysisRequirement exitReq = new TmfAnalysisEventFieldRequirement( |
58 | layout.eventCygProfileFuncExit(), | |
792d23c2 | 59 | requiredEventsFields, |
66ee355d | 60 | PriorityLevel.MANDATORY); |
792d23c2 | 61 | |
9aedec8e GB |
62 | TmfAnalysisRequirement cygProfile = new TmfCompositeAnalysisRequirement(ImmutableSet.of(entryReq, exitReq), PriorityLevel.MANDATORY); |
63 | ||
64 | // Requirement for the cyg_profile_fast events | |
65 | entryReq = new TmfAnalysisEventFieldRequirement( | |
66 | layout.eventCygProfileFastFuncEntry(), | |
792d23c2 | 67 | requiredEventsFields, |
66ee355d | 68 | PriorityLevel.MANDATORY); |
792d23c2 | 69 | |
9aedec8e | 70 | exitReq = new TmfAnalysisEventFieldRequirement( |
792d23c2 BH |
71 | layout.eventCygProfileFastFuncExit(), |
72 | requiredEventsFields, | |
66ee355d | 73 | PriorityLevel.MANDATORY); |
9aedec8e | 74 | TmfAnalysisRequirement cygProfileFast = new TmfCompositeAnalysisRequirement(ImmutableSet.of(entryReq, exitReq), PriorityLevel.MANDATORY); |
792d23c2 | 75 | |
9aedec8e | 76 | return ImmutableSet.of(cygProfile, cygProfileFast); |
792d23c2 BH |
77 | } |
78 | ||
792d23c2 | 79 | } |