This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 189621
Collapse All | Expand All

(-)a/lib.profiler.common/src/org/netbeans/lib/profiler/common/integration/IntegrationUtils.java (-10 / +27 lines)
Lines 131-142 Link Here
131
    }
131
    }
132
132
133
    // Returns batch file extension bat / sh according to current / selected OS
133
    // Returns batch file extension bat / sh according to current / selected OS
134
    public static String getBatchExtensionString(String targetPlatform, String customExt) {
135
        if (isWindowsPlatform(targetPlatform)) {
136
            return customExt + ".bat"; //NOI18N
137
        }
138
        return customExt + ".sh"; //NOI18N
139
    }
140
134
    public static String getBatchExtensionString(String targetPlatform) {
141
    public static String getBatchExtensionString(String targetPlatform) {
135
        if (isWindowsPlatform(targetPlatform)) {
142
        if (isWindowsPlatform(targetPlatform)) {
136
            return ".bat"; //NOI18N
143
            return ".bat"; //NOI18N
137
        }
144
        }
138
145
        return ".sh";
139
        return ".sh"; //NOI18N
140
    }
146
    }
141
147
142
    // Returns HTML-formatted hint about how to reduce CPU profiling overhead
148
    // Returns HTML-formatted hint about how to reduce CPU profiling overhead
Lines 355-361 Link Here
355
    }
361
    }
356
362
357
    public static String getManualRemoteStep2(String targetOS, String targetJVM) {
363
    public static String getManualRemoteStep2(String targetOS, String targetJVM) {
358
        return MessageFormat.format(MANUAL_REMOTE_STEP2_MESSAGE, new Object[] { getRemoteCalibrateCommandString(targetOS) }); //NOI18N
364
        return MessageFormat.format(MANUAL_REMOTE_STEP2_MESSAGE, new Object[] { getRemoteCalibrateCommandString(targetOS, targetJVM) }); //NOI18N
359
    }
365
    }
360
366
361
    // Returns getLibsDir()/deployed/jdk<15>/<OS> appropriate for current / selected OS
367
    // Returns getLibsDir()/deployed/jdk<15>/<OS> appropriate for current / selected OS
Lines 442-450 Link Here
442
    // Returns extra command line arguments without additional quotes required when attaching on startup
448
    // Returns extra command line arguments without additional quotes required when attaching on startup
443
    public static String getProfilerAgentCommandLineArgsWithoutQuotes(String targetPlatform, String targetJVM, boolean isRemote,
449
    public static String getProfilerAgentCommandLineArgsWithoutQuotes(String targetPlatform, String targetJVM, boolean isRemote,
444
                                                                      int portNumber) {
450
                                                                      int portNumber) {
445
        return "-agentpath:" + getNativeLibrariesPath(targetPlatform, targetJVM, isRemote)
451
        StringBuilder args = new StringBuilder();
446
               + getDirectorySeparator(targetPlatform) + getProfilerAgentLibraryFile(targetPlatform) + "=" //NOI18N
452
        if (targetJVM.equals(PLATFORM_JAVA_60) && (targetPlatform.equals(PLATFORM_LINUX_OS) || targetPlatform.equals(PLATFORM_LINUX_AMD64_OS))) {
447
               + getLibsDir(targetPlatform, isRemote) + "," + portNumber; //NOI18N
453
            args.append(" -XX:+UseLinuxPosixThreadCPUClocks ");
454
        }
455
        args.append("-agentpath:").append(getNativeLibrariesPath(targetPlatform, targetJVM, isRemote)).
456
               append(getDirectorySeparator(targetPlatform)).append(getProfilerAgentLibraryFile(targetPlatform)).append("="). //NOI18N
457
               append(getLibsDir(targetPlatform, isRemote)).append(",").append(portNumber); //NOI18N
458
        return args.toString();
448
    }
459
    }
449
460
450
    // Returns filename of profiler agent library
461
    // Returns filename of profiler agent library
Lines 472-486 Link Here
472
    }
483
    }
473
484
474
    // Returns calibration batch filename
485
    // Returns calibration batch filename
