Skip to content

Commit 3d386f4

Browse files
committed
Thread CPU time sampler improvements
- rewritten to new components - UI unified with CPU sampler - filtering, searching
1 parent 333ecb5 commit 3d386f4

File tree

3 files changed

+425
-465
lines changed

3 files changed

+425
-465
lines changed

visualvm/sampler/src/com/sun/tools/visualvm/sampler/cpu/Bundle.properties

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,13 @@ MSG_unavailable_create_jmx=Not available. Failed to create JMX connection to tar
5252

5353
MSG_unavailable_threads=Not available. Cannot access threads in target application. Check the logfile for details (use Help | About | Logfile).
5454

55-
LBL_ThreadAlloc=Thread CPU Time
55+
LBL_ThreadAlloc=Thread CPU time
5656

5757
COL_Thread_name=Thread Name
5858

59-
COL_ABytes_rel=Thread CPU Time [%]
59+
COL_ABytes=Thread Time (CPU)
6060

61-
COL_ABytes=Thread CPU Time [ms]
62-
63-
COL_ABytes_Sec=Thread CPU Time [ms]/sec
61+
COL_ABytes_Sec=Thread Time (CPU) / sec
6462

6563
LBL_Threads=<b>Threads: </b>{0}
6664

visualvm/sampler/src/com/sun/tools/visualvm/sampler/cpu/CPUSamplerSupport.java

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public DataViewComponent.DetailsView[] getDetailsView() {
141141
detailsViews[0] = new DataViewComponent.DetailsView(NbBundle.getMessage(
142142
CPUSamplerSupport.class, "LBL_Cpu_samples"), null, 10, cpuView, null); // NOI18N
143143
if (threadsCPU != null) {
144-
threadCPUView = new ThreadsCPUView(threadCPURefresher);
144+
threadCPUView = new ThreadsCPUView(threadCPURefresher, threadDumper);
145145
detailsViews[1] = new DataViewComponent.DetailsView(NbBundle.getMessage(
146146
CPUSamplerSupport.class, "LBL_ThreadAlloc"), null, 20, threadCPUView, null); // NOI18N
147147

@@ -162,11 +162,13 @@ public boolean startSampling(ProfilingSettings settings, int samplingRate, int r
162162
refresher.setRefreshRate(refreshRate);
163163

164164
final StackTraceSnapshotBuilder _builder = builder;
165-
if (cpuView != null) SwingUtilities.invokeLater(new Runnable() {
165+
SwingUtilities.invokeLater(new Runnable() {
166166
public void run() {
167-
cpuView.setBuilder(_builder);
168-
cpuView.starting();
169-
// cpuView.setResultsPanel(new SampledLivePanel2(builder));
167+
if (cpuView != null) {
168+
cpuView.setBuilder(_builder);
169+
cpuView.starting();
170+
}
171+
if (threadCPUView != null) threadCPUView.starting();
170172
}
171173
});
172174

@@ -187,9 +189,10 @@ public void actionPerformed(ActionEvent e) {
187189
}
188190

189191
public synchronized void stopSampling() {
190-
if (cpuView != null) SwingUtilities.invokeLater(new Runnable() {
192+
SwingUtilities.invokeLater(new Runnable() {
191193
public void run() {
192-
cpuView.stopping();
194+
if (cpuView != null) cpuView.stopping();
195+
if (threadCPUView != null) threadCPUView.stopping();
193196
}
194197
});
195198

@@ -204,17 +207,18 @@ public void run() {
204207
}
205208

206209
public synchronized void terminate() {
207-
if (cpuView != null) SwingUtilities.invokeLater(new Runnable() {
210+
SwingUtilities.invokeLater(new Runnable() {
208211
public void run() {
209-
cpuView.terminated();
212+
if (cpuView != null) cpuView.terminated();
213+
if (threadCPUView != null) threadCPUView.terminated();
210214
}
211215
});
212216

213217
if (timer != null) {
214218
timer.cancel();
215219
timer = null;
216220
}
217-
if (threadCPUView != null) threadCPUView.terminate();
221+
218222
builder = null; // release data
219223
}
220224

0 commit comments

Comments
 (0)