Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- in misc.java
- private static long Memory,Time;
- private static int BenchesMade =0;
- private static long TotalTime;
- public static void Benchmark(boolean start){
- if(start){
- Memory = Runtime.getRuntime().maxMemory() - Runtime.getRuntime().freeMemory();
- Time = System.nanoTime();
- } else {
- Long mem = (Runtime.getRuntime().maxMemory() - Runtime.getRuntime().freeMemory()) - Memory;
- Long time = (System.nanoTime() -Time);
- TotalTime = TotalTime+time;
- BenchesMade++;
- System.out.println("\n[==================== BenchMark ==================== ]");
- System.out.println("[Memory Usage] : "+mem+" ]");
- System.out.println("[Time Usage] : "+time+" nanoTime. ]");
- System.out.println("[Average Time] : "+TotalTime/BenchesMade+" ns. ]");
- System.out.println("[amount Of Benches] : "+BenchesMade+" times. ]");
- }
- }
- then in player.java in procces
- something like this
- if (attackingPlayer) {
- Misc.Benchmark(true);
- Engine.playerCombat.attackPlayer(this);
- Misc.Benchmark(false);
- }
Add Comment
Please, Sign In to add comment