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);
}
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;
}
Aggregations