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.

Bug 196748 - profiler is not on if run with arguments
Summary: profiler is not on if run with arguments
Status: VERIFIED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Profile (show other bugs)
Version: 7.0
Hardware: All All
: P1 normal (vote)
Assignee: Thomas Preisler
URL:
Keywords:
: 193655 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-03-15 23:38 UTC by Thomas Preisler
Modified: 2011-03-22 13:34 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Preisler 2011-03-15 23:38:56 UTC
Try and run welcome project: profiler is not on. Then try to remove the arguments and the profiler is now on.

The cause is the function isSimpleRunCommand that now always returns false if run with arguments.
Comment 1 Alexander Pepin 2011-03-16 17:22:49 UTC
This is a showstopper for RC1. Please fix it ASAP following the HR FIX process.
Comment 2 Thomas Preisler 2011-03-16 19:51:44 UTC
The issue:
The problem is it is impossible to know whether the command points to the binary the user do want to profile or to a runner, typically a shell but don't have to be, which the user probably don't wan to profile. I change the logic so it will turn off profiling when using most typical runners but it can be by-passed in which case the profiler will start. Starting profiler in these cases doesn't do any harm and the user can always explicitly turn it off so it should not be a problem.

The fix:
Instead of checking for a space (which doesn't work after we merged run command and arguments) in isSimpleRunCommand, I changed the logic to return false if the command starts with "/bin" or a known shell command like "sh", "bash", "csh". 

changeset:   191138:06e6342882cd
tag:         tip
user:        Thomas Preisler <thp@netbeans.org>
date:        Wed Mar 16 12:43:25 2011 -0700
summary:     #196748 profiler is not on if run with arguments
Comment 3 Thomas Preisler 2011-03-16 19:55:20 UTC
*** Bug 193655 has been marked as a duplicate of this bug. ***
Comment 4 Quality Engineering 2011-03-17 09:53:17 UTC
Integrated into 'main-golden', will be available in build *201103170400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/06e6342882cd
User: Thomas Preisler <thp@netbeans.org>
Log: #196748 profiler is not on if run with arguments
Comment 5 Thomas Preisler 2011-03-18 18:49:39 UTC
DIscussion with Igor/Andrew:
OK, just to summarize it:

Solution 1:
public boolean isSimpleRunCommand() {
        String rc = runCommand.getValue().trim();
        if (rc.startsWith("\"${")) { // default..... // NOI18N
            return true;
        } else if (makeConfiguration != null && makeConfiguration.isLibraryConfiguration()) {
            return true;
        } else if (rc.startsWith("/bin") || rc.startsWith("sh") || rc.startsWith("bash") || rc.startsWith("csh")) { // NOI18N
            return false;
        } else {
            return true;
        }
    }

Solution 2:
public boolean isSimpleRunCommand() {
        String rc = runCommand.getValue().trim();
        if (rc.startsWith("\"${")) { // default..... // NOI18N
            return true;
        } else if (makeConfiguration != null && makeConfiguration.isLibraryConfiguration()) {
            return true;
        } else  {
            return false;
        }
    }

Solution 1: starts profiler in some (rare) cases where it doesn't work, but it is harmless and user can always turn it off.

Solution 2: turns profiler off in some cases where it shouldn't but user cannot turn it on. 

Igor:
I'm proposing to use Solution 2. It's more conservative, so user likely won't see any irrelevant data. And you are absolutely right that user can turn profiler on by force. 

thp:
changed fix to Solution 2. Fix considered reviewed by Igor.
Comment 6 Thomas Preisler 2011-03-18 18:53:26 UTC
Second changeset:

changeset:   191276:73fee75b7da3
tag:         tip
user:        Thomas Preisler <thp@netbeans.org>
date:        Fri Mar 18 11:35:02 2011 -0700
summary:     #196748 profiler is not on if run with arguments
Comment 7 Quality Engineering 2011-03-19 09:42:38 UTC
Integrated into 'main-golden', will be available in build *201103190400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/73fee75b7da3
User: Thomas Preisler <thp@netbeans.org>
Log: #196748 profiler is not on if run with arguments
Comment 8 Alexander Pepin 2011-03-21 16:28:56 UTC
verified in dev build #5002,
please push the fix into release70 branch.
Comment 9 Thomas Preisler 2011-03-21 18:03:48 UTC
release70 changeset:


changeset:   195149:4b9db51d04ab
branch:      release70
tag:         tip
parent:      195138:c305d435060c
user:        Thomas Preisler <thp@netbeans.org>
date:        Mon Mar 21 11:00:55 2011 -0700
summary:     #196748 profiler is not on if run with arguments
Comment 10 Alexander Pepin 2011-03-22 13:34:26 UTC
verified in RC1 build 20110322.