Table of Content
- What is Profiling
- Reason to profile
- When to profile
- Download Java JDK
- Start JVisualVM
What is Profiling
Profiling is analysis and measuring for example the memory or time complexity of a program, the usage of particular instructions, or frequency and duration of function calls. The most common use of profiling information is to aid program optimization.
Sounds troublesome, why doing it?
Often Modders don't have time to test their application as extensivly or have the possibilities to do. Unexpected behaviours can occur because of special mod compositions or configs, the server chose.
By profiling your data and sharing it with the modder, he can pinpoint possible problems within his code and thus help him make a better and more lag-free Mod.
Nice! I want to help, what do I need?
To profile you need a profiler (dun dun). There are some mods out there which help you like TickProfiler but they only indicate problems, but do not deliver extensive information for the modder himself. The tool generally used to profile Java Applications is JVisualVM.
When to profile?
When you notice your TicksPerSeconds (TPS) drop or Lag which is unrelated to your FramePerSecond (FPS) then you can do a profile to see what is the culprit. It is important to profile the moment when it is lagging.
Where do I get it?
Since Java 6 the profiler is part of the Java Development Kit (JDK) and needs it to run. If you have already downloaded and installed the JDK you can continue to the next step.
Open the Oracle Download Page and scroll down to the download links
You need to accep the Liencse Agreement to be able to download any file. Choose the JDK needed for your Operating System. Most popular will be Windows, Linux and Mac. x64 indicates that this software is written for 64-Bit CPUs. If you have a 64-Bit processor then download for example the file noted with Windows x64 else choose the Windows x86 for a 32-Bit System. JDK ships with JRE, so by installing the JDK you don't need to install the JRE too. Follow the provided installation instruction by the installer.
Go to your JDK Installation Folder (e.g. C:/Programs/JDK 7) and search for a bin folder. Within this folder you should find a jvisualvm(.exe for Windows). When starting up for the first time you get notified that JVisualVM needs to be calibrated and you should close all performance draining application.
- Open up Minecraft
- You will notice a new application appeared in your JVisualVM
- Double-click to open the minecraft launcher
- Go to tab Sampler
- Press the CPU button whenever you think you can reproduce the lag spikes and profile it as long as you can. The longer the time you profile the better results can be, because it will contain less fluctuation and abnormalities. You will see some fancy action going on. After some time hit the Snapshot Button. Notice the profile will not stop by snapshotting it.
- In the new opened snapshot tab press the 2. of the 3 Disk Icon labeled with Export to...
- Choose an appropriate file name and save it to a location of your liking with the extension *.nps. This file can be opened again with JVisualVM so AlgorithmX2 can look at it.
Now I have this pretty file, what to do with it?
If you can assure it is AppliedEnergistic related file an issue in our Tracker or send it to AlgorithmX2 in his IRC channel #AppliedEnergistics on Espernet. Please be patient, but I can assure he read every profile so far and it helped improving the mod so far by a great deal.
- Applied Energistics Bug Tracker
- Nallar's TickProfiler
- Official JVisualVM Download
- Oracle Java JDK Download
|Page last modified on 10/23/2013 02:08 PM CDT