Skip to content

Commit

Permalink
callstack: Fix non-externalized in FlameGraphView
Browse files Browse the repository at this point in the history
Fix the few Eclipse warnings [1] below in FlameGraphView.

Fix the default Eclipse formatting while editing this file. For some of
the shorter comments, slightly amend them to keep their oneline-ness.

[1] "Non-externalized string literal; it should be followed by
//$NON-NLS-<n>$".

Change-Id: I257a647e4e1b7ddae4e89b1e874034e41827f211
Signed-off-by: Marco Miller <marco.miller@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/c/tracecompass.incubator/org.eclipse.tracecompass.incubator/+/201571
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 Apr 27, 2023
1 parent 5dd970b commit 15eebd2
Showing 1 changed file with 31 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public class FlameGraphView extends TmfView {
*/
private final Semaphore fLock = new Semaphore(1);

// Variable used to specify when the graph is dirty, ie waiting for data refresh
// Variable to specify when the graph is dirty, ie waiting for data refresh
private final AtomicInteger fDirty = new AtomicInteger();

/** The trace to build thread hash map */
Expand All @@ -210,7 +210,6 @@ public class FlameGraphView extends TmfView {
private @Nullable ZoomThread fZoomThread;
private final Object fZoomThreadResultLock = new Object();


/**
* Constructor
*/
Expand Down Expand Up @@ -277,11 +276,12 @@ public void mouseDoubleClick(MouseEvent e) {
timeGraphControl.addPaintListener(new PaintListener() {

/**
* This paint control allows the virtual time graph refresh to occur on paint
* events instead of just scrolling the time axis or zooming. To avoid
* refreshing the model on every paint event, we use a TmfUiRefreshHandler to
* coalesce requests and only execute the last one, we also check if the entries
* have changed to avoid useless model refresh.
* This paint control allows the virtual time graph refresh to occur
* on paint events instead of just scrolling the time axis or
* zooming. To avoid refreshing the model on every paint event, we
* use a TmfUiRefreshHandler to coalesce requests and only execute
* the last one, we also check if the entries have changed to avoid
* useless model refresh.
*
* @param e
* paint event on the visible area
Expand All @@ -295,9 +295,11 @@ public void paintControl(PaintEvent e) {
Set<@NonNull TimeGraphEntry> newSet = getVisibleItems(DEFAULT_BUFFER_SIZE);
if (!fVisibleEntries.equals(newSet)) {
/*
* Start a zoom thread if the set of visible entries has changed. We do not use
* lists as the order is not important. We cannot use the start index / size of
* the visible entries as we can collapse / reorder events.
* Start a zoom thread if the set of visible entries has
* changed. We do not use lists as the order is not
* important. We cannot use the start index / size of
* the visible entries as we can collapse / reorder
* events.
*/
fVisibleEntries = newSet;
startZoomThread(getTimeGraphViewer().getTime0(), getTimeGraphViewer().getTime1(), false);
Expand Down Expand Up @@ -379,7 +381,7 @@ private String getProviderId() {
// should be replace with a real ':' and this is the complete
// providerId. This kind of secondary ID may come from external sources
// of data provider, such as scripting
return (secondaryId == null) ? FlameGraphDataProvider.ID : (secondaryId.contains("[COLON]")) ? secondaryId.replace("[COLON]", ":") : FlameGraphDataProvider.ID + ':' + secondaryId;
return (secondaryId == null) ? FlameGraphDataProvider.ID : (secondaryId.contains("[COLON]")) ? secondaryId.replace("[COLON]", ":") : FlameGraphDataProvider.ID + ':' + secondaryId; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}

private class BuildRunnable {
Expand Down Expand Up @@ -436,7 +438,6 @@ private void buildEntryList(@NonNull ITmfTrace trace, @NonNull ITmfTrace parentT
}
complete = response.getStatus() == ITmfResponse.Status.COMPLETED;


TmfTreeModel<@NonNull TimeGraphEntryModel> model = response.getModel();
long endTime = Long.MIN_VALUE;
if (model != null) {
Expand Down Expand Up @@ -574,7 +575,6 @@ protected class ZoomThread extends Thread {
private @NonNull Collection<@NonNull TimeGraphEntry> fCurrentEntries;
private boolean fForce;


/**
* Constructor
*
Expand Down Expand Up @@ -654,8 +654,9 @@ public final void run() {
}

/**
* Set the ID of the calling flow scope. This data will allow to determine the
* causality between the zoom thread and its caller if tracing is enabled.
* Set the ID of the calling flow scope. This data will allow to
* determine the causality between the zoom thread and its caller if
* tracing is enabled.
*
* @param scopeId
* The ID of the calling flow scope
Expand Down Expand Up @@ -687,7 +688,7 @@ protected final void startZoomThread(long startTime, long endTime, boolean force
try (FlowScopeLog log = new FlowScopeLogBuilder(LOGGER, Level.FINE, "FlameGraphView:ZoomThreadCreated").setCategory(getViewId()).build()) { //$NON-NLS-1$
long clampedStartTime = Math.max(0, Math.min(startTime, getEndTime()));
long clampedEndTime = Math.min(getEndTime(), Math.max(endTime, 0));
// Ignore if end time < start time, data has not been set correctly [yet]
// Ignore if end time < start time, data is not set correctly [yet]
if (clampedEndTime < clampedStartTime) {
return;
}
Expand All @@ -706,9 +707,9 @@ protected final void startZoomThread(long startTime, long endTime, boolean force
if (zoomThread != null) {
zoomThread.setScopeId(log.getId());
/*
* Don't start a new thread right away if results are being applied from an old
* ZoomThread. Otherwise, the old results might overwrite the new results if it
* finishes after.
* Don't start a new thread right away if results are being
* applied from an old ZoomThread. Otherwise, the old results
* might overwrite the new results if it finishes after.
*/
synchronized (fZoomThreadResultLock) {
zoomThread.start();
Expand Down Expand Up @@ -750,7 +751,7 @@ protected final void startZoomThread(long startTime, long endTime, boolean force

private void zoomEntries(@NonNull Iterable<@NonNull TimeGraphEntry> entries, long zoomStartTime, long zoomEndTime, long resolution, @NonNull IProgressMonitor monitor) {
if (resolution < 0) {
// StateSystemUtils.getTimes would throw an illegal argument exception.
// StateSystemUtils.getTimes would throw an IllegalArgumentException
return;
}

Expand Down Expand Up @@ -781,8 +782,8 @@ private void zoomEntries(@NonNull Iterable<@NonNull TimeGraphEntry> entries, lon
}

/**
* This method build the multimap of regexes by property that will be used to
* filter the timegraph states
* This method build the multimap of regexes by property that will be used
* to filter the timegraph states
*
* Override this method to add other regexes with their properties. The data
* provider should handle everything after.
Expand All @@ -806,7 +807,8 @@ private void zoomEntries(@NonNull Iterable<@NonNull TimeGraphEntry> entries, lon
}

private void zoomEntries(Map<Long, TimeGraphEntry> map, List<ITimeGraphRowModel> model, boolean completed, Sampling sampling) {
boolean isZoomThread = false; // Thread.currentThread() instanceof ZoomThread;
boolean isZoomThread = false; // Thread.currentThread() instanceof
// ZoomThread;
for (ITimeGraphRowModel rowModel : model) {
TimeGraphEntry entry = map.get(rowModel.getEntryID());

Expand Down Expand Up @@ -880,8 +882,8 @@ protected TimeEvent createTimeEvent(TimeGraphEntry entry, ITimeGraphState state)
}

/**
* Filter the entries to return only the Non Null {@link TimeGraphEntry} which
* intersect the time range.
* Filter the entries to return only the Non Null {@link TimeGraphEntry}
* which intersect the time range.
*
* @param visible
* the input list of visible entries
Expand Down Expand Up @@ -1485,9 +1487,9 @@ private void loadSortOption() {
setSortOption(SortOption.fromName(sortOption));
}

//--------------------------------
// --------------------------------
// Symbol related methods
//--------------------------------
// --------------------------------

private Action getConfigureSymbolsAction() {
if (fConfigureSymbolsAction != null) {
Expand Down Expand Up @@ -1564,7 +1566,7 @@ public void symbolMapUpdated(TmfSymbolProviderUpdatedSignal signal) {
public void restartZoomThread() {
ZoomThread zoomThread = fZoomThread;
if (zoomThread != null) {
// Make sure that the zoom thread is not a restart (resume of the previous)
// Make sure zoom thread is not a restart (resume of the previous)
zoomThread.cancel();
fZoomThread = null;
}
Expand All @@ -1575,7 +1577,7 @@ public void restartZoomThread() {
* Set or remove the global regex filter value
*
* @param signal
* the signal carrying the regex value
* the signal carrying the regex value
*/
@TmfSignalHandler
public void regexFilterApplied(TmfFilterAppliedSignal signal) {
Expand Down

0 comments on commit 15eebd2

Please sign in to comment.