Add cdp support for xpath scrapers (#625)

Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
This commit is contained in:
bnkai
2020-08-04 03:42:40 +03:00
committed by GitHub
parent 1b4a9eed36
commit 4373f9bf01
284 changed files with 133250 additions and 54 deletions

36
vendor/github.com/knq/sysutil/sysutil_linux.go generated vendored Normal file
View File

@@ -0,0 +1,36 @@
// +build linux
package sysutil
import (
"bytes"
"io/ioutil"
"strconv"
"time"
)
var (
btimePrefix = []byte("btime ")
lineEnd = []byte("\n")
)
func init() {
buf, err := ioutil.ReadFile("/proc/stat")
if err != nil {
btime = time.Now()
return
}
for _, line := range bytes.SplitN(buf, lineEnd, -1) {
if bytes.HasPrefix(line, btimePrefix) {
t, err := strconv.ParseInt(string(line[len(btimePrefix):]), 10, 64)
if err != nil {
btime = time.Now()
return
}
btime = time.Unix(t, 0)
break
}
}
}