Server CPU

Discussion in 'Spigot Plugin Development' started by Ring, May 27, 2017.

  1. Is it possible to return the CPU of the server?

    I found this:

    Not sure if that is of any use, or if I am doing it completely wrong.

    Attempted code:
    Code (Java):
    sender.sendMessage(color(c2 + "Server CPU" + c1 + ": " + c3 + System.getProperty("os.arch.variant")));
    I want it to return for example "Intel Xeon E5-1650v3"

    Return value:

    I get no errors in console or in-game. =P

    If you want my full code, just reply, I don't believe it's needed though.
    #1 Ring, May 27, 2017
    Last edited: May 27, 2017
  2. Yes it is possible,
    i would recommend using the operatingsystem

    Code (Text):

      OperatingSystemMXBean operatingSystemMXBean = ManagementFactory.getOperatingSystemMXBean();
      -> operatingSystemMXBean.getProcessCpuLoad();

  3. getProcessCpuLoad() isn't a method, couldn't find it. =P