Skip to content

Commit

Permalink
callstack: Bring FlameChartView UI from Incubator
Browse files Browse the repository at this point in the history
Along with its minimally related dependencies and likely users. This is
based on the current understanding of the latter, which may change next.

FlameChartView requires FlameChartDataProvider, which in turn requires
FlameChartArrowProvider. Both require FlameChartEntryModel. Include all
of these, brought from Incubator, consistently. Also include the few
currently necessary message and icon resources.

Strictly make callstack.ui an x-friend of callstack.core.instrumented,
so the former bundle's new classes may use the latter's, herein. For
now, keep such new API exposure as restricted as possible. This access
may open up as eventually required.

CallStackAnalysisListener is a plugin.xml element, along with
FlameChartView which gets used by the former. Access to this new view
from the UI is to be proven next, fixing that access as necessary then.

Keep this early Java packaging as minimal as possible. Refactoring some
current package decisions remains likely through follow-up changes as
they become relevant.

[Added] o.e.t.i.a.callstack.ui.FlameChartView

Change-Id: I4d70d12dc9b83bdcfde948a963b6397a1ea4297d
Signed-off-by: Marco Miller <marco.miller@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/c/tracecompass/org.eclipse.tracecompass/+/199583
Tested-by: Trace Compass Bot <tracecompass-bot@eclipse.org>
Tested-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
  • Loading branch information
marco-miller committed Mar 31, 2023
1 parent 7a05abe commit 6814994
Show file tree
Hide file tree
Showing 21 changed files with 2,123 additions and 9 deletions.
Expand Up @@ -18,7 +18,8 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.tracecompass.datastore.core,
org.eclipse.tracecompass.segmentstore.core,
org.eclipse.tracecompass.tmf.core
Export-Package: org.eclipse.tracecompass.internal.analysis.callstack.core;x-friends:="org.eclipse.tracecompass.analysis.callstack.core.tests"
Export-Package: org.eclipse.tracecompass.internal.analysis.callstack.core;x-friends:="org.eclipse.tracecompass.analysis.callstack.core.tests",
org.eclipse.tracecompass.internal.analysis.callstack.core.instrumented;x-friends:="org.eclipse.tracecompass.analysis.callstack.ui"
Import-Package: com.google.common.annotations,
com.google.common.base,
com.google.common.cache,
Expand Down
@@ -0,0 +1,78 @@
/*******************************************************************************
* Copyright (c) 2018 École Polytechnique de Montréal
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License 2.0 which
* accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/

package org.eclipse.tracecompass.internal.analysis.callstack.core.instrumented;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.internal.tmf.core.model.filters.FetchParametersUtils;
import org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval;
import org.eclipse.tracecompass.tmf.core.model.filters.TimeQueryFilter;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
import org.eclipse.tracecompass.tmf.core.trace.TmfTraceUtils;

/**
* Provide arrows for a flame chart. These arrows may come from any other flame
* chart analysis.
*
* @author Geneviève Bastien
*/
public class FlameChartArrowProvider {
private final ITmfTrace fTrace;

/**
* Constructor
*
* @param trace
* The trace for which this data provider applies
*/
public FlameChartArrowProvider(ITmfTrace trace) {
fTrace = trace;
}

/**
* Fetch arrows with query
*
* @param fetchParameters
* the parameters
* @param monitor
* the monitor
* @return the corresponding state intervals
*/
public List<ITmfStateInterval> fetchArrows(Map<String, Object> fetchParameters, @Nullable IProgressMonitor monitor) {
TimeQueryFilter filter = FetchParametersUtils.createTimeQuery(fetchParameters);
if (filter == null) {
return Collections.emptyList();
}
long start = filter.getStart();
long end = filter.getEnd();

InstrumentedCallStackAnalysis csModule = null;
Iterable<InstrumentedCallStackAnalysis> modules = TmfTraceUtils.getAnalysisModulesOfClass(fTrace, InstrumentedCallStackAnalysis.class);
Iterator<InstrumentedCallStackAnalysis> iterator = modules.iterator();

List<@NonNull ITmfStateInterval> allEdges = new ArrayList<>();
while (iterator.hasNext()) {
csModule = iterator.next();
List<@NonNull ITmfStateInterval> moduleEdges = csModule.getLinks(start, end, monitor == null ? new NullProgressMonitor() : monitor);
allEdges.addAll(moduleEdges);
}
return allEdges;
}
}

0 comments on commit 6814994

Please sign in to comment.