W3cubDocs

/Crystal 0.31

module System

Defined in:

system.cr

Class Method Summary

  • .cpu_count

    Returns the number of logical processors available to the system.

  • .hostname

    Returns the hostname.

Class Method Detail

def self.cpu_countSource

Returns the number of logical processors available to the system.

System.cpu_count # => 4

def self.hostnameSource

Returns the hostname.

NOTE Maximum of 253 characters are allowed, with 2 bytes reserved for storage. In practice, many platforms will disallow anything longer than 63 characters.

System.hostname # => "host.example.org"

© 2012–2019 Manas Technology Solutions.
Licensed under the Apache License, Version 2.0.
https://crystal-lang.org/api/0.31.1/System.html