Guest User

Untitled

a guest
Jul 23rd, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. in misc.java
  2.  
  3. private static long Memory,Time;
  4. private static int BenchesMade =0;
  5. private static long TotalTime;
  6. public static void Benchmark(boolean start){
  7. if(start){
  8. Memory = Runtime.getRuntime().maxMemory() - Runtime.getRuntime().freeMemory();
  9. Time = System.nanoTime();
  10. } else {
  11. Long mem = (Runtime.getRuntime().maxMemory() - Runtime.getRuntime().freeMemory()) - Memory;
  12. Long time = (System.nanoTime() -Time);
  13. TotalTime = TotalTime+time;
  14. BenchesMade++;
  15. System.out.println("\n[==================== BenchMark ==================== ]");
  16. System.out.println("[Memory Usage] : "+mem+" ]");
  17. System.out.println("[Time Usage] : "+time+" nanoTime. ]");
  18. System.out.println("[Average Time] : "+TotalTime/BenchesMade+" ns. ]");
  19. System.out.println("[amount Of Benches] : "+BenchesMade+" times. ]");
  20. }
  21. }
  22.  
  23. then in player.java in procces
  24. something like this
  25.  
  26. if (attackingPlayer) {
  27. Misc.Benchmark(true);
  28. Engine.playerCombat.attackPlayer(this);
  29. Misc.Benchmark(false);
  30. }
Add Comment
Please, Sign In to add comment