Search in sources :

Example 1 with CallStackAnalysis

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();
    }
}
Also used : CallStackTestData(org.eclipse.tracecompass.analysis.profiling.core.tests.data.CallStackTestData) CallStackAnalysis(org.eclipse.tracecompass.analysis.profiling.core.callstack.CallStackAnalysis) After(org.junit.After)

Example 2 with CallStackAnalysis

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;
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) CallStackAnalysis(org.eclipse.tracecompass.analysis.profiling.core.callstack.CallStackAnalysis) ITmfStateSystem(org.eclipse.tracecompass.statesystem.core.ITmfStateSystem)

Example 3 with CallStackAnalysis

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;
}
Also used : CallStackAnalysis(org.eclipse.tracecompass.analysis.profiling.core.callstack.CallStackAnalysis) Nullable(org.eclipse.jdt.annotation.Nullable)

Example 4 with CallStackAnalysis

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);
}
Also used : IAnnotation(org.eclipse.tracecompass.internal.provisional.tmf.core.model.annotations.IAnnotation) HashMap(java.util.HashMap) ITmfStateInterval(org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval) TmfModelResponse(org.eclipse.tracecompass.tmf.core.response.TmfModelResponse) StateSystemDisposedException(org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException) ITmfCallsite(org.eclipse.tracecompass.tmf.core.event.lookup.ITmfCallsite) CallsiteAnalysis(org.eclipse.tracecompass.internal.tmf.core.analysis.callsite.CallsiteAnalysis) ISymbolProvider(org.eclipse.tracecompass.tmf.core.symbols.ISymbolProvider) ITmfStateSystem(org.eclipse.tracecompass.statesystem.core.ITmfStateSystem) ITimeGraphArrow(org.eclipse.tracecompass.tmf.core.model.timegraph.ITimeGraphArrow) CallStackAnalysis(org.eclipse.tracecompass.analysis.profiling.core.callstack.CallStackAnalysis) ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) TmfResolvedSymbol(org.eclipse.tracecompass.tmf.core.symbols.TmfResolvedSymbol) NonNull(org.eclipse.jdt.annotation.NonNull)

Example 5 with CallStackAnalysis

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;
}
Also used : CallStackAnalysis(org.eclipse.tracecompass.analysis.profiling.core.callstack.CallStackAnalysis) Nullable(org.eclipse.jdt.annotation.Nullable)

Aggregations

CallStackAnalysis (org.eclipse.tracecompass.analysis.profiling.core.callstack.CallStackAnalysis)11 ICallGraphProvider (org.eclipse.tracecompass.analysis.profiling.core.callgraph.ICallGraphProvider)5 Nullable (org.eclipse.jdt.annotation.Nullable)4 CallGraphAnalysis (org.eclipse.tracecompass.internal.analysis.profiling.core.callgraph.CallGraphAnalysis)3 ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)3 ITmfStateSystem (org.eclipse.tracecompass.statesystem.core.ITmfStateSystem)2 File (java.io.File)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 Job (org.eclipse.core.runtime.jobs.Job)1 NonNull (org.eclipse.jdt.annotation.NonNull)1 Performance (org.eclipse.test.performance.Performance)1 PerformanceMeter (org.eclipse.test.performance.PerformanceMeter)1 CallStackTestData (org.eclipse.tracecompass.analysis.profiling.core.tests.data.CallStackTestData)1 SegmentStoreStatisticsDataProvider (org.eclipse.tracecompass.internal.analysis.timing.core.segmentstore.SegmentStoreStatisticsDataProvider)1 LttngUstCallStackAnalysis (org.eclipse.tracecompass.internal.lttng2.ust.core.callstack.LttngUstCallStackAnalysis)1 IAnnotation (org.eclipse.tracecompass.internal.provisional.tmf.core.model.annotations.IAnnotation)1 CallsiteAnalysis (org.eclipse.tracecompass.internal.tmf.core.analysis.callsite.CallsiteAnalysis)1 ISegment (org.eclipse.tracecompass.segmentstore.core.ISegment)1