diff --git a/README.md b/README.md index e38cb34d..efb4c97e 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@
Tile38 is an open source (MIT licensed), in-memory geolocation data store, spatial index, and realtime geofence. It supports a variety of object types including lat/lon points, bounding boxes, XYZ tiles, Geohashes, and GeoJSON. diff --git a/build.sh b/build.sh index 47b4a9c7..78daa8cb 100755 --- a/build.sh +++ b/build.sh @@ -1,7 +1,7 @@ #!/bin/bash set -e -VERSION="1.3.0" +VERSION="1.4.1" PROTECTED_MODE="no" # Hardcode some values to the core package diff --git a/controller/stats.go b/controller/stats.go index 7e808f42..d20df309 100644 --- a/controller/stats.go +++ b/controller/stats.go @@ -7,7 +7,6 @@ import ( "runtime" "sort" "strings" - "syscall" "time" "github.com/tidwall/btree" @@ -169,22 +168,6 @@ func (c *Controller) writeInfoStats(w *bytes.Buffer) { func (c *Controller) writeInfoReplication(w *bytes.Buffer) { fmt.Fprintf(w, "connected_slaves:%d\r\n", len(c.aofconnM)) // Number of connected slaves } -func (c *Controller) writeInfoCPU(w *bytes.Buffer) { - var selfRu syscall.Rusage - var cRu syscall.Rusage - syscall.Getrusage(syscall.RUSAGE_SELF, &selfRu) - syscall.Getrusage(syscall.RUSAGE_CHILDREN, &cRu) - fmt.Fprintf(w, - "used_cpu_sys:%.2f\r\n"+ - "used_cpu_user:%.2f\r\n"+ - "used_cpu_sys_children:%.2f\r\n"+ - "used_cpu_user_children:%.2f\r\n", - float64(selfRu.Stime.Sec)+float64(selfRu.Stime.Usec/1000000), - float64(selfRu.Utime.Sec)+float64(selfRu.Utime.Usec/1000000), - float64(cRu.Stime.Sec)+float64(cRu.Stime.Usec/1000000), - float64(cRu.Utime.Sec)+float64(cRu.Utime.Usec/1000000), - ) -} func (c *Controller) writeInfoCluster(w *bytes.Buffer) { fmt.Fprintf(w, "cluster_enabled:0\r\n") } diff --git a/controller/stats_cpu.go b/controller/stats_cpu.go new file mode 100644 index 00000000..a839aea8 --- /dev/null +++ b/controller/stats_cpu.go @@ -0,0 +1,18 @@ +// +build !linux,!darwin + +package controller + +import ( + "bytes" + "fmt" +) + +func (c *Controller) writeInfoCPU(w *bytes.Buffer) { + fmt.Fprintf(w, + "used_cpu_sys:%.2f\r\n"+ + "used_cpu_user:%.2f\r\n"+ + "used_cpu_sys_children:%.2f\r\n"+ + "used_cpu_user_children:%.2f\r\n", + 0, 0, 0, 0, + ) +} diff --git a/controller/stats_cpu_darlin.go b/controller/stats_cpu_darlin.go new file mode 100644 index 00000000..00e7cb4c --- /dev/null +++ b/controller/stats_cpu_darlin.go @@ -0,0 +1,26 @@ +// +build linux darwin + +package controller + +import ( + "bytes" + "fmt" + "syscall" +) + +func (c *Controller) writeInfoCPU(w *bytes.Buffer) { + var selfRu syscall.Rusage + var cRu syscall.Rusage + syscall.Getrusage(syscall.RUSAGE_SELF, &selfRu) + syscall.Getrusage(syscall.RUSAGE_CHILDREN, &cRu) + fmt.Fprintf(w, + "used_cpu_sys:%.2f\r\n"+ + "used_cpu_user:%.2f\r\n"+ + "used_cpu_sys_children:%.2f\r\n"+ + "used_cpu_user_children:%.2f\r\n", + float64(selfRu.Stime.Sec)+float64(selfRu.Stime.Usec/1000000), + float64(selfRu.Utime.Sec)+float64(selfRu.Utime.Usec/1000000), + float64(cRu.Stime.Sec)+float64(cRu.Stime.Usec/1000000), + float64(cRu.Utime.Sec)+float64(cRu.Utime.Usec/1000000), + ) +}