Update.
This commit is contained in:
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
// retoor <retoor@molodetz.nl>
|
||||
|
||||
import "sysinfo" for SysInfo
|
||||
|
||||
var count = SysInfo.cpuCount
|
||||
System.print(count is Num) // expect: true
|
||||
System.print(count > 0) // expect: true
|
||||
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
// retoor <retoor@molodetz.nl>
|
||||
|
||||
import "sysinfo" for SysInfo
|
||||
|
||||
var cpus = SysInfo.cpuInfo
|
||||
System.print(cpus is List) // expect: true
|
||||
System.print(cpus.count > 0) // expect: true
|
||||
|
||||
var cpu = cpus[0]
|
||||
System.print(cpu is Map) // expect: true
|
||||
System.print(cpu.containsKey("model")) // expect: true
|
||||
System.print(cpu.containsKey("speed")) // expect: true
|
||||
System.print(cpu.containsKey("times")) // expect: true
|
||||
|
||||
var times = cpu["times"]
|
||||
System.print(times is Map) // expect: true
|
||||
System.print(times.containsKey("user")) // expect: true
|
||||
System.print(times.containsKey("sys")) // expect: true
|
||||
System.print(times.containsKey("idle")) // expect: true
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
// retoor <retoor@molodetz.nl>
|
||||
|
||||
import "sysinfo" for SysInfo
|
||||
|
||||
var hostname = SysInfo.hostname
|
||||
System.print(hostname is String) // expect: true
|
||||
System.print(hostname.count > 0) // expect: true
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
// retoor <retoor@molodetz.nl>
|
||||
|
||||
import "sysinfo" for SysInfo
|
||||
|
||||
var t1 = SysInfo.hrtime
|
||||
var t2 = SysInfo.hrtime
|
||||
System.print(t1 is Num) // expect: true
|
||||
System.print(t2 is Num) // expect: true
|
||||
System.print(t2 >= t1) // expect: true
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
// retoor <retoor@molodetz.nl>
|
||||
|
||||
import "sysinfo" for SysInfo
|
||||
|
||||
var load = SysInfo.loadAverage
|
||||
System.print(load is List) // expect: true
|
||||
System.print(load.count) // expect: 3
|
||||
System.print(load[0] is Num) // expect: true
|
||||
System.print(load[1] is Num) // expect: true
|
||||
System.print(load[2] is Num) // expect: true
|
||||
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
// retoor <retoor@molodetz.nl>
|
||||
|
||||
import "sysinfo" for SysInfo
|
||||
|
||||
var total = SysInfo.totalMemory
|
||||
var free = SysInfo.freeMemory
|
||||
var resident = SysInfo.residentMemory
|
||||
|
||||
System.print(total is Num) // expect: true
|
||||
System.print(free is Num) // expect: true
|
||||
System.print(resident is Num) // expect: true
|
||||
|
||||
System.print(total > 0) // expect: true
|
||||
System.print(free > 0) // expect: true
|
||||
System.print(resident > 0) // expect: true
|
||||
System.print(total >= free) // expect: true
|
||||
Vendored
+23
@@ -0,0 +1,23 @@
|
||||
// retoor <retoor@molodetz.nl>
|
||||
|
||||
import "sysinfo" for SysInfo
|
||||
|
||||
var interfaces = SysInfo.networkInterfaces
|
||||
System.print(interfaces is Map) // expect: true
|
||||
System.print(interfaces.count > 0) // expect: true
|
||||
|
||||
for (name in interfaces.keys) {
|
||||
var addrs = interfaces[name]
|
||||
System.print(addrs is List) // expect: true
|
||||
|
||||
for (addr in addrs) {
|
||||
System.print(addr is Map) // expect: true
|
||||
System.print(addr.containsKey("family")) // expect: true
|
||||
System.print(addr.containsKey("address")) // expect: true
|
||||
System.print(addr.containsKey("internal")) // expect: true
|
||||
System.print(addr.containsKey("netmask")) // expect: true
|
||||
System.print(addr.containsKey("mac")) // expect: true
|
||||
break
|
||||
}
|
||||
break
|
||||
}
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
// retoor <retoor@molodetz.nl>
|
||||
|
||||
import "sysinfo" for SysInfo
|
||||
|
||||
var uptime = SysInfo.uptime
|
||||
System.print(uptime is Num) // expect: true
|
||||
System.print(uptime > 0) // expect: true
|
||||
Reference in New Issue
Block a user