Skip to content

Commit

Permalink
new lxrhash and some failure detection
Browse files Browse the repository at this point in the history
  • Loading branch information
WhoSoup committed Jul 31, 2019
1 parent 22c497a commit 86a551d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*.dll
*.so
*.dylib
*.txt

# Test binary, build with `go test -c`
*.test
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.12
require (
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect
github.com/go-ole/go-ole v1.2.4 // indirect
github.com/pegnet/LXRHash v0.0.0-20190726144200-a35b17bbf85c
github.com/pegnet/LXRHash v0.0.0-20190729193922-452b32b2d231
github.com/shirou/gopsutil v2.18.12+incompatible
github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4 // indirect
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNI
github.com/pegnet/LXR256 v0.0.0-20190721001507-5e925f415fa2/go.mod h1:11Z6s/PoxMH3ON6Kh+2MxNFdaq9op2sgvIAqg52d/3I=
github.com/pegnet/LXRHash v0.0.0-20190726144200-a35b17bbf85c h1:/3H7wWMIg/X/vvnkaVL48HrEm9WbTW/H/mFr8bKVeAI=
github.com/pegnet/LXRHash v0.0.0-20190726144200-a35b17bbf85c/go.mod h1:0zBp9GFy9F77zuQbPkAmdUBRiptMaJ1V96eVFdMnXZA=
github.com/pegnet/LXRHash v0.0.0-20190729193922-452b32b2d231 h1:/kqjIK3ufejdrpUwWdk0hdALErfY/37uEffjFE5Pa0Q=
github.com/pegnet/LXRHash v0.0.0-20190729193922-452b32b2d231/go.mod h1:0zBp9GFy9F77zuQbPkAmdUBRiptMaJ1V96eVFdMnXZA=
github.com/pegnet/OracleRecord v0.0.2/go.mod h1:VrY7Shn4oSCli47CsUYBFjH68IenGYtnLaXaaivepu4=
github.com/pegnet/pegnet v0.0.2/go.mod h1:FUyEs8fyLOzPXZgyqXcqiOhQi58loNtujykIbxxoKbQ=
github.com/shirou/gopsutil v2.18.12+incompatible h1:1eaJvGomDnH74/5cF4CTmTbLHAriGFsTZppLXDX93OM=
Expand Down
13 changes: 12 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package main

import (
"context"
"fmt"
"os"
"runtime"
"time"

Expand Down Expand Up @@ -82,7 +84,16 @@ func main() {
opr = lx.Hash([]byte("foo"))

fmt.Printf("%10s = %x, %d, %d, %d\n", "Hash Init", lxr.Seed, lxr.MapSizeBits, lxr.HashSize, lxr.Passes)
c, _ := cpu.Info()
ctx := context.Background()
to, cancel := context.WithTimeout(ctx, time.Second*3)
defer cancel()
c, err := cpu.InfoWithContext(to)
if err != nil {
fmt.Println("There was an error querying the CPU info. Please try again.")
fmt.Println(err)
os.Exit(1)
}

fmt.Printf("%10s = %s\n", "CPU", c[0].ModelName)
cores := runtime.NumCPU()
fmt.Printf("%10s = %d\n", "Cores", cores)
Expand Down

0 comments on commit 86a551d

Please sign in to comment.