ergo-services / ergo

An actor-based Framework with network transparency for creating event-driven architecture in Golang. Inspired by Erlang. Zero dependencies.
https://docs.ergo.services
MIT License
3.51k stars 138 forks source link

add freebsd getrusage(2) syscall #72

Closed dch closed 2 years ago

dch commented 3 years ago

see getrusage(2) & tested on both amd64 and arm64.

FWIW some tests, all without SMT, on various FreeBSD versions & hardware.

$ sysctl hw.model
hw.model: Intel(R) Xeon(R) CPU E5-2667 v4 @ 3.20GHz
$ go test -bench=NodeSequential -run=100 -benchtime=10s
goos: freebsd
goarch: amd64
pkg: github.com/halturin/ergo
cpu: Intel(R) Xeon(R) CPU E5-2667 v4 @ 3.20GHz
BenchmarkNodeSequential/number-8        
  250360        117424 ns/op
BenchmarkNodeSequential/string-8          121123        110564 ns/op
BenchmarkNodeSequential/tuple_(PID)-8     189829        122262 ns/op
BenchmarkNodeSequential/binary_1MB-8        1716       7349980 ns/op
BenchmarkNodeSequentialSingleNode/number-8            752913         21122 ns/op
BenchmarkNodeSequentialSingleNode/string-8            561376         20437 ns/op
BenchmarkNodeSequentialSingleNode/tuple_(PID)-8       607036         20287 ns/op
BenchmarkNodeSequentialSingleNode/binary_1MB-8        559360         21223 ns/op
PASS
$ sysctl hw.model
hw.model: ARM Neoverse-N1 r3p1
$ go test -bench=NodeSequential -run=100 -benchtime=10s

goos: freebsd
goarch: arm64
pkg: github.com/halturin/ergo
BenchmarkNodeSequential/number-2          134977             84636 ns/op
BenchmarkNodeSequential/string-2          142143             84559 ns/op
BenchmarkNodeSequential/tuple_(PID)-2     136266             92182 ns/op
BenchmarkNodeSequential/binary_1MB-2        4213           2811246 ns/op
BenchmarkNodeSequentialSingleNode/number-2               1448876              8257 ns/op
BenchmarkNodeSequentialSingleNode/string-2               1452616              8232 ns/op
BenchmarkNodeSequentialSingleNode/tuple_(PID)-2          1463661             13837 ns/op
BenchmarkNodeSequentialSingleNode/binary_1MB-2           1476330              8179 ns/op
PASS
ok      github.com/halturin/ergo        148.172s
$ sysctl hw.model
hw.model: APM eMAG 8180 r3p2
$ go test -bench=NodeSequential -run=100 -benchtime=10s

goos: freebsd
goarch: arm64
pkg: github.com/halturin/ergo
BenchmarkNodeSequential/number-32                  77108            153407 ns/op
BenchmarkNodeSequential/string-32                  78672            153402 ns/op
BenchmarkNodeSequential/tuple_(PID)-32             75832            157856 ns/op
BenchmarkNodeSequential/binary_1MB-32               3616           3112661 ns/op
BenchmarkNodeSequentialSingleNode/number-32               718996             16724 ns/op
BenchmarkNodeSequentialSingleNode/string-32               720394             16715 ns/op
BenchmarkNodeSequentialSingleNode/tuple_(PID)-32          727790             16730 ns/op
BenchmarkNodeSequentialSingleNode/binary_1MB-32           717544             16696 ns/op
PASS
ok      github.com/halturin/ergo        101.136s                                                                                                                                                                                                                          
$ sysctl hw.model
hw.model: APM eMAG 8180 r3p2
$ go test -bench=NodeSequential -run=100 -benchtime=10s

goos: freebsd
goarch: arm64
pkg: github.com/halturin/ergo
BenchmarkNodeSequential/number-32                  77108            153407 ns/op
BenchmarkNodeSequential/string-32                  78672            153402 ns/op
BenchmarkNodeSequential/tuple_(PID)-32             75832            157856 ns/op
BenchmarkNodeSequential/binary_1MB-32               3616           3112661 ns/op
BenchmarkNodeSequentialSingleNode/number-32               718996             16724 ns/op
BenchmarkNodeSequentialSingleNode/string-32               720394             16715 ns/op
BenchmarkNodeSequentialSingleNode/tuple_(PID)-32          727790             16730 ns/op
BenchmarkNodeSequentialSingleNode/binary_1MB-32           717544             16696 ns/op
PASS
ok      github.com/halturin/ergo        101.136s                                                                                                                                                                                                                          
CLAassistant commented 3 years ago

CLA assistant check
All committers have signed the CLA.

dch commented 3 years ago

BTW seems #46 is a simpler solution with better coverage

halturin commented 3 years ago

I've already added bsd-family support in the otp2324 branch.

https://github.com/halturin/ergo/blob/otp2324/bsd.go

you may adjust this PR to these changes so I can merge it.

halturin commented 2 years ago

just released 2.0.0 with the BSD family support