Search in sources :

Example 1 with MemoryAllocation

use of org.eclipse.tracecompass.internal.lttng2.ust.core.analysis.memory.UstMemoryStateProvider.MemoryAllocation in project tracecompass by tracecompass.

the class UstMemoryAnalysisModule method fillStore.

private static void fillStore(ISegmentStore<@NonNull ISegment> segmentStore, Map<Long, MemoryAllocation> unfreedMemory) {
    for (Entry<Long, MemoryAllocation> unfreedMem : unfreedMemory.entrySet()) {
        MemoryAllocation memAlloc = unfreedMem.getValue();
        segmentStore.add(new PotentialLeakSegment(memAlloc.getTs(), memAlloc.getTs(), memAlloc.getTid()));
    }
    segmentStore.close(false);
}
Also used : MemoryAllocation(org.eclipse.tracecompass.internal.lttng2.ust.core.analysis.memory.UstMemoryStateProvider.MemoryAllocation)

Example 2 with MemoryAllocation

use of org.eclipse.tracecompass.internal.lttng2.ust.core.analysis.memory.UstMemoryStateProvider.MemoryAllocation in project tracecompass by tracecompass.

the class UstMemoryAnalysisModule method executeAnalysis.

@Override
protected boolean executeAnalysis(IProgressMonitor monitor) {
    if (!super.executeAnalysis(monitor)) {
        return false;
    }
    ITmfTrace trace = checkNotNull(getTrace());
    // $NON-NLS-1$
    String segmentFileName = getSsFileName() + ".seg";
    /* See if the data file already exists on disk */
    String dir = TmfTraceManager.getSupplementaryFileDir(trace);
    final Path file = Paths.get(dir, segmentFileName);
    boolean needsBuilding = true;
    Map<Long, MemoryAllocation> unfreedMemory = fPotentialLeaks;
    if (unfreedMemory == null || unfreedMemory.isEmpty()) {
        needsBuilding = false;
    }
    ISegmentStore<@NonNull ISegment> segmentStore = null;
    try {
        if (needsBuilding) {
            Files.deleteIfExists(file);
        }
        segmentStore = SegmentStoreFactory.createOnDiskSegmentStore(file, PotentialLeakSegment.MEMORY_SEGMENT_READ_FACTORY, 1);
    } catch (IOException e) {
        return false;
    }
    if (needsBuilding) {
        fillStore(segmentStore, unfreedMemory);
    }
    fSegmentStore = segmentStore;
    sendUpdate(segmentStore);
    return true;
}
Also used : Path(java.nio.file.Path) ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) MemoryAllocation(org.eclipse.tracecompass.internal.lttng2.ust.core.analysis.memory.UstMemoryStateProvider.MemoryAllocation) ISegment(org.eclipse.tracecompass.segmentstore.core.ISegment) NonNullUtils.nullToEmptyString(org.eclipse.tracecompass.common.core.NonNullUtils.nullToEmptyString) IOException(java.io.IOException)

Aggregations

MemoryAllocation (org.eclipse.tracecompass.internal.lttng2.ust.core.analysis.memory.UstMemoryStateProvider.MemoryAllocation)2 IOException (java.io.IOException)1 Path (java.nio.file.Path)1 NonNullUtils.nullToEmptyString (org.eclipse.tracecompass.common.core.NonNullUtils.nullToEmptyString)1 ISegment (org.eclipse.tracecompass.segmentstore.core.ISegment)1 ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)1