Commit | Line | Data |
---|---|---|
50659279 AM |
1 | /******************************************************************************* |
2 | * Copyright (c) 2014 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 | |
da27e43a | 11 | * Patrick Tasse - Add methods to get attribute paths |
50659279 AM |
12 | *******************************************************************************/ |
13 | ||
2bdf0193 | 14 | package org.eclipse.tracecompass.tmf.ui.views.callstack; |
50659279 | 15 | |
7f86b721 | 16 | import org.eclipse.jdt.annotation.NonNullByDefault; |
2bdf0193 AM |
17 | import org.eclipse.tracecompass.tmf.core.callstack.CallStackStateProvider; |
18 | import org.eclipse.tracecompass.tmf.core.statesystem.TmfStateSystemAnalysisModule; | |
19 | import org.eclipse.tracecompass.tmf.ui.analysis.TmfAnalysisViewOutput; | |
50659279 AM |
20 | |
21 | /** | |
22 | * The base classes for analyses who want to populate the CallStack View. | |
23 | * | |
24 | * @author Alexandre Montplaisir | |
50659279 | 25 | */ |
7f86b721 | 26 | @NonNullByDefault |
50659279 AM |
27 | public abstract class AbstractCallStackAnalysis extends TmfStateSystemAnalysisModule { |
28 | ||
7f86b721 AM |
29 | private static final String[] DEFAULT_PROCESSES_PATTERN = |
30 | new String[] { CallStackStateProvider.PROCESSES, "*" }; //$NON-NLS-1$ | |
31 | ||
32 | private static final String DEFAULT_THREADS_PATTERN = ".*"; //$NON-NLS-1$ | |
da27e43a PT |
33 | |
34 | private static final String[] DEFAULT_CALL_STACK_PATH = | |
35 | new String[] { CallStackStateProvider.CALL_STACK }; | |
36 | ||
50659279 AM |
37 | /** |
38 | * Abstract constructor (should only be called via the sub-classes' | |
39 | * constructors. | |
40 | */ | |
7f86b721 | 41 | protected AbstractCallStackAnalysis() { |
50659279 AM |
42 | super(); |
43 | registerOutput(new TmfAnalysisViewOutput(CallStackView.ID)); | |
44 | } | |
da27e43a PT |
45 | |
46 | /** | |
7f86b721 AM |
47 | * The quark pattern to get the list of attributes representing the |
48 | * different processes. | |
49 | * | |
50 | * It is passed as-is to | |
51 | * {@link org.eclipse.tracecompass.statesystem.core.ITmfStateSystem#getQuarks} | |
52 | * . | |
53 | * @return The quark pattern to find the processes attribute | |
54 | * @since 2.0 | |
55 | */ | |
56 | public String[] getProcessesPattern() { | |
57 | return DEFAULT_PROCESSES_PATTERN; | |
58 | } | |
59 | ||
60 | /** | |
61 | * The regex to match sub-attributes of each Process attributes representing | |
62 | * the threads of this process. | |
da27e43a | 63 | * |
7f86b721 AM |
64 | * This will be passed as-is to |
65 | * {@link org.eclipse.tracecompass.statesystem.core.ITmfStateSystem#getSubAttributes(int, boolean, String)} | |
66 | * | |
67 | * @return The regex to pass | |
68 | * @since 2.0 | |
da27e43a | 69 | */ |
7f86b721 | 70 | public String getThreadsForProcessPattern() { |
da27e43a PT |
71 | return DEFAULT_THREADS_PATTERN; |
72 | } | |
73 | ||
74 | /** | |
75 | * Get the call stack attribute path relative to a thread attribute found by | |
7f86b721 AM |
76 | * {@link #getThreadsForProcessPattern()}. Override this method if the state |
77 | * system attributes do not match the default pattern defined by | |
da27e43a PT |
78 | * {@link CallStackStateProvider}. |
79 | * | |
80 | * @return the relative path of the call stack attribute | |
7f86b721 | 81 | * @since 2.0 |
da27e43a | 82 | */ |
7f86b721 | 83 | public String[] getCallStackPathForThread() { |
da27e43a PT |
84 | return DEFAULT_CALL_STACK_PATH; |
85 | } | |
50659279 | 86 | } |