475
    public static String getRemoteCalibrateCommandString(String targetPlatform) {
486
    public static String getRemoteCalibrateCommandString(String targetPlatform, String targetJava) {
487
        String customExt = isLinuxPlatform(targetPlatform) ? (PLATFORM_JAVA_60.equals(targetJava) ? "-16" : "-15") : "";
476
        return HTML_REMOTE_STRING + getDirectorySeparator(targetPlatform) + "bin" + getDirectorySeparator(targetPlatform)
488
        return HTML_REMOTE_STRING + getDirectorySeparator(targetPlatform) + "bin" + getDirectorySeparator(targetPlatform)
477
               + "calibrate" + getBatchExtensionString(targetPlatform); //NOI18N
489
               + "calibrate" + getBatchExtensionString(targetPlatform,  customExt); //NOI18N
478
    }
490
    }
479
491
480
    // Returns profile batch filename
492
    // Returns profile batch filename
481
    public static String getRemoteProfileCommandString(String targetPlatform) {
493
    public static String getRemoteProfileCommandString(String targetPlatform, String targetJava) {
494
        String customExt = PLATFORM_JAVA_50.equals(targetJava) ? "-15" : "-16";
482
        return HTML_REMOTE_STRING + getDirectorySeparator(targetPlatform) + "bin" + getDirectorySeparator(targetPlatform)
495
        return HTML_REMOTE_STRING + getDirectorySeparator(targetPlatform) + "bin" + getDirectorySeparator(targetPlatform)
483
               + "profile" + getBatchExtensionString(targetPlatform); //NOI18N
496
               + "profile" + getBatchExtensionString(targetPlatform, customExt); //NOI18N
484
    }
497
    }
485
498
486
    // returns "rem" or "#" according to provided platform
499
    // returns "rem" or "#" according to provided platform
Lines 509-514 Link Here
509
        return targetPlatform.equals(PLATFORM_WINDOWS_OS) || targetPlatform.equals(PLATFORM_WINDOWS_AMD64_OS);
522
        return targetPlatform.equals(PLATFORM_WINDOWS_OS) || targetPlatform.equals(PLATFORM_WINDOWS_AMD64_OS);
510
    }
523
    }
511
524
525
    public static boolean isLinuxPlatform(String targetPlatform) {
526
        return targetPlatform.equals(PLATFORM_LINUX_OS) || targetPlatform.equals(PLATFORM_LINUX_AMD64_OS);
527
    }
528
512
    public static String getXMLCommendEndSign() {
529
    public static String getXMLCommendEndSign() {
513
        return "-->"; //NOI18N
530
        return "-->"; //NOI18N
514
    }
531
    }
(-)a/lib.profiler/release/remote-pack-defs/README.txt (-1 / +1 lines)
Lines 1-7 Link Here
1
NetBeans Profiler Server Pack 6.5 README
1
NetBeans Profiler Server Pack 6.5 README
2
2
3
This server pack allows you to do remote profiling. First you need to
3
This server pack allows you to do remote profiling. First you need to
4
run the calibrate.bat/calibrate.sh script located in the bin directory.
4
run the calibrate.bat/calibrate.sh/calibrate-(5|6).sh script located in the bin directory.
5
You can use profile.sh or profile.bat script located in the bin directory
5
You can use profile.sh or profile.bat script located in the bin directory
6
instead of java command to run your application in profiling mode. 
6
instead of java command to run your application in profiling mode. 
7
Check the script for any additional modifications according to your 
7
Check the script for any additional modifications according to your 
(-)a/lib.profiler/release/remote-pack-defs/build.xml (-1 / +11 lines)
Lines 215-221 Link Here
215
    </antcall>
215
    </antcall>
216
 </target>
216
 </target>
217
217
218
  <target name="profiler-server-common-unix" depends="profiler-server-common">
218
  <target name="profiler-server-calibration-linux" if="isLinux">
219
      <copy tofile="${build.dir}/bin/calibrate-${jdk-version}.sh" file="calibrate-${jdk-version}.sh" />
220
  </target>
221
  <target name="profiler-server-common-unix" depends="profiler-server-common" unless="isLinux">
219
     <copy tofile="${build.dir}/bin/calibrate.sh" file="calibrate${calibrate-suffix}.sh" />
222
     <copy tofile="${build.dir}/bin/calibrate.sh" file="calibrate${calibrate-suffix}.sh" />
220
  </target>
223
  </target>
221
224
Lines 231-236 Link Here
231
  </target>
