Getting server usage information?

Discussion in 'Plugin Development' started by bc112354, Aug 3, 2015.

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

    bc112354

    I need to get server usage information. Is there a class or package in the API that could help me?
     
  2. Offline

    mythbusterma

  3. Offline

    Lammazz

    @bc112354 If you are talking about the server's memory or processing power you can use the Runtime class (this is a java class, can be used for any java program) by calling Runtime.getRuntime(). From there you can get the memory usage or available processing cores and a few other things that you can google if you are unsure about. For example if you want the free memory that your server has allocated you would do Runtime.getRuntime().freeMemory(); which would return an int if the free memory in BYTES. To convert from bytes to kb/mb/gb/tb you simply would divide it by 1024 as there are 1024 bytes in a kb and so on.
     
Thread Status:
Not open for further replies.

Share This Page