-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
callstack: Add incubated FunctionDensityView &co.
[Added] o.e.t.i.a.callstack.ui.functiondensity.FunctionDensityView Change-Id: I8b79d2c5313f0796a621fae441366c2b53989d6b Signed-off-by: Marco Miller <marco.miller@ericsson.com> Reviewed-on: https://git.eclipse.org/r/c/tracecompass/org.eclipse.tracecompass/+/199894 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
1 parent
6281c6f
commit bcb4b5e
Showing
9 changed files
with
225 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+176 Bytes
...sis/org.eclipse.tracecompass.analysis.callstack.ui/icons/elcl16/funcdensity.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
...ipse/tracecompass/internal/analysis/callstack/ui/functiondensity/FunctionDensityView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/****************************************************************************** | ||
* Copyright (c) 2016 Ericsson | ||
* | ||
* 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.ui.functiondensity; | ||
|
||
import java.util.Objects; | ||
|
||
import org.eclipse.jface.viewers.TableViewer; | ||
import org.eclipse.swt.SWT; | ||
import org.eclipse.swt.widgets.Composite; | ||
import org.eclipse.swt.widgets.Table; | ||
import org.eclipse.swt.widgets.TableColumn; | ||
import org.eclipse.tracecompass.analysis.timing.ui.views.segmentstore.density2.AbstractSegmentStoreDensityView; | ||
import org.eclipse.tracecompass.analysis.timing.ui.views.segmentstore.density2.AbstractSegmentStoreDensityViewer; | ||
import org.eclipse.tracecompass.analysis.timing.ui.views.segmentstore.table.AbstractSegmentStoreTableViewer; | ||
import org.eclipse.tracecompass.tmf.core.segment.SegmentDurationAspect; | ||
import org.eclipse.tracecompass.tmf.core.segment.SegmentEndTimeAspect; | ||
import org.eclipse.tracecompass.tmf.core.segment.SegmentStartTimeAspect; | ||
|
||
/** | ||
* Call stack Density view displaying the call stack segments tree. | ||
* | ||
* @author Sonia Farrah | ||
*/ | ||
public class FunctionDensityView extends AbstractSegmentStoreDensityView { | ||
|
||
/** The view's ID */ | ||
public static final String ID = "org.eclipse.tracecompass.analysis.callstack.ui.functiondensity"; //$NON-NLS-1$ | ||
|
||
/** | ||
* Constructs a new density view. | ||
*/ | ||
public FunctionDensityView() { | ||
super(ID); | ||
} | ||
|
||
@SuppressWarnings("null") | ||
@Override | ||
protected AbstractSegmentStoreTableViewer createSegmentStoreTableViewer(Composite parent) { | ||
return new FunctionTableViewer(new TableViewer(parent, SWT.FULL_SELECTION | SWT.VIRTUAL), getViewSite().getSecondaryId()) { | ||
@Override | ||
protected void createProviderColumns() { | ||
super.createProviderColumns(); | ||
Table t = (Table) getControl(); | ||
|
||
moveColumnTo(t, SegmentDurationAspect.SEGMENT_DURATION_ASPECT.getName(), 0); | ||
moveColumnTo(t, SegmentStartTimeAspect.SEGMENT_START_TIME_ASPECT.getName(), 1); | ||
moveColumnTo(t, SegmentEndTimeAspect.SEGMENT_END_TIME_ASPECT.getName(), 2); | ||
} | ||
|
||
private void moveColumnTo(Table t, String aspectName, int desiredIndex) { | ||
int[] order = t.getColumnOrder(); | ||
int foundIndex = -1; | ||
for (int i = 0; i < t.getColumnCount(); i++) { | ||
TableColumn col = t.getColumn(i); | ||
if (col.getText().equals(aspectName)) { | ||
foundIndex = i; | ||
} | ||
} | ||
if (foundIndex == -1) { | ||
// At least we tried | ||
return; | ||
} | ||
int tmp = order[desiredIndex]; | ||
order[desiredIndex] = order[foundIndex]; | ||
order[foundIndex] = tmp; | ||
t.setColumnOrder(order); | ||
} | ||
}; | ||
} | ||
|
||
@SuppressWarnings("null") | ||
@Override | ||
protected AbstractSegmentStoreDensityViewer createSegmentStoreDensityViewer(Composite parent) { | ||
return new FunctionDensityViewer(Objects.requireNonNull(parent), getViewSite().getSecondaryId()); | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
...se/tracecompass/internal/analysis/callstack/ui/functiondensity/FunctionDensityViewer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/****************************************************************************** | ||
* Copyright (c) 2016 Ericsson | ||
* | ||
* 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.ui.functiondensity; | ||
|
||
import org.eclipse.jdt.annotation.NonNull; | ||
import org.eclipse.jdt.annotation.Nullable; | ||
import org.eclipse.swt.widgets.Composite; | ||
import org.eclipse.tracecompass.analysis.timing.core.segmentstore.ISegmentStoreProvider; | ||
import org.eclipse.tracecompass.analysis.timing.ui.views.segmentstore.density2.AbstractSegmentStoreDensityViewer; | ||
import org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule; | ||
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace; | ||
|
||
/** | ||
* Call stack segments density viewer | ||
* | ||
* @author Sonia Farrah | ||
*/ | ||
public class FunctionDensityViewer extends AbstractSegmentStoreDensityViewer { | ||
private final String fAnalysisId; | ||
|
||
/** | ||
* Constructs a new density viewer. | ||
* | ||
* @param parent | ||
* the parent of the viewer | ||
* @param analysisId | ||
* The ID of the analysis for this view | ||
*/ | ||
public FunctionDensityViewer(Composite parent, String analysisId) { | ||
super(parent); | ||
fAnalysisId = analysisId; | ||
} | ||
|
||
@Override | ||
protected @Nullable ISegmentStoreProvider getSegmentStoreProvider(@NonNull ITmfTrace trace) { | ||
IAnalysisModule modules = trace.getAnalysisModule(fAnalysisId); | ||
if (!(modules instanceof ISegmentStoreProvider)) { | ||
return null; | ||
} | ||
return (ISegmentStoreProvider) modules; | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
...ipse/tracecompass/internal/analysis/callstack/ui/functiondensity/FunctionTableViewer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2016 Ericsson | ||
* | ||
* 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.ui.functiondensity; | ||
|
||
import java.util.Objects; | ||
import java.util.Optional; | ||
import java.util.stream.StreamSupport; | ||
|
||
import org.eclipse.jdt.annotation.NonNull; | ||
import org.eclipse.jdt.annotation.Nullable; | ||
import org.eclipse.jface.viewers.TableViewer; | ||
import org.eclipse.tracecompass.analysis.timing.core.segmentstore.ISegmentStoreProvider; | ||
import org.eclipse.tracecompass.analysis.timing.ui.views.segmentstore.table.AbstractSegmentStoreTableViewer; | ||
import org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule; | ||
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace; | ||
import org.eclipse.tracecompass.tmf.core.trace.TmfTraceUtils; | ||
|
||
/** | ||
* Displays the Call Stack data in a column table | ||
* | ||
* @author Sonia Farrah | ||
*/ | ||
public class FunctionTableViewer extends AbstractSegmentStoreTableViewer { | ||
private final String fAnalysisId; | ||
|
||
/** | ||
* Constructor | ||
* | ||
* @param tableViewer | ||
* The table viewer | ||
* @param analysisId | ||
* The ID of the analysis for this view | ||
*/ | ||
public FunctionTableViewer(TableViewer tableViewer, String analysisId) { | ||
super(tableViewer); | ||
fAnalysisId = analysisId; | ||
} | ||
|
||
@Override | ||
protected @Nullable ISegmentStoreProvider getSegmentStoreProvider(@NonNull ITmfTrace trace) { | ||
IAnalysisModule module = trace.getAnalysisModule(fAnalysisId); | ||
if (!(module instanceof ISegmentStoreProvider)) { | ||
Iterable<@NonNull ISegmentStoreProvider> modules = TmfTraceUtils.getAnalysisModulesOfClass(trace, ISegmentStoreProvider.class); | ||
Optional<@NonNull ISegmentStoreProvider> providers = StreamSupport.stream(modules.spliterator(), false) | ||
.filter(mod -> (mod instanceof IAnalysisModule && Objects.equals(fAnalysisId, ((IAnalysisModule) mod).getId()))) | ||
.findFirst(); | ||
if (providers.isPresent()) { | ||
return providers.get(); | ||
} | ||
return null; | ||
} | ||
return (ISegmentStoreProvider) module; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...org/eclipse/tracecompass/internal/analysis/callstack/ui/functiondensity/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 Ericsson | ||
* | ||
* 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 | ||
*******************************************************************************/ | ||
|
||
@org.eclipse.jdt.annotation.NonNullByDefault | ||
package org.eclipse.tracecompass.internal.analysis.callstack.ui.functiondensity; |