Does Eclipse debugger support save/restore or checkpoint/rewind? - java

What I mean is the following, illustrated via an example:
I start my Java application (which happens to be a simulator). The application runs for 1 hour and fails. I want to relaunch my application in debug mode, run it to minute 59, then start stepping through the code. At any point, I want to get back to the state that was present in minute 59 and re-start my debug.
Does Eclipse or some plugin have such support? If not, is there another open source application that can be used?
This can be accomplished by using a VM and simply saving state at the point of interest. But I'm wondering if there is a more native/faster Java solution.

The only possible solution to do this in Java that I know is this debugger from Chronon http://www.chrononsystems.com/ which integrates with Eclipse IDE.
The idea is that you record a debugging session which let you playback it. Although this is non-opensource and licensed software, it's still a cool product.

This could be done using a virtual maschine and taking a snapshot at the desired debugging state. You can then apply this snapshot over and over again, though this solution takes a considerably amount of time.

Related

Visual Studio Code - lagging when typing

I have just installed Visual Studio Code together with the Java Extension Pack. However, when I opened my first file and started typing, the text I type appears after a delay - reaching up even one second.
I have a hunch that it might be due to the number of processes going behind the editor, like real-time syntax checking, autocompletion, code hints et cetera. Perhaps the laptop I am working at simply cannot handle that much. These are the parameters of my current machine:
Processor: Intel(R) Caleron(R) CPU N3350 (1.10 GHz)
RAM: 4 GB
I have another hunch that it may be due to the processor.
So, are there a ways to switch off these facilities like real-time error-checking? If not, what other IDEs for Java could you reccomend? (Apart from Eclipse)
Had the same problem using Visual Studio Code while using Android Studio along with an Android Simulator in the background, and I run 8GB RAM and a CPU of 3.2GHz but when I returned to Notepad++ (I know its suicidal), to check if it is my problem or because of the IDEs, I typed in real time.
It is due to your processor as Visual Studio Code is not really recommended for "slow" CPUs. Personally I like it, although an IDE in the likes of Vim might suit you better.
Here is a link that might give some more hints:
https://github.com/Microsoft/vscode/issues/38409
The easiest solution I found was to download and install Visual Studio Code Insiders. It's nearly identical except that it's known to lag less. Installing this will also clear any extensions or preferences you have enabled which might be causing the lag:
https://code.visualstudio.com/insiders/
You may also need to run it from the command line with the --disable-gpu flag
code-insiders --disable-gpu
or
/Applications/Visual\ Studio\ Code\ -\ Insiders.app/Contents/MacOS/Electron --disable-gpu
depending on your OS
Try the following steps:
Disable any unnecessary extensions.
Update to the stable version.
If this still hasn't worked, try reinstalling your Visual Studio Code instance.
Same for me, I often let the computer sleep instead of turn off and kill all processes so it was normal for me that the VS was open for a few days, the solution was to close visual studio and reopen it.
maybe its the computer performance issue. i am using a laptop.
yesterday i uninstall large program (MS SQl server)
now typing speed back to normal.
I've now had this problem a number of times. As a matter of fact I just had it right now.
What solves it for me is to
Close VS code
Unpin it from my taskbar
Pin it back
It works well after that.
Closing and reopening VS Code has never worked for me
Please disable Spring Boot Tools from Pivotal!!!
This extension doesn't work well with other Java extesions.(ie. Extesion pack for Java and Language support for Java)
After disabling it, I've seen significant speed increase with Intellisense, and CPU load reduced as a result. Please get rid of the thing!!!

(Bad) lagg on auto complete in Eclipse

