Solved is there a possible way too...

Discussion in 'Plugin Development' started by AKS JEFFREY, May 15, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    AKS JEFFREY

    So can i find the cpu usage and ram usage of the computer and then log that to the cmd. with
    Code:java
    1. getLogger().info("");
    . I've tried doing a google search but it there not using the bukkit api so i don't know how to send that data via
    Code:java
    1. getLogger().info("iEmotions has been disabled!");
     
  2. Offline

    RainoBoy97

  3. Offline

    AKS JEFFREY

    silly question just trying to be sure would System.out.println(" "); print it to the log?
    RainoBoy97
     
  4. Offline

    RainoBoy97

  5. Offline

    AKS JEFFREY

  6. Offline

    mine-care

    well not sure for that but i can figure runtime... on it...
     
  7. Offline

    metalhedd


    It will, but it's not the right way to do it. use the logger. just like your example in your first post
     
  8. Offline

    AKS JEFFREY

    metalhedd mine-care RainoBoy97 whats a good plugin name for um a plugin that shows the server owner how much ram is being used, cpu usage and ext

    *ect

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 8, 2016
  9. Offline

    RainoBoy97

  10. Offline

    metalhedd

  11. Offline

    mine-care

    Call it "ServerRecources" or "Recource manager"
     
  12. Offline

    AKS JEFFREY

  13. Offline

    metalhedd

    but spell it correctly. it's Resource, not Recource


    You need to stop asking every single little question that pops into your mind. write some code, make an effort to acheive your goals before you come asking, its much more rewarding.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 8, 2016
  14. Offline

    AKS JEFFREY

  15. Offline

    mine-care

    PS for your runtime thingy's
    here:
    Code:java
    1. long ram = Runtime.getRuntime().freeMemory();
    2. int process = Runtime.getRuntime().availableProcessors();
    3. long as = Runtime.getRuntime().totalMemory();


    EDIT:
    for repeat use a sheduler! (SheduleAsyncRepeatingTask) set it to repeat every 5mins (1 second is 20 ticks) that i belive makes 6000ticks for 5 mins.
    Also i am starting a conversation to ask if u need help with anything :D i will reply as soon as posible instead of writing in forrums
    metalhedd
     
  16. Offline

    AKS JEFFREY

    mine-care I'm using this
    Code:java
    1. public static void main(String[] args) {
    2. /* Total number of processors or cores available to the JVM */
    3.  
    4. System.out.println("Available processors (cores): " +
    5. Runtime.getRuntime().availableProcessors());
    6.  
    7. /* Total amount of free memory available to the JVM */
    8. System.out.println("Free memory (bytes): " +
    9. Runtime.getRuntime().freeMemory());
    10.  
    11. /* This will return Long.MAX_VALUE if there is no preset limit */
    12. long maxMemory = Runtime.getRuntime().maxMemory();
    13. /* Maximum amount of memory the JVM will attempt to use */
    14. System.out.println("Maximum memory (bytes): " +
    15. (maxMemory == Long.MAX_VALUE ? "no limit" : maxMemory));
    16.  
    17. /* Total memory currently available to the JVM */
    18. System.out.println("Total memory available to JVM (bytes): " +
    19. Runtime.getRuntime().totalMemory());
    20.  
    21. /* Get a list of all filesystem roots on this system */
    22. File[] roots = File.listRoots();
    23.  
    24. /* For each filesystem root, print some info */
    25. for (File root : roots) {
    26. System.out.println("File system root: " + root.getAbsolutePath());
    27. System.out.println("Total space (bytes): " + root.getTotalSpace());
    28. System.out.println("Free space (bytes): " + root.getFreeSpace());
    29. System.out.println("Usable space (bytes): " + root.getUsableSpace());
    30. }
    31.  
     
  17. Offline

    mine-care

    Ye i didnt knew u uhad one :S
    sorry
     
Thread Status:
Not open for further replies.

Share This Page