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 177553 - Profiler does not capture data from a java agent (-javaagent)
Summary: Profiler does not capture data from a java agent (-javaagent)
Status: RESOLVED WORKSFORME
Alias: None
Product: profiler
Classification: Unclassified
Component: Engine (show other bugs)
Version: 6.x
Hardware: Macintosh (x86) Mac OS X
: P3 normal (vote)
Assignee: Tomas Hurka
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-24 22:52 UTC by tjquinn
Modified: 2015-08-05 10:50 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
zip of a NB project containing the sample (16.99 KB, application/octet-stream)
2009-11-24 22:52 UTC, tjquinn
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tjquinn 2009-11-24 22:52:39 UTC
Created attachment 91642 [details]
zip of a NB project containing the sample

The attached NB project uses a single class for both the application's main class and also a Java agent's premain class.  The profile can connect to the VM, and judging from the output emitted by the profiling logging in the app it does so before the agent starts. 

But the collected data shows none of the processing that occurs in the Java agent.  

Build the attached project.  Get the extra VM args to use the 'direct' attach method.  Then use

java -agentpath:as-netbeans-says -javaagent:AgentProfileTest.jar=14000 -jar AgentProfileTest.jar

Note that the VM stalls waiting for the profiler to connect before the agent starts, then the profile log messages appear, then the agent's greeting appears, then the main program runs.  

When the VM ends and the profiler in NB asks to gather final stats, say yes.  The stats show only the activity from the main class invocation.  No activity from the agent is reported.
Comment 1 tjquinn 2009-11-25 05:23:14 UTC
By the way, here is the output from my run:

java -agentpath:/var/folders/dN/dNVGJ-QqF1axQMnvTbGncE+++TI/-Tmp-/NBProfiler3168080359046112041.link/deployed/jdk16/mac/libprofilerinterface.jnilib=/var/folders/dN/dNVGJ-QqF1axQMnvTbGncE+++TI/-Tmp-/NBProfiler3168080359046112041.link,5140 -javaagent:"/Users/Tim/asgroup/NBProjects/AgentProfileTest/dist/AgentProfileTest.jar"=10000 -jar "/Users/Tim/asgroup/NBProjects/AgentProfileTest/dist/AgentProfileTest.jar"
Profiler Agent: Initializing...
Profiler Agent: Options: >/var/folders/dN/dNVGJ-QqF1axQMnvTbGncE+++TI/-Tmp-/NBProfiler3168080359046112041.link,5140<
Profiler Agent: Initialized succesfully
Profiler Agent: Waiting for connection on port 5140 (Protocol version: 9)
Profiler Agent: Established local connection with the tool
Profiler Agent: Redefining 100 classes at idx 0, out of total 757 
Profiler Agent: Redefining 100 classes at idx 100, out of total 757 
Profiler Agent: Redefining 100 classes at idx 200, out of total 757 
Profiler Agent: Redefining 100 classes at idx 300, out of total 757 
Profiler Agent: Redefining 100 classes at idx 400, out of total 757 
Profiler Agent: Redefining 100 classes at idx 500, out of total 757 
Profiler Agent: Redefining 100 classes at idx 600, out of total 757 
Profiler Agent: Redefining 57 classes at idx 700, out of total 757 
Agent starting 10000 iterations
Main starting 10000 iterations
Profiler Agent: Connection with agent closed
Profiler Agent: Connection with agent closed
Comment 2 Tomas Hurka 2015-08-05 10:50:15 UTC
I am not able to reproduce it in latest dev. builds. I am able to obtain CPU profiling data from agent.