Basically when I auto complete on Eclipse (By pressing CTRL+Space) the program laggs for about 5 seconds. This is getting really annoying because I use the auto complete alot. How do I fix this?
The workspace I'm working on is located on a NAS with a 1Gbit/s connection. Could this be causing it?
Thanks.
Check if problem exists with local resources too
Create a local workspace and open it with same eclipse instance. Now create a simple java project by new project wizard at your local machine inside this workapce and try code completion there. If it's still slow go to Step 2.
(by the way - I wouldn't store workspace information on remote side, but always local)
Check proposal kinds
If it's not a network issue and the problem still exists on a simple local workplace with local sources you should inspect your proposal setup as shown in next picture.Maybe one of the proposal kinds is slowing down your IDE. You can experiment with turning off proposal kinds sequential to find the problematic one.
System requirements
If you got stil the problem after doing Step 1-2 maybe your system has not enough power/memory to provide eclipse (but normally not the reason - I am using eclipse at Linux on an old T61 notebook with 4 GB Ram + SSD and it works fine!)

How to run some code as soon as Eclipse has started?

I'm developing an Eclipse plugin that needs to figure out the amount of time that it took for Eclipse to start.
I can get the amount of time since JVM startup in my plugin by using org.eclipse.ui.startup extension point and recording the time by using ManagementFactory.getRuntimeMXBean().getUptime() or eclipse.startTime system property.
However, during startup, Eclipse might ask the user for workspace location and this will be counted in the JVM startup time. As my plugin is trying to measure the non-user-interaction time, this makes the above approach rather useless (unless user has selected a default workspace location but there is no guarantee that this is the case).
Ideally, I would like to know the moment in time when user dismissed the "choose workspace" dialog (or, if user was using default workspace then equivalent moment). Or some other moment as close to that as possible.
I've done a bit of research and there does not seem to be any official extension point for such a thing.
I have a feeling that something like that might be possible with a custom OSGi bundle running at early enough start-level (2). However, I'm not sure if it will actually work:
maybe workspace selection dialog is shown from some Eclipse core plugin, started at start-level 4 like the rest of the plugins?
even if I manage to write such a bundle, do I need to modify Eclipse config.ini to list it there? Or how do I guarantee that it will be started at certain start-level (if it is not a real Eclipse plug-in but a custom bundle)? This article mentions p2.inf but my experiments with it have not been successful yet.
As I do not have much experience with OSGi and Eclipse plugin development, maybe I have missed something rather obvious and the solution is much simpler than what I envisioned?
UPDATE
After a bit more research, I found an early extension point: StartupMonitor service (usually used to customize the splash screen or provide some other sort of startup progress monitor, see here for more details). That could be a possible candidate for my needs, now I just need to figure out, how to make Eclipse aware of it (I suspect I need to add it in config.ini).
Another option I'm considering is to implement a JVM agent and instrument Eclipse IDEApplication class, adding some code snippets that I need. And then add that JVM agent in JVM arguments in eclipse.ini. Could actually be the easiest.
I took the JVM agent approach. Luckily P2 has ability to perform some extra actions via touchpoints -- I can use that to add the JVM agent option automatically at plugin install time and remove it when plugin is uninstalled.
Sample p2.inf file (goes inside META-INF):
instructions.install = \
addJvmArg(jvmArg:-javaagent:${artifact.location}/agent/my-agent.jar);
instructions.install.import = \
org.eclipse.equinox.p2.touchpoint.eclipse.addJvmArg, \
org.eclipse.equinox.p2.touchpoint.eclipse.removeJvmArg
instructions.uninstall = \
removeJvmArg(jvmArg:-javaagent:${artifact.location}/agent/my-agent.jar);
instructions.uninstall.import = \
org.eclipse.equinox.p2.touchpoint.eclipse.addJvmArg, \
org.eclipse.equinox.p2.touchpoint.eclipse.removeJvmArg
(above sample assumes that you have bundled your JVM agent inside the plugin, in agent subdirectory).

Performance measuring

I wanted to know if there is a way to measure the overhead of a specific function or even the running time of an application in Eclipse (with the capability to run the test for arbitrary times to get the average time).
I have a code that should be executed in Eclipse therefore looking for such a thing. I know that we have Jmeter in Netbeans and I'm looking for something similar in Eclipse.
Thanks
I have had good experiences with JProfiler. It should be precise enough to give usable data even when you run your function only once, depending on how you set it up. It also optionally integrates with Eclipse.
It's not free, but there's a fully functioning trial available.
I used Traceview before and it worked quite good to me.
It quite easy to use, just open the DDMS view in eclipse and look for the icon with three arrows with a red dot (Start Method Profiling). Click the icon and test your app as you want. When you are done click on stop. The trace should open in a new tab.
You could use the following
http://www.jvmmonitor.org/
It's called Java Monitor and comes as an eclipse plugin. You can install it from eclipse market place.

VLC dying when called from inside Java

I'm having a problem that, at this moment, I don't even know how to investigate properly. Any recommendations on how I can get more information are welcome and appreciated.
My company sells a product with a WinXP PC at its core. One of the product's tasks is being able to start a video player on demand -- VLC, in this case. (To be specific, VLC 0.8.6d; it's several years out of date, but upgrading is problematic for a few reasons.) The application responsible for starting the player and performing many, many other tasks is written in Java.
I have a test rig sitting next to my desk. It used to work just fine. But for some reason, it now gives a "Send Error Report" window when the Java app tries to start VLC: "VLC media player has encountered a problem and needs to close...." You know the one.
Clearly, I've done something that buggered things up. Problem is, I know neither what it could be nor how I would go about fixing it.
Stuff I know:
It's not a code bug. I run the same software on my development desktop machine, and it doesn't have this issue.
It's not the VLC install, nor is it a malformed video file. When I capture the command used to start it from Java and manually enter that command from a "cmd" window, it works fine.
It's not that sneaky bastich bug where Java punishes you if you don't manually drain STDERR and STDOUT when making a system call. I've got that covered.
I'm not getting any error messages or output when it fails; it just fails and gives me that pop-up window.
I'm stumped. Recommendations for either what it could be or how I can figure out what it is are very welcome.
Well, I’m not familiar with java and VLC, but I would do the following things:
Check that you have identical java virtual machines in both of your desktops. Just in case…
Check the process’s environment variables. They depend on parent process. Maybe VLC uses some of them.
Try to debug crashing with native debugger like WinDbg. Perhaps the call stack will give you more ideas.
Good luck!
My suggestions:
Create a simple java app that just launches VLC
Use your app to launch a simple command line windows program
Use your app to launch a complex program
Check to see if there is a memory constraint issue. Is VLC getting too little memory to run?
This really sounds like a memory/environment issue.
A number of things I would try
Make Sure both test and development machines are identical in every respect, the operating syste(if possible installed from same OS Disk), same JVM version, same memory allocation to JVM (you know those -X-ms stuffs). My fear is not with Java/JVM per se, it is with windows.
Make sure you can lunch for example Notepad from a Java app, and then something like Windows Media Player or MS Word.
Try and launch other versions of VLC to see if it is a VLC version problem.
Finally try and wipe the test box and re-install it(with Windows, you can never tell, a fresh installation might just do it!!)

Categories