234
  </target>
232
235
233
  <target name="profiler-server-jdkspecific-unix" depends="profiler-server-jdkspecific">
236
  <target name="profiler-server-jdkspecific-unix" depends="profiler-server-jdkspecific">
237
    <condition property="isLinux">
238
        <or>
239
            <equals arg1="${os-version}" arg2="linux"/>
240
            <equals arg1="${os-version}" arg2="linuxamd64"/>
241
        </or>
242
    </condition>
243
    <antcall target="profiler-server-calibration-linux"/>
234
    <copy tofile="${build.dir}/bin/profile-${jdk-version}.sh" file="profile-${os-version}-${jdk-version}.sh" />
244
    <copy tofile="${build.dir}/bin/profile-${jdk-version}.sh" file="profile-${os-version}-${jdk-version}.sh" />
235
  </target>
245
  </target>
236
246
(-)a/lib.profiler/release/remote-pack-defs/calibrate-16.sh (+15 lines)
Line 0 Link Here
1
#!/bin/sh
2
3
# This script expects JAVA_HOME to point to the correct JDK 6.0 installation
4
# In case you need to customize it, please uncomment and modify the following lines
5
6
# JAVA_HOME=/opt/java/jdk1.6.0_21
7
# export JAVA_HOME
8
9
OLD_PWD=`pwd`
10
cd `dirname $0`
11
INSTALL_DIR=`pwd`
12
cd $OLD_PWD
13
unset OLD_PWD
14
15
$JAVA_HOME/bin/java -XX:+UseLinuxPosixThreadCPUClocks -javaagent:$INSTALL_DIR/../lib/jfluid-server-15.jar org.netbeans.lib.profiler.server.ProfilerCalibrator
(-)a/lib.profiler/release/remote-pack-defs/profile-linux-16.sh (-1 / +1 lines)
Lines 14-17 Link Here
14
INSTALL_DIR=`pwd`
14
INSTALL_DIR=`pwd`
15
cd $ORIG_DIR
15
cd $ORIG_DIR
16
16
17
$JAVA_HOME/bin/java -agentpath:$INSTALL_DIR/../lib/deployed/jdk16/linux/libprofilerinterface.so=$INSTALL_DIR/../lib/,5140 $@
17
$JAVA_HOME/bin/java -XX:+UseLinuxPosixThreadCPUClocks -agentpath:$INSTALL_DIR/../lib/deployed/jdk16/linux/libprofilerinterface.so=$INSTALL_DIR/../lib/,5140 $@
(-)a/lib.profiler/src/org/netbeans/lib/profiler/TargetAppRunner.java (+4 lines)
Lines 63-68 Link Here
63
import java.util.ArrayList;
63
import java.util.ArrayList;
64
import java.util.ResourceBundle;
64
import java.util.ResourceBundle;
65
import java.util.Vector;
65
import java.util.Vector;
66
import javax.swing.text.Utilities;
66
67
67
68
68
/**
69
/**
Lines 746-751 Link Here
746
            commands.add("-XX:+ShowMessageBoxOnError"); // NOI18N
747
            commands.add("-XX:+ShowMessageBoxOnError"); // NOI18N
747
        }
748
        }
748
749
750
        if (Platform.isLinux() && settings.getTargetJDKVersionString().equals(Platform.JDK_16_STRING)) {
751
            commands.add("-XX:+UseLinuxPosixThreadCPUClocks");
752
        }
749
        for (int i = 0; i < newJVMArgs.length; i++) {
753
        for (int i = 0; i < newJVMArgs.length; i++) {
750
            commands.add(newJVMArgs[i]);
754
            commands.add(newJVMArgs[i]);
751
        }
755
        }
(-)a/lib.profiler/src/org/netbeans/lib/profiler/global/CalibrationDataFileIO.java (-3 / +10 lines)
Lines 109-116 Link Here
109
            return -1;
109
            return -1;
110
        }
110
        }
111
111
112
        FileInputStream fiStream = null;
112
        try {
113
        try {
113
            FileInputStream fiStream = new FileInputStream(savedDataFile);
114
            fiStream = new FileInputStream(savedDataFile);
114
            ObjectInputStream oiStream = new ObjectInputStream(fiStream);
115
            ObjectInputStream oiStream = new ObjectInputStream(fiStream);
115
116
116
            status.methodEntryExitCallTime = (double[]) oiStream.readObject();
117
            status.methodEntryExitCallTime = (double[]) oiStream.readObject();
Lines 120-126 Link Here
120
121
121
            fiStream.close();
122
            fiStream.close();
122
        } catch (Exception e) {
123
        } catch (Exception e) {
123
            String errorMessage = e.getMessage();
124
            errorMessage = e.getMessage();
124
            String prefix = CALIBRATION_DATA_CORRUPTED_PREFIX;
125
            String prefix = CALIBRATION_DATA_CORRUPTED_PREFIX;
125
126
126
            if (errorMessage == null) {
127
            if (errorMessage == null) {
Lines 134-139 Link Here
134
            errorMessage += ("\n" + RERUN_CALIBRATION_MSG + "\n"); // NOI18N
135
            errorMessage += ("\n" + RERUN_CALIBRATION_MSG + "\n"); // NOI18N
135
136
136
            return -2;
137
            return -2;
138
        } finally {
139
            if (fiStream != null) {
140
                try {
141
                    fiStream.close();
142
                } catch (IOException e) {}
143
            }
137
        }
144
        }
138
145
139
        return 0;
146
        return 0;
Lines 151-157 Link Here
151
158
152
            foStream.close();
159
            foStream.close();
153
        } catch (IOException e) {
160
        } catch (IOException e) {
154
            String errorMessage = e.getMessage();
161
            errorMessage = e.getMessage();
155
            String prefix = ERROR_WRITING_CALIBRATION_FILE_PREFIX;
162
            String prefix = ERROR_WRITING_CALIBRATION_FILE_PREFIX;
156
            errorMessage = prefix + "\n" + ORIGINAL_MESSAGE_STRING + "\n" + errorMessage; // NOI18N
163
            errorMessage = prefix + "\n" + ORIGINAL_MESSAGE_STRING + "\n" + errorMessage; // NOI18N
157
                                                                                          // status.remoteProfiling below means that we actually perform off-line calibration on the remote target machine.
164
                                                                                          // status.remoteProfiling below means that we actually perform off-line calibration on the remote target machine.
(-)a/lib.profiler/src/org/netbeans/lib/profiler/results/cpu/TimingAdjusterOld.java (-2 / +3 lines)
Lines 207-220 Link Here
207
                timingData.methodEntryExitOuterTime0 = status.methodEntryExitOuterTime[0] * safetyMargin0;
207
                timingData.methodEntryExitOuterTime0 = status.methodEntryExitOuterTime[0] * safetyMargin0;
208
                timingData.timerCountsInSecond0 = status.timerCountsInSecond[0];
208
                timingData.timerCountsInSecond0 = status.timerCountsInSecond[0];
209
            } else {
209
            } else {
210
                // Thread CPU only timer used. On Windows and Linux, with extremely low (10 ms or even worse) resolution of
210
                // Thread CPU only timer used. On Windows (and till NB6.10 also Linux), with extremely low
211
                // (10 ms or even worse) resolution of
211
                // this timer, it doesn't make sense to use cleansing - it introduces negative figures for short-running
212
                // this timer, it doesn't make sense to use cleansing - it introduces negative figures for short-running
212
                // methods, for which I didn't find any graceful way to deal with.
213
                // methods, for which I didn't find any graceful way to deal with.
213
                // Also, cleansing is needed to make results sensible for short-running methods - but here for such methods
214
                // Also, cleansing is needed to make results sensible for short-running methods - but here for such methods
214
                // they are already non-sensible, with 0 as a most typical result.
215
                // they are already non-sensible, with 0 as a most typical result.
215
                String targetMachineOSName = status.targetMachineOSName;
216
                String targetMachineOSName = status.targetMachineOSName;
216
217
217
                if (Platform.isWindows(targetMachineOSName) || Platform.isLinux(targetMachineOSName)) {
218
                if (Platform.isWindows(targetMachineOSName) && status.targetJDKVersionString.equals(Platform.JDK_16_STRING)) {
218
                    safetyMargin1 = 0;
219
                    safetyMargin1 = 0;
219
                }
220
                }
220
221
(-)a/profiler.attach/src/org/netbeans/modules/profiler/attach/providers/AbstractIntegrationProvider.java (-1 / +1 lines)
Lines 162-167 Link Here
162
162
163
    protected final String getManualRemoteStep2(final String targetOS) {
163
    protected final String getManualRemoteStep2(final String targetOS) {
164
        return MessageFormat.format(NbBundle.getMessage(AbstractIntegrationProvider.class, "ManualRemoteStep2Message"),
164
        return MessageFormat.format(NbBundle.getMessage(AbstractIntegrationProvider.class, "ManualRemoteStep2Message"),
165
                new Object[]{IntegrationUtils.getRemoteCalibrateCommandString(targetOS)}); // NOI18N
165
                new Object[]{IntegrationUtils.getRemoteCalibrateCommandString(targetOS, getTargetJava())}); // NOI18N
166
    }
166
    }
167
}
167
}
(-)a/profiler.j2se/src/org/netbeans/modules/profiler/j2se/JavaApplicationIntegrationProvider.java (-1 / +1 lines)
Lines 229-235 Link Here
229
229
230
        // Note about export vs. setenv on UNIXes
230
        // Note about export vs. setenv on UNIXes
231
        hints.addHint(MessageFormat.format(MANUAL_REMOTE_HINT_MESSAGE,
231
        hints.addHint(MessageFormat.format(MANUAL_REMOTE_HINT_MESSAGE,
232
                                           new Object[] { IntegrationUtils.getRemoteProfileCommandString(targetOS) }));
232
                                           new Object[] { IntegrationUtils.getRemoteProfileCommandString(targetOS, getTargetJava()) }));
233
233
234
        // Note about decreasing CPU profiling overhead
234
        // Note about decreasing CPU profiling overhead
235
        hints.addHint(REDUCE_OVERHEAD_MSG);
235
        hints.addHint(REDUCE_OVERHEAD_MSG);
(-)a/profiler/src/org/netbeans/modules/profiler/NetBeansProfiler.java (-2 / +19 lines)
Lines 136-141 Link Here
136
import org.apache.tools.ant.module.api.support.ActionUtils;
136
import org.apache.tools.ant.module.api.support.ActionUtils;
137
import org.netbeans.api.project.FileOwnerQuery;
137
import org.netbeans.api.project.FileOwnerQuery;
138
import org.netbeans.lib.profiler.results.cpu.FlatProfileBuilder;
138
import org.netbeans.lib.profiler.results.cpu.FlatProfileBuilder;
139
import org.netbeans.lib.profiler.results.cpu.TimingAdjusterOld;
139
import org.netbeans.lib.profiler.results.cpu.cct.TimeCollector;
140
import org.netbeans.lib.profiler.results.cpu.cct.TimeCollector;
140
import org.netbeans.lib.profiler.ui.monitor.VMTelemetryModels;
141
import org.netbeans.lib.profiler.ui.monitor.VMTelemetryModels;
141
import org.netbeans.modules.profiler.heapwalk.HeapDumpWatch;
142
import org.netbeans.modules.profiler.heapwalk.HeapDumpWatch;
Lines 1549-1554 Link Here
1549
                displayInfoAndWait(INITIAL_CALIBRATION_MSG);
1550
                displayInfoAndWait(INITIAL_CALIBRATION_MSG);
1550
                result = targetAppRunner.calibrateInstrumentationCode();
1551
                result = targetAppRunner.calibrateInstrumentationCode();
1551
            }
1552
            }
1553
1554
            boolean shouldCalibrate = false;
1555
            targetAppRunner.getProfilingSessionStatus().beginTrans(false);
1556
            try {
1557
                // the calibration was executed without the usage of "-XX:+UseLinuxPosixThreadCPUClocks" flag
1558
                // ---> recalibrate <---
1559
                shouldCalibrate = Platform.isLinux() &&
1560
                                  Platform.JDK_16_STRING.equals(pes.getTargetJDKVersionString()) &&
1561
                                  targetAppRunner.getProfilingSessionStatus().methodEntryExitCallTime[1] > 20000; // 20us
1562
            } finally {
1563
                targetAppRunner.getProfilingSessionStatus().endTrans();
1564
            }
1565
            if (shouldCalibrate) {
1566
                result = targetAppRunner.calibrateInstrumentationCode();
1567
            }
1552
        } else {
1568
        } else {
1553
            result = targetAppRunner.calibrateInstrumentationCode();
1569
            result = targetAppRunner.calibrateInstrumentationCode();
1554
        }
1570
        }
Lines 1627-1640 Link Here
1627
    @Override
1643
    @Override
1628
    public boolean prepareInstrumentation(ProfilingSettings profilingSettings) {
1644
    public boolean prepareInstrumentation(ProfilingSettings profilingSettings) {
1629
        final boolean retValue;
1645
        final boolean retValue;
1630
        teardownDispatcher();
1631
        setupDispatcher(profilingSettings);
1632
1646
1633
        ClientUtils.SourceCodeSelection[] marks = MarkingEngine.getDefault().getMarkerMethods();
1647
        ClientUtils.SourceCodeSelection[] marks = MarkingEngine.getDefault().getMarkerMethods();
1634
        profilingSettings.setInstrumentationMarkerMethods(marks);
1648
        profilingSettings.setInstrumentationMarkerMethods(marks);
1635
1649
1636
        retValue = super.prepareInstrumentation(profilingSettings);
1650
        retValue = super.prepareInstrumentation(profilingSettings);
1637
1651
1652
        teardownDispatcher();
1653
        setupDispatcher(profilingSettings);
1654
1638
        return retValue;
1655
        return retValue;
1639
    }
1656
    }
1640
1657
(-)a/profiler/src/org/netbeans/modules/profiler/actions/AntActions.java (-3 / +15 lines)
Lines 73-81 Link Here
73
import java.text.MessageFormat;
73
import java.text.MessageFormat;
74
import java.util.Properties;
74
import java.util.Properties;
75
import javax.swing.Action;
75
import javax.swing.Action;
76
import javax.swing.ImageIcon;
76
import org.netbeans.lib.profiler.global.Platform;
77
import org.netbeans.modules.profiler.projectsupport.utilities.ProjectUtilities;
77
import org.netbeans.modules.profiler.projectsupport.utilities.ProjectUtilities;
78
import org.netbeans.modules.profiler.projectsupport.utilities.SourceUtils;
78
import org.netbeans.modules.profiler.projectsupport.utilities.SourceUtils;
79
import org.openide.util.Utilities;
79
80
80
81
81
/**
82
/**
Lines 98-103 Link Here
98
                                                                                                "AntActions_IncorrectJavaSpecVersionDialogCaption"); // NOI18N
99
                                                                                                "AntActions_IncorrectJavaSpecVersionDialogCaption"); // NOI18N
99
    private static final String INCORRECT_JAVA_SPECVERSION_DIALOG_MSG = NbBundle.getMessage(AntActions.class,
100
    private static final String INCORRECT_JAVA_SPECVERSION_DIALOG_MSG = NbBundle.getMessage(AntActions.class,
100
                                                                                            "AntActions_IncorrectJavaSpecVersionDialogMsg"); // NOI18N
101
                                                                                            "AntActions_IncorrectJavaSpecVersionDialogMsg"); // NOI18N
102
    private static final String LINUX_THREAD_TIMER_KEY = "-XX:+UseLinuxPosixThreadCPUClocks";
101
    private static final String UNSUPPORTED_PROJECT_TYPE_MSG = NbBundle.getMessage(AntActions.class,
103
    private static final String UNSUPPORTED_PROJECT_TYPE_MSG = NbBundle.getMessage(AntActions.class,
102
                                                                                   "AntActions_UnsupportedProjectTypeMsg"); // NOI18N                                                                                                                            
104
                                                                                   "AntActions_UnsupportedProjectTypeMsg"); // NOI18N                                                                                                                            
103
    private static final String INVALID_JAVAPLATFORM_MSG = NbBundle.getMessage(AntActions.class,
105
    private static final String INVALID_JAVAPLATFORM_MSG = NbBundle.getMessage(AntActions.class,
Lines 435-446 Link Here
435
        return null;
437
        return null;
436
    }
438
    }
437
439
440
    private static void activateLinuxPosixThreadTime(ProfilingSettings ps, Properties props, Project project) {
441
        if (ps.getThreadCPUTimerOn()) {
442
            props.setProperty("profiler.info.jvmargs", LINUX_THREAD_TIMER_KEY + " " + props.getProperty("profiler.info.jvmargs")); // NOI18N
443
            ProfilerLogger.log("Profiler.UseLinuxPosixThreadCPUClocks: Enabled"); // NOI18N
444
        }
445
    }
446
438
    private static void activateOOMProtection(ProfilerIDESettings gps, Properties props, Project project) {
447
    private static void activateOOMProtection(ProfilerIDESettings gps, Properties props, Project project) {
439
        if (gps.isOOMDetectionEnabled()) {
448
        if (gps.isOOMDetectionEnabled()) {
440
            String oldArgs = props.getProperty("profiler.info.jvmargs");
449
            String oldArgs = props.getProperty("profiler.info.jvmargs");
441
            oldArgs = (oldArgs != null) ? oldArgs : "";
450
            oldArgs = (oldArgs != null) ? oldArgs : "";
442
451
443
            StringBuffer oomArgsBuffer = new StringBuffer(oldArgs);
452
            StringBuilder oomArgsBuffer = new StringBuilder(oldArgs);
444
            String heapDumpPath = getHeapDumpPath(gps, project);
453
            String heapDumpPath = getHeapDumpPath(gps, project);
445
454
446
            if ((heapDumpPath != null) && (heapDumpPath.length() > 0)) {
455
            if ((heapDumpPath != null) && (heapDumpPath.length() > 0)) {
Lines 583-589 Link Here
583
                                
592
                                
584
                                if (javaPlatformName != null) {
593
                                if (javaPlatformName != null) {
585
                                    usedJavaExecutable = Profiler.getDefault().getPlatformJavaFile(javaPlatformName);
594
                                    usedJavaExecutable = Profiler.getDefault().getPlatformJavaFile(javaPlatformName);
586
587
                                    jp = IDEUtils.getJavaPlatformByName(javaPlatformName);
595
                                    jp = IDEUtils.getJavaPlatformByName(javaPlatformName);
588
596
589
                                    if (jp == null) {
597
                                    if (jp == null) {
Lines 640-645 Link Here
640
                            } else {
648
                            } else {
641
                                throw new IllegalArgumentException("Unsupported JDK " + javaVersion); // NOI18N
649
                                throw new IllegalArgumentException("Unsupported JDK " + javaVersion); // NOI18N
642
                            }
650
                            }
651
652
                            if (Platform.isLinux() && javaVersion.equals(CommonConstants.JDK_16_STRING)) {
653
                                activateLinuxPosixThreadTime(pSettings, props, project);
654
                            }
643
                            
655
                            
644
                            if (!ptp.startProfilingSession(project, profiledClassFile, isTest, props)) { // Used for Maven - ProjectTypeProfiler itself controls starting profiling session
656
                            if (!ptp.startProfilingSession(project, profiledClassFile, isTest, props)) { // Used for Maven - ProjectTypeProfiler itself controls starting profiling session
645
                                
657
                                
(-)a/profiler/src/org/netbeans/modules/profiler/ui/stp/Bundle.properties (-1 / +1 lines)
Lines 63-69 Link Here
63
CPUSettingsAdvancedPanel_ProfileFrameworkCheckboxText=&Profile underlying framework startup
63
CPUSettingsAdvancedPanel_ProfileFrameworkCheckboxText=&Profile underlying framework startup
64
CPUSettingsAdvancedPanel_ProfileThreadsCheckboxText=Profile new &Threads/Runnables
64
CPUSettingsAdvancedPanel_ProfileThreadsCheckboxText=Profile new &Threads/Runnables
65
CPUSettingsAdvancedPanel_LimitThreadsCheckboxText=&Limit number of profiled threads\:
65
CPUSettingsAdvancedPanel_LimitThreadsCheckboxText=&Limit number of profiled threads\:
66
CPUSettingsAdvancedPanel_ThreadTimerCheckboxText=&Use thread CPU timer (Solaris only)
66
CPUSettingsAdvancedPanel_ThreadTimerCheckboxText=&Use thread CPU timer
67
CPUSettingsAdvancedPanel_InstrSchemeLabelText=&Instrumentation scheme\:
67
CPUSettingsAdvancedPanel_InstrSchemeLabelText=&Instrumentation scheme\:
68
CPUSettingsAdvancedPanel_InstrumentLabelText=Instrument\:
68
CPUSettingsAdvancedPanel_InstrumentLabelText=Instrument\:
69
CPUSettingsAdvancedPanel_MethodInvokeCheckboxText=Method.in&voke()
69
CPUSettingsAdvancedPanel_MethodInvokeCheckboxText=Method.in&voke()
(-)a/profiler/src/org/netbeans/modules/profiler/ui/stp/DefaultSettingsConfigurator.java (-7 / +3 lines)
Lines 47-53 Link Here
47
import org.netbeans.lib.profiler.client.ClientUtils;
47
import org.netbeans.lib.profiler.client.ClientUtils;
48
import org.netbeans.lib.profiler.common.ProfilingSettings;
48
import org.netbeans.lib.profiler.common.ProfilingSettings;
49
import org.netbeans.lib.profiler.common.ProfilingSettingsPresets;
49
import org.netbeans.lib.profiler.common.ProfilingSettingsPresets;
50
import org.netbeans.lib.profiler.global.Platform;
51
import org.netbeans.modules.profiler.ppoints.ui.ProfilingPointsDisplayer;
50
import org.netbeans.modules.profiler.ppoints.ui.ProfilingPointsDisplayer;
52
import org.netbeans.modules.profiler.spi.ProjectTypeProfiler;
51
import org.netbeans.modules.profiler.spi.ProjectTypeProfiler;
53
import org.openide.filesystems.FileObject;
52
import org.openide.filesystems.FileObject;
Lines 56-62 Link Here
56
import javax.swing.JPanel;
55
import javax.swing.JPanel;
57
import javax.swing.event.ChangeEvent;
56
import javax.swing.event.ChangeEvent;
58
import javax.swing.event.ChangeListener;
57
import javax.swing.event.ChangeListener;
59
import org.netbeans.modules.profiler.projectsupport.utilities.ProjectUtilities;
58
import org.netbeans.lib.profiler.TargetAppRunner;
60
59
61
60
62
/**
61
/**
Lines 69-75 Link Here
69
    public static class CPUContents implements SettingsContainerPanel.Contents, ChangeListener {
68
    public static class CPUContents implements SettingsContainerPanel.Contents, ChangeListener {
70
        //~ Static fields/initializers -------------------------------------------------------------------------------------------
69
        //~ Static fields/initializers -------------------------------------------------------------------------------------------
71
70
72
        private static final boolean ENABLE_THREAD_CPU_TIMER = Boolean.getBoolean("org.netbeans.lib.profiler.enableThreadCPUTimer"); // NOI18N
71
//        private static final boolean ENABLE_THREAD_CPU_TIMER = Boolean.getBoolean("org.netbeans.lib.profiler.enableThreadCPUTimer"); // NOI18N
73
72
74
        //~ Instance fields ------------------------------------------------------------------------------------------------------
73
        //~ Instance fields ------------------------------------------------------------------------------------------------------
75
74
Lines 85-91 Link Here
85
        private boolean isAttach;
84
        private boolean isAttach;
86
        private boolean isModify;
85
        private boolean isModify;
87
        private boolean isPreset;
86
        private boolean isPreset;
88
        private boolean useCPUTimer;
87
        final private boolean useCPUTimer = true; // always enabled
89
88
90
        //~ Constructors ---------------------------------------------------------------------------------------------------------
89
        //~ Constructors ---------------------------------------------------------------------------------------------------------
91
90
Lines 115-122 Link Here
115
            this.enableOverride = enableOverride;
114
            this.enableOverride = enableOverride;
116
            this.isAttach = isAttach;
115
            this.isAttach = isAttach;
117
            this.isModify = isModify;
116
            this.isModify = isModify;
118
119
            useCPUTimer = ENABLE_THREAD_CPU_TIMER || isAttach || Platform.isSolaris();
120
        }
117
        }
121
118
122
        public float getProfilingOverhead() {
119
        public float getProfilingOverhead() {
Lines 244-250 Link Here
244
            isAttach = false;
241
            isAttach = false;
245
            isModify = false;
242
            isModify = false;
246
            isPreset = false;
243
            isPreset = false;
247
            useCPUTimer = false;
248
        }
244
        }
249
245
250
        public void stateChanged(ChangeEvent e) {
246
        public void stateChanged(ChangeEvent e) {

Return to bug 189621