Source:
private @Nullable Map<Long, List<ITimeGraphState>> getCallStackRows(SelectionTimeQueryFilter filter, Map<Long, FlameChartEntryModel> entries, SubMonitor subMonitor) throws IndexOutOfBoundsException, TimeRangeException, StateSystemDisposedException { Map<Long, List<ITimeGraphState>> rows = new HashMap<>(); Map<Long, CallStackDepth> csEntries = new HashMap<>(); for (Entry<Long, @NonNull FlameChartEntryModel> entry : entries.entrySet()) { CallStackDepth selectedDepth = fIdToCallstack.get(entry.getKey()); if (selectedDepth != null && entry.getValue().getEntryType().equals(EntryType.FUNCTION)) { csEntries.put(entry.getKey(), selectedDepth); } } long[] timesRequested = filter.getTimesRequested(); Collection<Long> times = Arrays.stream(timesRequested).boxed().collect(Collectors.toList()); Multimap<CallStackDepth, ISegment> csFunctions = fFcProvider.queryCallStacks(csEntries.values(), times); for (Map.Entry<Long, CallStackDepth> entry : csEntries.entrySet()) { if (subMonitor.isCanceled()) { return null; } Collection<ISegment> states = csFunctions.get(entry.getValue()); List<ITimeGraphState> eventList = new ArrayList<>(states.size()); states.forEach(state -> eventList.add(createTimeGraphState(state))); eventList.sort(Comparator.comparingLong(ITimeGraphState::getStartTime)); rows.put(entry.getKey(), eventList); Long linked = fLinkedEntries.inverse().get(entry.getKey()); if (linked == null || !entries.containsKey(linked)) { continue; } List<ITimeGraphState> kernelEventList = getKernelStates(entry.getValue(), states, times); rows.put(linked, kernelEventList); } subMonitor.worked(1); return rows; }

Target:
private @Nullable Map<Long, List<ITimeGraphState>> getCallStackRows(SelectionTimeQueryFilter filter, Map<Long, FlameChartEntryModel> entries, SubMonitor subMonitor) throws IndexOutOfBoundsException, TimeRangeException, StateSystemDisposedException { Map<Long, List<ITimeGraphState>> rows = new HashMap<>(); Map<Long, CallStackDepth> csEntries = new HashMap<>(); for (Entry<Long, @NonNull FlameChartEntryModel> entry : entries.entrySet()) { CallStackDepth selectedDepth = fIdToCallstack.get(entry.getKey()); if (selectedDepth != null && entry.getValue().getEntryType().equals(EntryType.FUNCTION)) { csEntries.put(entry.getKey(), selectedDepth); } } long[] timesRequested = filter.getTimesRequested(); List<Long> times = new ArrayList<>(); for (long time : timesRequested) { times.add(time); } Multimap<CallStackDepth, ISegment> csFunctions = fFcProvider.queryCallStacks(csEntries.values(), times); for (Map.Entry<Long, CallStackDepth> entry : csEntries.entrySet()) { if (subMonitor.isCanceled()) { return null; } Collection<ISegment> states = csFunctions.get(entry.getValue()); List<ITimeGraphState> eventList = new ArrayList<>(states.size()); states.forEach(state -> eventList.add(createTimeGraphState(state))); eventList.sort(Comparator.comparingLong(ITimeGraphState::getStartTime)); rows.put(entry.getKey(), eventList); Long linked = fLinkedEntries.inverse().get(entry.getKey()); if (linked == null || !entries.containsKey(linked)) { continue; } List<ITimeGraphState> kernelEventList = getKernelStates(entry.getValue(), states, times); rows.put(linked, kernelEventList); } subMonitor.worked(1); return rows; }