Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ public static Map<Integer, List<ITmfStateInterval>> getStatusIntervalsForThreads
if (ss == null) {
return Objects.requireNonNull(Collections.emptyMap());
}
List<Long> currentTimes = times.stream().filter(time -> (time > ss.getCurrentEndTime() || time < ss.getStartTime())).sorted().collect(Collectors.toList());
List<Long> currentTimes = times.stream().filter(time -> (time < ss.getCurrentEndTime() && time > ss.getStartTime())).sorted().collect(Collectors.toList());
if (currentTimes.isEmpty()) {
return Objects.requireNonNull(Collections.emptyMap());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ public void testFetchModel() {
new TimeGraphState(6, 2, null, new OutputElementStyle(LinuxStyle.WAIT_FOR_CPU.getLabel())),
new TimeGraphState(8, 2, null, new OutputElementStyle(LinuxStyle.USERMODE.getLabel())),
new TimeGraphState(10, 2, null, new OutputElementStyle(LinuxStyle.WAIT_FOR_CPU.getLabel())),
new TimeGraphState(12, 8, null, new OutputElementStyle(LinuxStyle.USERMODE.getLabel()))), true);
new TimeGraphState(12, 8, "openat", new OutputElementStyle(LinuxStyle.SYSCALL.getLabel()))), true);

// Get the row model for those entries with low resolution
rowResponse = dataProvider.fetchRowModel(FetchParametersUtils.selectionTimeQueryToMap(new SelectionTimeQueryFilter(3, 15, 2, selectedIds)), new NullProgressMonitor());
Expand Down Expand Up @@ -300,7 +300,7 @@ public void testFetchModel() {
// Verify kernel statuses of tid 6
verifyStates(rows, FlameDataProviderTestUtils.findEntryByDepthAndType(tid6Children, -1, EntryType.KERNEL), ImmutableList.of(
new TimeGraphState(1, 5, null, new OutputElementStyle(LinuxStyle.USERMODE.getLabel())),
new TimeGraphState(12, 8, null, new OutputElementStyle(LinuxStyle.USERMODE.getLabel()))), true);
new TimeGraphState(12, 8, "openat", new OutputElementStyle(LinuxStyle.SYSCALL.getLabel()))), true);

