Commit Graph

7 Commits

Author SHA1 Message Date
Tevin Zhang f79f8fc471 Add comment 2019-02-13 10:20:15 +08:00
Tevin Zhang b0f2b6a708 Add benchmarks
go version go1.11.4 linux/amd64

goos: linux
goarch: amd64
pkg: github.com/tevino/tcp-shaker
BenchmarkPipePoolDummyOK-32              	  300000	      4002 ns/op	     660 B/op	      16 allocs/op
BenchmarkPipePoolSyncPoolOK-32           	  300000	      3955 ns/op	     507 B/op	      14 allocs/op
BenchmarkPipePoolDummyErr-32             	  300000	      4026 ns/op	     613 B/op	      16 allocs/op
BenchmarkPipePoolSyncPoolErr-32          	  300000	      3973 ns/op	     526 B/op	      14 allocs/op
BenchmarkPipePoolDummyTimeout-32         	  300000	      3954 ns/op	     613 B/op	      16 allocs/op
BenchmarkPipePoolSyncPoolTimeout-32      	  300000	      3895 ns/op	     507 B/op	      14 allocs/op
BenchmarkResultPipesMUOK-32              	  300000	      4692 ns/op	     478 B/op	      12 allocs/op
BenchmarkResultPipesSyncMapOK-32         	  300000	      3902 ns/op	     506 B/op	      14 allocs/op
BenchmarkResultPipesMUErr-32             	  300000	      4399 ns/op	     478 B/op	      12 allocs/op
BenchmarkResultPipesSyncMapErr-32        	  300000	      3993 ns/op	     508 B/op	      14 allocs/op
BenchmarkResultPipesMUTimeout-32         	  300000	      4473 ns/op	     478 B/op	      12 allocs/op
BenchmarkResultPipesSyncMapTimeout-32    	  300000	      3947 ns/op	     507 B/op	      14 allocs/op
2019-02-12 19:03:06 +08:00
Tevin Zhang 8e82d76788 Ensure safety before reuse of pipe 2019-02-12 15:22:22 +08:00
Tevin Zhang 201333fdee Remove lock 2019-02-12 15:22:22 +08:00
Tevin Zhang 7c5283d607 Refine doc 2019-02-11 18:42:46 +08:00
Tevin Zhang a89fc1fe18 Refactor
Significant changes:

1. `NewChecker()` accepts no argument, `zeroLinger` is enabled by default
2. Optional parameter `zeroLinger` in `CheckAddr()` turned into `CheckerAddrZeroLinger()`
3. `InitChecker()` -> `CheckingLoop(context)`
4. `ErrNotInitialized` -> `ErrCheckerAlreadyStarted`
5. Fewer system call calling, e.g. `connect()` is called exactly once per check
6. Epoll is now edge-triggered
2019-02-11 17:54:51 +08:00
Tevin Zhang ce742af518 Add fake implementation for non-Linux platform 2016-12-06 17:20:41 +08:00