use of org.eclipse.tracecompass.analysis.profiling.core.callstack.CallStackAnalysis in project tracecompass by tracecompass.
the class CallStackTestBase method tearDown.
/**
* Dispose of the test data
*/
@After
public void tearDown() {
CallStackTestData traceData = fTraceData;
if (traceData != null) {
traceData.dispose();
}
CallStackAnalysis module = fModule;
if (module != null) {
module.dispose();
}
}
use of org.eclipse.tracecompass.analysis.profiling.core.callstack.CallStackAnalysis in project tracecompass by tracecompass.
the class CallGraphAnalysis method executeAnalysis.
@Override
protected boolean executeAnalysis(@Nullable IProgressMonitor monitor) {
ITmfTrace trace = getTrace();
if (monitor == null || trace == null) {
return false;
}
CallStackAnalysis callstackModule = fCallStackAnalysis;
if (callstackModule == null) {
return false;
}
callstackModule.schedule();
callstackModule.waitForCompletion(monitor);
// TODO:Look at updates while the state system's being built
String[] threadsPattern = callstackModule.getThreadsPattern();
String[] processesPattern = callstackModule.getProcessesPattern();
ITmfStateSystem ss = callstackModule.getStateSystem();
if (ss == null || !iterateOverStateSystem(ss, threadsPattern, processesPattern, monitor)) {
return false;
}
monitor.worked(1);
monitor.done();
return true;
}
use of org.eclipse.tracecompass.analysis.profiling.core.callstack.CallStackAnalysis in project tracecompass by tracecompass.
the class CallGraphStatisticsAnalysis method getSegmentProviderAnalysis.
@Override
@Nullable
protected ISegmentStoreProvider getSegmentProviderAnalysis(@NonNull ITmfTrace trace) {
// FIXME: Return the CallStackAnalysis when the segment store comes from there
// and not the CallGraph. Now, we return the CallGraphAnalysis, just so we can
// wait for this analysis to finish to get the full segment store
Iterable<CallStackAnalysis> csModules = TmfTraceUtils.getAnalysisModulesOfClass(trace, CallStackAnalysis.class);
Iterator<CallStackAnalysis> iterator = csModules.iterator();
if (!iterator.hasNext()) {
return null;
}
CallStackAnalysis csModule = iterator.next();
return csModule;
}
use of org.eclipse.tracecompass.analysis.profiling.core.callstack.CallStackAnalysis in project tracecompass by tracecompass.
the class CallStackDataProvider method fetchTooltip.
@Override
@NonNull
public TmfModelResponse<@NonNull Map<@NonNull String, @NonNull String>> fetchTooltip(Map<String, Object> parameters, @Nullable IProgressMonitor monitor) {
CallStackAnalysis analysis = getAnalysisModule();
Map<String, String> tooltips = new HashMap<>();
List<@NonNull Long> selected = DataProviderParameterUtils.extractSelectedItems(parameters);
List<@NonNull Long> times = DataProviderParameterUtils.extractTimeRequested(parameters);
// This data provider doesn't have any annotations or arrows
Object element = parameters.get(DataProviderParameterUtils.REQUESTED_ELEMENT_KEY);
if (element instanceof IAnnotation || element instanceof ITimeGraphArrow) {
return new TmfModelResponse<>(tooltips, ITmfResponse.Status.COMPLETED, CommonStatusMessage.COMPLETED);
}
if (selected != null && times != null) {
Map<@NonNull Long, @NonNull Integer> md = getSelectedEntries(selected);
ITmfTrace trace = getTrace();
for (Long time : times) {
for (Entry<@NonNull Long, @NonNull Integer> entry : md.entrySet()) {
Long result = analysis.resolveDeviceId(entry.getValue(), time);
if (result != null) {
String deviceId = String.valueOf(result);
String deviceType = analysis.resolveDeviceType(entry.getValue(), time);
tooltips.put(deviceType, deviceId);
Iterable<@NonNull CallsiteAnalysis> csas = TmfTraceUtils.getAnalysisModulesOfClass(trace, CallsiteAnalysis.class);
for (CallsiteAnalysis csa : csas) {
List<@NonNull ITmfCallsite> res = csa.getCallsites(String.valueOf(trace.getUUID()), deviceType, deviceId, time);
if (!res.isEmpty()) {
tooltips.put(TmfStrings.source(), String.valueOf(res.get(0)));
}
}
return new TmfModelResponse<>(tooltips, ITmfResponse.Status.COMPLETED, CommonStatusMessage.COMPLETED);
}
ITmfStateSystem stateSystem = analysis.getStateSystem();
if (stateSystem != null) {
try {
Collection<@NonNull ISymbolProvider> symbolProviders = SymbolProviderManager.getInstance().getSymbolProviders(trace);
ITmfStateInterval interval = stateSystem.querySingleState(Objects.requireNonNull(time), Objects.requireNonNull(entry.getValue()));
Object value = interval.getValue();
if (value instanceof Number) {
long longValue = ((Number) value).longValue();
for (ISymbolProvider provider : symbolProviders) {
TmfResolvedSymbol symbol = provider.getSymbol(longValue);
if (symbol != null) {
tooltips.put(Messages.CallStackDataProvider_toolTipState, symbol.getSymbolName());
tooltips.put(Messages.CallStackDataProvider_toolTipAddress, String.format(ADDRESS_FORMAT, symbol.getBaseAddress()));
break;
}
}
tooltips.computeIfAbsent(Messages.CallStackDataProvider_toolTipState, unused -> String.format(ADDRESS_FORMAT, longValue));
} else if (value != null) {
tooltips.put(Messages.CallStackDataProvider_toolTipState, interval.getValueString());
}
} catch (StateSystemDisposedException e) {
// $NON-NLS-1$
Activator.getInstance().logError("State System Disposed", e);
}
}
}
}
}
return new TmfModelResponse<>(tooltips, ITmfResponse.Status.COMPLETED, CommonStatusMessage.COMPLETED);
}
use of org.eclipse.tracecompass.analysis.profiling.core.callstack.CallStackAnalysis in project tracecompass by tracecompass.
the class CallStackDataProviderFactory method createProviderLocal.
@Nullable
private static CallStackDataProvider createProviderLocal(@NonNull ITmfTrace trace) {
Iterator<CallStackAnalysis> modules = TmfTraceUtils.getAnalysisModulesOfClass(trace, CallStackAnalysis.class).iterator();
while (modules.hasNext()) {
CallStackAnalysis first = modules.next();
first.schedule();
return new CallStackDataProvider(trace, first);
}
return null;
}
Aggregations