// Check arrows
FlameChartEntryModel tid2 = FlameDataProviderTestUtils.findEntryByNameAndType(modelEntries, "2", EntryType.LEVEL);
Expand Down Expand Up @@ -436,6 +436,7 @@ private static void verifyStates(List<ITimeGraphRowModel> rowModels, FlameChartE
assertNotNull(rowModel);
@SuppressWarnings("null")
List<ITimeGraphState> states = rowModel.getStates();
assertEquals(expectedStates.size(), states.size());
for (int i = 0; i < states.size(); i++) {
String entryName = entry.getName();
if (i > expectedStates.size() - 1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,15 @@ public ITmfStateProvider getNewInstance() {
@Override
protected void eventHandle(ITmfEvent event) {
ITmfStateSystemBuilder ssb = getStateSystemBuilder();
if (ssb == null) {
if (ssb == null || event.getName().equals("instant_event")) {
return;
}
int threadQuark = ssb.getQuarkAbsoluteAndAdd(Attributes.THREADS, event.getContent().getFieldValue(String.class, "tid"));
boolean isEntry = event.getName().equals(ENTRY);
long timestamp = event.getTimestamp().getValue();
if (isEntry) {
if (event.getName().equals("op4")) {
String operationName = event.getContent().getFieldValue(String.class, "op");
if (operationName != null && operationName.equals("op4")) {
int systemCallQuark = ssb.getQuarkRelativeAndAdd(threadQuark, Attributes.SYSTEM_CALL);
ssb.modifyAttribute(timestamp, "openat", systemCallQuark);
/* Put the process in system call mode */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ public TmfModelResponse<Map<String, String>> fetchTooltip(Map<String, Object> fe
return new TmfModelResponse<>(tooltip, Status.COMPLETED, CommonStatusMessage.COMPLETED);
}
}

private @Nullable Map<String, String> getTooltip(Long entryId, FlameChartEntryModel entryModel, Long time) {
switch (entryModel.getEntryType()) {
case FUNCTION: {
Expand Down Expand Up @@ -579,23 +580,27 @@ private Map<Long, List<ITimeGraphState>> getKernelStates(List<TidInformation> ti
Map<Long, List<ITimeGraphState>> kernelStates = new HashMap<>();

IHostModel model = ModelManager.getModelFor(getTrace().getHostId());
Map<Integer, Long> threadIdsToEntryIds = tids.stream().collect(Collectors.toMap(tid -> tid.fTid.getTid(), tid -> tid.fLinked));
Map<Integer, Set<Long>> threadIdsToEntryIds = tids.stream().collect(Collectors.groupingBy(
tid -> tid.fTid.getTid(),
Collectors.mapping(tid -> tid.fLinked, Collectors.toSet())));
Map<Integer, Iterable<ProcessStatusInterval>> kernelStatuses = model.getThreadStatusIntervals(threadIdsToEntryIds.keySet(), times, monitor);
for (Entry<Integer, Iterable<ProcessStatusInterval>> processStatuses : kernelStatuses.entrySet()) {
Long linkedEntryId = threadIdsToEntryIds.get(processStatuses.getKey());
if (linkedEntryId == null) {
Set<Long> linkedEntryIds = threadIdsToEntryIds.get(processStatuses.getKey());
if (linkedEntryIds == null) {
continue;
}
Long entryId = fLinkedEntries.get(linkedEntryId);
if (entryId == null) {
entryId = linkedEntryId;
}
List<ITimeGraphState> states = kernelStates.computeIfAbsent(linkedEntryId, k -> new ArrayList<>());
for (ProcessStatusInterval processStatus : Objects.requireNonNull(processStatuses.getValue())) {
OutputElementStyle style = new OutputElementStyle(
FlameWithKernelPalette.getStyleFor(processStatus.getProcessStatus().getStateValue().unboxInt()));
ITimeGraphState state = new TimeGraphState(processStatus.getStart(), processStatus.getLength(), processStatus.getSyscallName(), style);
applyFilterAndAddState(states, state, entryId, predicates, monitor);
for (Long linkedEntryId : linkedEntryIds) {
Long entryId = fLinkedEntries.get(linkedEntryId);
if (entryId == null) {
entryId = linkedEntryId;
}
List<ITimeGraphState> states = kernelStates.computeIfAbsent(linkedEntryId, k -> new ArrayList<>());
for (ProcessStatusInterval processStatus : Objects.requireNonNull(processStatuses.getValue())) {
OutputElementStyle style = new OutputElementStyle(
FlameWithKernelPalette.getStyleFor(processStatus.getProcessStatus().getStateValue().unboxInt()));
ITimeGraphState state = new TimeGraphState(processStatus.getStart(), processStatus.getLength(), processStatus.getSyscallName(), style);
applyFilterAndAddState(states, state, entryId, predicates, monitor);
}
}
}
return kernelStates;
Expand Down Expand Up @@ -727,7 +732,7 @@ public TmfModelResponse<OutputStyleModel> fetchStyle(Map<String, Object> fetchPa

@Override
public TmfModelResponse<AnnotationCategoriesModel> fetchAnnotationCategories(Map<String, Object> fetchParameters, @Nullable IProgressMonitor monitor) {
return new TmfModelResponse<>(new AnnotationCategoriesModel(Collections.singletonList( InstrumentedCallStackAnalysis.ANNOTATIONS)), ITmfResponse.Status.COMPLETED, CommonStatusMessage.COMPLETED);
return new TmfModelResponse<>(new AnnotationCategoriesModel(Collections.singletonList(InstrumentedCallStackAnalysis.ANNOTATIONS)), ITmfResponse.Status.COMPLETED, CommonStatusMessage.COMPLETED);
}

@Override
Expand Down Expand Up @@ -758,7 +763,7 @@ public TmfModelResponse<AnnotationModel> fetchAnnotations(Map<String, Object> fe
continue;
}
int parentQuark = ss.getParentAttributeQuark(ss.getParentAttributeQuark(cs.getQuark()));
int markersQuark = ss.optQuarkRelative(parentQuark, InstrumentedCallStackAnalysis.ANNOTATIONS);
int markersQuark = ss.optQuarkRelative(parentQuark, InstrumentedCallStackAnalysis.ANNOTATIONS);
if (markersQuark != ITmfStateSystem.INVALID_ATTRIBUTE) {
List<Long> times = DataProviderParameterUtils.extractTimeRequested(fetchParameters);
for (ITmfStateInterval markerInterval : ss.query2D(Collections.singleton(markersQuark), times)) {
Expand All @@ -780,11 +785,11 @@ public TmfModelResponse<AnnotationModel> fetchAnnotations(Map<String, Object> fe
ITmfStateValue a = markerInterval.getStateValue();
String annotValue = a.toString();

OutputElementStyle style = new OutputElementStyle(null, ImmutableMap.of(
StyleProperties.COLOR, "#7D3D31", //$NON-NLS-1$
StyleProperties.HEIGHT, 0.33f,
StyleProperties.SYMBOL_TYPE, SymbolType.DIAMOND));
annotations.add(new Annotation(startTime, 0, rowId, annotValue, style));
OutputElementStyle style = new OutputElementStyle(null, ImmutableMap.of(
StyleProperties.COLOR, "#7D3D31", //$NON-NLS-1$
StyleProperties.HEIGHT, 0.33f,
StyleProperties.SYMBOL_TYPE, SymbolType.DIAMOND));
annotations.add(new Annotation(startTime, 0, rowId, annotValue, style));
}
}
}
Expand All @@ -793,6 +798,6 @@ public TmfModelResponse<AnnotationModel> fetchAnnotations(Map<String, Object> fe
return new TmfModelResponse<>(null, ITmfResponse.Status.FAILED, e.getMessage());
}

return new TmfModelResponse<>(new AnnotationModel(Collections.singletonMap( InstrumentedCallStackAnalysis.ANNOTATIONS, annotations)), ITmfResponse.Status.COMPLETED, CommonStatusMessage.COMPLETED);
return new TmfModelResponse<>(new AnnotationModel(Collections.singletonMap(InstrumentedCallStackAnalysis.ANNOTATIONS, annotations)), ITmfResponse.Status.COMPLETED, CommonStatusMessage.COMPLETED);
}
}
Loading