-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
profiling.ui: make reseting symbols asynchronous #70
Open
MatthewKhouzam
wants to merge
1
commit into
eclipse-tracecompass:master
Choose a base branch
from
MatthewKhouzam:async-symbols
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,9 +28,14 @@ | |
import java.util.Map; | ||
import java.util.Objects; | ||
import java.util.function.Function; | ||
import java.util.logging.Level; | ||
import java.util.logging.Logger; | ||
|
||
import org.eclipse.core.runtime.IProgressMonitor; | ||
import org.eclipse.core.runtime.IStatus; | ||
import org.eclipse.core.runtime.NullProgressMonitor; | ||
import org.eclipse.core.runtime.Status; | ||
import org.eclipse.core.runtime.jobs.Job; | ||
import org.eclipse.jdt.annotation.NonNull; | ||
import org.eclipse.jdt.annotation.Nullable; | ||
import org.eclipse.jface.action.Action; | ||
|
@@ -44,6 +49,8 @@ | |
import org.eclipse.swt.graphics.Image; | ||
import org.eclipse.swt.widgets.Composite; | ||
import org.eclipse.swt.widgets.Display; | ||
import org.eclipse.tracecompass.common.core.log.TraceCompassLogUtils.FlowScopeLog; | ||
import org.eclipse.tracecompass.common.core.log.TraceCompassLogUtils.FlowScopeLogBuilder; | ||
import org.eclipse.tracecompass.internal.analysis.profiling.core.callstack.provider.CallStackDataProvider; | ||
import org.eclipse.tracecompass.internal.analysis.profiling.core.callstack.provider.CallStackEntryModel; | ||
import org.eclipse.tracecompass.internal.analysis.profiling.ui.Activator; | ||
|
@@ -105,6 +112,7 @@ public class FlameChartView extends BaseDataProviderTimeGraphView { | |
|
||
/** View ID. */ | ||
public static final String ID = "org.eclipse.linuxtools.tmf.ui.views.callstack"; //$NON-NLS-1$ | ||
private static final Logger LOGGER = Logger.getLogger(FlameChartView.class.getName()); | ||
|
||
private static final String[] COLUMN_NAMES = new String[] { | ||
Messages.CallStackView_FunctionColumn, | ||
|
@@ -741,28 +749,38 @@ private void updateConfigureSymbolsAction() { | |
} | ||
|
||
private void resetSymbols() { | ||
List<TimeGraphEntry> traceEntries = getEntryList(getTrace()); | ||
if (traceEntries != null) { | ||
for (TraceEntry traceEntry : Iterables.filter(traceEntries, TraceEntry.class)) { | ||
ITimeGraphDataProvider<? extends TimeGraphEntryModel> provider = traceEntry.getProvider(); | ||
if (provider instanceof CallStackDataProvider) { | ||
((CallStackDataProvider) provider).resetFunctionNames(new NullProgressMonitor()); | ||
try (FlowScopeLog fsl = new FlowScopeLogBuilder(LOGGER, Level.FINE, "Reseting Symbols").setCategory("Flame Chart").build();) { //$NON-NLS-1$ //$NON-NLS-2$ | ||
new Job("Reseting Symbols") { //$NON-NLS-1$ | ||
@Override | ||
protected IStatus run(@Nullable IProgressMonitor monitor) { | ||
try (FlowScopeLog fsl2 = new FlowScopeLogBuilder(LOGGER, Level.FINE, "Reseting Symbols - inner").setParentScope(fsl).build()) { //$NON-NLS-1$ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reseting -> Resetting |
||
List<TimeGraphEntry> traceEntries = getEntryList(getTrace()); | ||
if (traceEntries != null) { | ||
for (TraceEntry traceEntry : Iterables.filter(traceEntries, TraceEntry.class)) { | ||
ITimeGraphDataProvider<? extends TimeGraphEntryModel> provider = traceEntry.getProvider(); | ||
if (provider instanceof CallStackDataProvider) { | ||
((CallStackDataProvider) provider).resetFunctionNames(new NullProgressMonitor()); | ||
} | ||
|
||
// reset full and zoomed events here | ||
Iterable<TimeGraphEntry> flatten = Utils.flatten(traceEntry); | ||
flatten.forEach(e -> e.setSampling(null)); | ||
|
||
// recompute full events | ||
long start = traceEntry.getStartTime(); | ||
long end = traceEntry.getEndTime(); | ||
final long resolution = Long.max(1, (end - start) / getDisplayWidth()); | ||
zoomEntries(flatten, start, end, resolution, new NullProgressMonitor()); | ||
} | ||
// zoomed events will be retriggered by refreshing | ||
refresh(); | ||
} | ||
synchingToTime(getTimeGraphViewer().getSelectionBegin()); | ||
return Status.OK_STATUS; | ||
} | ||
} | ||
|
||
// reset full and zoomed events here | ||
Iterable<TimeGraphEntry> flatten = Utils.flatten(traceEntry); | ||
flatten.forEach(e -> e.setSampling(null)); | ||
|
||
// recompute full events | ||
long start = traceEntry.getStartTime(); | ||
long end = traceEntry.getEndTime(); | ||
final long resolution = Long.max(1, (end - start) / getDisplayWidth()); | ||
zoomEntries(flatten, start, end, resolution, new NullProgressMonitor()); | ||
} | ||
// zoomed events will be retriggered by refreshing | ||
refresh(); | ||
}.schedule(); | ||
} | ||
synchingToTime(getTimeGraphViewer().getSelectionBegin()); | ||
} | ||
@TmfSignalHandler | ||
@Override | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally, this part should be refactored into a separate function as we have 7 indentation levels.