What do I need to do to use com.jprofiler.agent.Controller in my code? - intellij-idea

Could guys please tell me what exactly I need to do in order to use com.jprofiler.agent.Controller in my code ?
I have GWT/GAE application which I'm running under debugger of IntelliJ IDEA 11. I have JProfiler 7.0.1.
I googled a little and it seems I need to pass this "-agentpath:C:\Program Files (x86)\jprofiler7\bin\windows\jprofilerti.dll,config=C:\Program Files (x86)\jprofiler7\api\samples\common\config.xml"
"-Xbootclasspath/a:S:\Program Files (x86)\jprofiler7\bin\agent.jar" to JVM but it doesn't seem to work.

Generally,
-agentpath:[path to jprofilerti.dll]
is enough. The process will wait for the JProfiler GUI to connect. This is so it can use the correct profiling settings with a minimum overhead.
To get immediate startup, pass
-agentpath:[path to jprofilerti.dll],nowait
The profiling agent will then have to retransform classes, depending on your filter settings.
And using the JProfiler plugin from the plugin manager will make all of this unnecessary.

Related

Flashing target with GHS probe using command line

We're using Greenhills Multi IDE and Greenhills Debug Probe to program and debug our target system (a Coldfire based, bare metal system). Currently I flash the target using the IDE debugger GUI, but I would prefer to use a command line interface to do it.
The documentation is fairly sketchy, and only gives a very simple example. As far as I can tell I should be able to use grun with gflash to do this, but I'm having a hard time figuring out which GUI fields map to which grun options. Anyone with any experience of this?
Basically I need to be able to specify (see image above):
Flash device (this one I've got figured out I think)
Base address
Image file (we use raw images)
Offset in flash
Alternate RAM base
Alternate flash utility
Possibly also alternate MBS script
Any tips, tricks, or pointers to better documentation than the standard GHS one? Would be much appreciated!
Is below screenshot from debugger command reference is of any help? You can use it to download your source on HW. I will be able to share more details is this helps. Or you can share your solution if you had already found it.
I used mpadmin for this purpose.
mpadmin -update <IP-addr_of_your-probe | -usb> firmware.frm

How to distinguish betweeen parallel calls and sequential calls in jprofiler tracing session?

Can you pls help us answering the below questions.
1) While tracing/profiling a JAVA based web application using jprofiler is there any way to find out if the calls are parallel or sequential ?
2) While running Jprofiler on JVM where Wily tracing tool is already there, the jprofiler is mostly detecting the the overhead due to Wily tool rather than the actual application. Is there any way we can enable the jpropfiler filter to ignore Wily probes (e.g. ignore anything that starts with com.wily.. Even after putting this filter in jprofiler exclude class filter, still jprofiler detects the Wily probes with com.wily.). Can you pls suggest how to fix this in exclude filter ?
Also, is there any known conflicts/issues of jprofiler with Wily tool ?
Thanks,
PR
is there any way to find out if the calls are parallel or sequential
No, the call tree cannot show this.
Even after putting this filter in jprofiler exclude class filter, still
jprofiler detects the Wily probes with com.wily.
That is because the calls from profiled classes are always shown and Wily instruments your code. You can configure a ignored method by right-clicking the Wily method in the call tree and choosing "Add filter from selection->Ignore method ...".
In general, I would not recommend to use multiple profilers or monitoring tools at the same time.

objective c check if java installed

I am new to OS x programming , I am looking for the best way to check if Java is installed on Current machine.
The only thing that is coming to my mind is to run NSTask and read stdout ... but I am pretty sure that there is better way to do it. Thanks.
well I think you probably have lots of options, but the most reliable would be to write a java program that outputs in JSON or XML or whatever, all of the requirements that you need in your jvm (like version if some module can be loaded etc) then fire it up with NSTask... if you want to check in your own process you could just check for the existence of files... which wouldn't be AS reliable as it wouldn't gauranteed that the clients java actually works.. but it is going to be 90+% reliable.

IntelliJ IDEA updating classes takes too much time

I really like IDEA, but when I work with a webapp running on Tomcat and I modify only a single java class file, I have to do an update classes and resources and it takes much more time to do it than in eclipse. In eclipse it's instant, at least I don't notice anything, in IDEA it does a make and updates caches and I don't know what else but it's really annoying.
Why is that and how can I solve this?
Update would depend on your project and its configuration in IDEA. Normally it should not take too long as only the required steps are performed. Compilation is incremental and would be instant. In order to understand why it takes long for your project, we'll need the sample project and the exact steps to reproduce it, please file an issue to our issue tracker.
If you want really fast updates, you may consider using JRebel, it has plug-in for IDEA.
Not so with IntelliJ 10.x. Updates don't require a complete build and redeployment. Try the new version.
I am not sure but you can actually check your Project Settings. There in the modules section you can mark some of your unnecessary folders as excluded.
This might speed up your process as the unnecessary files are now not been indexed.

Why's a simple change to rt.jar causing the Java Runtime Environment to crash silently?

This is what I'm doing:
extract contents of my JRE's rt.jar
extract src.zip of my JDK (same version)
Now, if I copy Runtime.java from the extracted src folder and compile it using javac.exe without any modifications and then put it in the extracted rt folder to finally put everything back in a jar file using jar.exe, everything works as expected. The JRE runs fine.
However, if I make the slightest change to Runtime.java and compile it and put it in rt.jar, the JRE crashes whenever I attempt to start it. This is an example of a slight change that causes the silent crash:
/** Don't let anyone else instantiate this class */
private Runtime() {
System.out.println("This is a test.");
}
Instead of:
/** Don't let anyone else instantiate this class */
private Runtime() {}
Could anyone tell me why this is causing my JRE to crash?
Thanks in advance.
It's possible that System.out has not been initialised at the time that the Runtime() constructor runs. Usually console output is not considered a "slight" change, but at the wrong time it can invoke way too much stuff that may not be set up at all yet.
You're doing this all wrong. You can't distribute that modified JRE for a start, so it is only useful inside your organization . Install a SecurityManager and don't grant your codebase any of the RuntimePermissions you're trying to protect against.
#Tom - I advise you NOT to try to do this:
You cannot distribute the modified rt.jar file without violating the Sun binary license.
Even if you did, you would not be allowed to call it Java.
As you are finding, there are lots of complications that arise when you make changes, particularly when those changes might interfere with the JVM's behind the scenes initialization. And when things blow up during initialization, the JVM often cannot report the problem in an intelligible way.
If you do succeed in making the modified rt.jar work for one JRE, there is no guarantee that the same hacks will work for a different version.
Nobody in their right mind would knowingly use a modified JVM (especially one modified by a third-party) in a production app.
EDIT : judging from your other questions, I guess you are trying to reverse engineer or modify some third party Java application with a custom launcher. If you provided more information on what you were really trying to do, we might be able to suggest the right way to do it ... rather than using "desperate measures" such as modifying the JRE.
That's pretty strange, as I did the same trick with many classes in rt.jar in past.
Can you provide us with the crashed process output?