Skip to content

Commit 57ade6a

Browse files
committed
bugfix #575, use SampledMemoryResultsSnapshot
1 parent 5d8d4e9 commit 57ade6a

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

visualvm/profiling/src/com/sun/tools/visualvm/profiling/snapshot/ProfilerSnapshotNPS.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ protected Image resolveIcon() {
8686
if (snapshotType == LoadedSnapshot.SNAPSHOT_TYPE_CPU) {
8787
return ImageUtilities.mergeImages(CPU_ICON, NODE_BADGE, 0, 0);
8888
} else if (snapshotType == LoadedSnapshot.SNAPSHOT_TYPE_MEMORY_LIVENESS
89-
|| snapshotType == LoadedSnapshot.SNAPSHOT_TYPE_MEMORY_ALLOCATIONS) {
89+
|| snapshotType == LoadedSnapshot.SNAPSHOT_TYPE_MEMORY_ALLOCATIONS
90+
|| snapshotType == LoadedSnapshot.SNAPSHOT_TYPE_MEMORY_SAMPLED) {
9091
return ImageUtilities.mergeImages(MEMORY_ICON, NODE_BADGE, 0, 0);
9192
} else {
9293
return null;

visualvm/profiling/src/com/sun/tools/visualvm/profiling/snapshot/diff/SnapshotDiffContainer.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
import org.netbeans.lib.profiler.results.memory.AllocMemoryResultsSnapshot;
3333
import org.netbeans.lib.profiler.results.memory.LivenessMemoryResultsDiff;
3434
import org.netbeans.lib.profiler.results.memory.LivenessMemoryResultsSnapshot;
35+
import org.netbeans.lib.profiler.results.memory.SampledMemoryResultsDiff;
36+
import org.netbeans.lib.profiler.results.memory.SampledMemoryResultsSnapshot;
3537
import org.netbeans.modules.profiler.LoadedSnapshot;
3638

3739
/**
@@ -79,6 +81,10 @@ else if (s1.getSnapshot() instanceof LivenessMemoryResultsSnapshot &&
7981
s2.getSnapshot() instanceof LivenessMemoryResultsSnapshot)
8082
return new LivenessMemoryResultsDiff((LivenessMemoryResultsSnapshot) s1.getSnapshot(),
8183
(LivenessMemoryResultsSnapshot) s2.getSnapshot());
84+
else if (s1.getSnapshot() instanceof SampledMemoryResultsSnapshot &&
85+
s2.getSnapshot() instanceof SampledMemoryResultsSnapshot)
86+
return new SampledMemoryResultsDiff((SampledMemoryResultsSnapshot) s1.getSnapshot(),
87+
(SampledMemoryResultsSnapshot) s2.getSnapshot());
8288
return null;
8389
}
8490

visualvm/sampler/src/com/sun/tools/visualvm/sampler/SamplerImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
import javax.swing.SwingUtilities;
8787
import org.netbeans.lib.profiler.common.ProfilingSettingsPresets;
8888
import org.netbeans.lib.profiler.results.cpu.CPUResultsSnapshot;
89-
import org.netbeans.lib.profiler.results.memory.AllocMemoryResultsSnapshot;
89+
import org.netbeans.lib.profiler.results.memory.SampledMemoryResultsSnapshot;
9090
import org.netbeans.modules.profiler.LoadedSnapshot;
9191
import org.netbeans.modules.profiler.ResultsManager;
9292
import org.openide.DialogDisplayer;
@@ -686,7 +686,7 @@ public void run() {
686686
DataOutputStream dos = null;
687687
try {
688688
long time = System.currentTimeMillis();
689-
AllocMemoryResultsSnapshot snapshot = dumper.createSnapshot(time);
689+
SampledMemoryResultsSnapshot snapshot = dumper.createSnapshot(time);
690690
if (snapshot == null) {
691691
DialogDisplayer.getDefault().notifyLater(new NotifyDescriptor.Message(
692692
NbBundle.getMessage(SamplerImpl.class, "MSG_No_save_data_memory"), // NOI18N

visualvm/sampler/src/com/sun/tools/visualvm/sampler/memory/MemorySamplerSupport.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
import javax.swing.SwingUtilities;
4545
import javax.swing.Timer;
4646
import org.netbeans.lib.profiler.common.ProfilingSettings;
47-
import org.netbeans.lib.profiler.results.memory.AllocMemoryResultsSnapshot;
47+
import org.netbeans.lib.profiler.results.memory.SampledMemoryResultsSnapshot;
4848
import org.openide.util.NbBundle;
4949

5050
/**
@@ -308,14 +308,14 @@ public static abstract class SnapshotDumper {
308308

309309
public abstract void takeSnapshot(boolean openView);
310310

311-
public AllocMemoryResultsSnapshot createSnapshot(long time) {
311+
public SampledMemoryResultsSnapshot createSnapshot(long time) {
312312
HeapHistogram histogram = lastHistogram;
313313

314314
if (histogram != null) {
315315
ByteArrayOutputStream output = new ByteArrayOutputStream(1024);
316316
DataOutputStream dos = new DataOutputStream(output);
317317
try {
318-
AllocMemoryResultsSnapshot result = new AllocMemoryResultsSnapshot();
318+
SampledMemoryResultsSnapshot result = new SampledMemoryResultsSnapshot();
319319
Set<HeapHistogram.ClassInfo> classes = histogram.getHeapHistogram();
320320

321321
dos.writeInt(1); // version

0 commit comments

Comments
 (0)