fixed window build error. bump 1.4.1

This commit is contained in:
Josh Baker 2016-08-26 14:18:35 -07:00
parent 0cf5fabfa5
commit 53e3326d75
5 changed files with 46 additions and 19 deletions

View File

@ -5,7 +5,7 @@
</p>
<p align="center">
<a href="https://travis-ci.org/tidwall/tile38"><img src="https://travis-ci.org/tidwall/tile38.svg?branch=master" alt="Build Status"></a>
<a href="https://github.com/tidwall/tile38/releases"><img src="https://img.shields.io/badge/version-1.4.0-green.svg" alt="Version"></a>
<a href="https://github.com/tidwall/tile38/releases"><img src="https://img.shields.io/badge/version-1.4.1-green.svg" alt="Version"></a>
</p>
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.

View File

@ -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

View File

@ -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")
}

18
controller/stats_cpu.go Normal file
View File

@ -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,
)
}

View File

@ -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),
)
}