Attaching Source to VisualVM? [duplicate] - java

I'm running VisualVM to profile a simple Java application. When I double-click on a method in the profiling pane (hoping to get more details on it), then it says "No source found for class ....". I know where the source is. How do I tell VisualVM where to look?

I took a stack dump of the VisualVM process while it was displaying that error dialog, and it seems that the problem lies in the class org.netbeans.modules.profiler.api.GoToSource, in the method openSourceImpl.
This method tries to load the source using any registered implementations of the GoToSourceProvider service provider interface, and displays the error message if none of them manage to display the source code in question.
My guess is that the current, default version of VisualVM doesn't have any GoToSourceProviders registered, and therefore will always fail to look-up source code.
From the package name it appears that GoToSourceProvider is an SPI for the profiler module, but I wasn't able to find any documentation on how to implement this SPI, and it doesn't seem to be part of the VisualVM extension points.

Hello something virtually same like VisualVM is implemented in NetBeans IDE (I'm using 8.0.2). You just click Profile->Project Profile. Showing you source code upon clicking is working there. But unfortunately there is no more detailed info which lines of code takes most time.
For that I will modify code and I will count manually using
long beg = System.nanoTime()
lineISuspect
sum += System.nanoTime() - beg;

Related

How to download images with difference highlighted in Applitools?

I am trying to download diff image of base and checkpoint url created by applitools.
I found test result handler which does this. Here is the link:
https://help.applitools.com/hc/en-us/articles/360007188111-TestResultsHandler-a-way-to-download-diffs-baseline-and-current-images
While running repo I am getting errors.
How to make it work? Anyone has example that works?
I am using java selenium.
I work on the Applitools technical support team. I understand that you're running into an issue with downloading the diff images when using the TestResultsHandler class in Java.
It is tough to say exactly what the issue is that you're experiencing without seeing the error messages as well as your code. In any case, here is an example of the TestResultsHandler usage.
Alternatively, you can also use the Eyes Utilities JAR which also provides the capability of downloading the differences.
Lastly, if you're still running into issues, please feel free to reach out to us directly by opening a ticket via this web form.

Despite using jna.debug_load=true jna library doesn't seem to print the steps of its dll search. What could be wrong?

We are using a 3rd party library that in turn depends on jna. We have the jna.debug_load=true set but we don't see the related logs anywhere. Even after launching our program via cmd prompt and directing the console logs to a file the logs are not to be seen. Not much documentation around this so please help.
Is there a way to get them to show up on our application logs(we use log4j 1.2.x).
Specifically we want to know where it finds jnidispatch.dll
The jna.debug_load=true setting is for external libraries/DLLs that JNA loads, but not its own native jnidispatch.dll. Per the JNA FAQ you need jna.debug_load.jna for that:
Set the system property jna.debug_load=true, and JNA will print its library search steps to the console. jna.debug_load.jna will trace the search for JNA's own native support.
As for the logging itself, JNA logs to java.util.logging. You'll need to redirect that to log4j using one of the solutions outlined in answers to this question

how to debug kernels called by a java(jcuda) program

Is there any way to debug cuda functions called by java (jcuda) ?
My program launch this exception:
Exception in thread "main" jcuda.CudaException:CUDA_ERROR_ILLEGAL_ADDRESS
at jcuda.driver.JCudaDriver.checkResult(JCudaDriver.java:288)
at jcuda.driver.JCudaDriver.cuCtxSynchronize(JCudaDriver.java:1852)
at CalculateurGPU.updateAndCompute(rGPUcalculator.java:129)
at Test.main(Test.java:90)
I have a very long cuda code, and i can't find any information in that to help me find where the error is.
Another question: when i click on "JCudaDriver.java:288" i don't have access to it, it says "source not found". How can i attach thesesources to my project ?
Thanks in advance
The best way I have been able to debug my JCuda executable code is by putting printf statements everywhere. Obviously delete them after you are done but you have to start somewhere.
Add the following to your .java code that is calling your kernel code.
JCudaDriver.cuCtxSetLimit(CUlimit.CU_LIMIT_PRINTF_FIFO_SIZE, 4096);
Then inside your CUDA kernel, use printf(""); statements in your CUDA kernel code to determine where the problem exists. If I had a guess it would be due to you access a piece of memory that you shouldn't be.
I would also suggest wrapping the printf with a if(gtid == 0){printf("hello\n");} otherwise you are going to have every thread trying to perform the printf.
Source: http://forum.byte-welt.net/byte-welt-projekte-projects/swogl-jcuda-jocl/jcuda/3255-gpu-printf-compute-capility-2-0-a.html
EDIT:
I would like to add that there has been a debugging section added on the JCuda website. It suggests using a tool called "cuda-memcheck" to aid in debugging your CUDA applications.
http://www.jcuda.org/debugging/Debugging.html

JNA Unable to load module - output debug information (dependencies)

I want to load a .dll file (simpleDLL.dll form a jna tutorial) but i get
java.lang.UnsatisfiedLinkError: Unable to load library 'simpleDLL':
The specified module could not be found.
I run the java program with wine under ubuntu and I got this information:
err:module:import_dll Library MSVCR100D.dll (which is needed by ...
This message was not displayed when running the program in Eclipse, so my question is:
Is there a way to set a more detailed debug level for JNA, so that dependent .dll files can be displayed when trying to load a module ? (I wasted a lot of time thinking that somehow, the jna.library.path is not correctly set and actually, no information was printed regarding other .dll files needed).
You get more detailed information from wine because that system chooses to implement a more descriptive error message than does the windows OS. You can't magically force windows to behave like wine.
wine emulates windows (i.e. in order to function properly, it must mimic windows exactly). Apparently in some cases it provides better error reporting, although I doubt your err:module:import_dll message came through the normal win32 error text lookup without additional tweaking, or wine wouldn't be doing its job of emulating windows very well.
Windows, on the other hand, will not report more information about DLL dependencies until Microsoft changes it to do so, which isn't likely to happen, ever.

Java Applets loading at snail's pace

I have a Java Applet application ( achart) on my php Webpage ... Problem here is the Java Applet takes more time to load ... I am thinking of replacing these applets with some similar technology but fast ... I am counting on Ajax... what are my other options ... ?
Java applets load slowly. shrug Its the nature of the beast....
If you have multiple jars, you should check the order of the classpath you provide to your applet. Note that each jar is only downloaded "on demand" whenever a class needs to be loaded. It looks in the first jar, if it can't find the class it looks in the second and so on... You can reduce your startup time by ensuring that all of your classes required for starting up the app are in the first jar(s) listed.
Also, if you are attempting to load a class or resource which is not in your classpath, it must search through all the jars before returning AND hit the server codebase to look there. It can potentially greatly reduce your startup time.
Turn on applet tracing in the java control panel and you should get a better idea of how classes are being loaded out of the jars.
If the size of the applet's JAR library takes to long to download, you can shrink the size with the ProGuard tool. Here is a comparison of the compression ratio for some Java libraries.
Have you packed your jars.....
Have you tried Java deployment toolkit (http://blogs.oracle.com/vaibhav/entry/java_deployment_toolkit_6u10)
with jdk 1.6.10+.....
If its simple charts you want, have a look at:
http://code.google.com/apis/chart/
Yahoo has some nice charting components for actionscript 3 (flash) http://developer.yahoo.com/flash/astra-flash/charts/
Google has a service that will generate charts as images as Tim already pointed out.
Alternatively you could try to speed up the delivery of the applets that you are using - check if they have an Expires header so they only get downloaded once in a while instead of for every page (this won't help on the first view, but will speed up those after that)
Edit: if you only target specific browsers you could try and create the charts using javascript and the Canvas element, but that is definitely not supported by internet explorer. https://developer.mozilla.org/en/Canvas_tutorial
I know this answer is a bit late but, it could be that you are just being very inefficent with java or your machine is slow, I have a java program that has quite alot of code as well as accessing an SQLite DataBase and it runs quite quickly, loading within five seconds. If you have anything you don't use in your program then remove it, also try jaring and signing it(not sure if last two things would help.)

Categories

Resources