This commit is contained in:
number571 2023-07-12 22:12:48 +07:00
parent 16662b08fb
commit a488db2dbf
14 changed files with 1406 additions and 1195 deletions

View File

@ -14,10 +14,9 @@ PPROF_PORT=_
default: clean test-run
clean:
make -C ./cmd/hidden_lake clean
make -C ./cmd clean
make -C ./examples clean
### TEST
# example run: make test-run N=10
# for i in {1..100}; do echo $i; go test -count=1 ./...; done;
@ -31,9 +30,6 @@ test-run:
done; \
echo "Build took $$(($$(date +%s)-d)) seconds";
test-race:
go test -race -cover -count=1 `go list ./...`; \
test-coverage:
go vet ./...;
$(CHECK_ERROR);
@ -42,23 +38,9 @@ test-coverage:
$(CHECK_ERROR);
go test -race -cover -count=1 `go list ./...` | tee $(TEST_PATH)/result.out;
$(CHECK_ERROR);
test-coverage-view:
go tool cover -html=$(TEST_PATH)/coverage.out
$(CHECK_ERROR);
test-benchmark:
# TODO
### PPROF
# example run: make pprof-run PPROF_NAME=hls PPROF_PORT=62109
pprof-run:
go tool pprof -png -output $(PPROF_PATH)/$(PPROF_NAME)/profile.png http://localhost:$(PPROF_PORT)/debug/pprof/profile
go tool pprof -png -output $(PPROF_PATH)/$(PPROF_NAME)/heap.png http://localhost:$(PPROF_PORT)/debug/pprof/heap
go tool pprof -png -output $(PPROF_PATH)/$(PPROF_NAME)/goroutine.png http://localhost:$(PPROF_PORT)/debug/pprof/goroutine
### GIT
@ -69,3 +51,11 @@ git-status:
git-push:
git commit -m "update"
git push
### PPROF
# example run: make pprof-run PPROF_NAME=hls PPROF_PORT=62109
pprof-run:
go tool pprof -png -output $(PPROF_PATH)/$(PPROF_NAME)/profile.png http://localhost:$(PPROF_PORT)/debug/pprof/profile
go tool pprof -png -output $(PPROF_PATH)/$(PPROF_NAME)/heap.png http://localhost:$(PPROF_PORT)/debug/pprof/heap
go tool pprof -png -output $(PPROF_PATH)/$(PPROF_NAME)/goroutine.png http://localhost:$(PPROF_PORT)/debug/pprof/goroutine

View File

@ -3,7 +3,10 @@ package pprof
import "time"
const (
cPProfEnabled = false
cRetriesNum = 3
cWaitTime = time.Second
cPProfEnabled = true
)
const (
cRetriesNum = 3
cWaitTime = time.Second
)

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 KiB

BIN
test/pprof/hlm/heap.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 KiB

BIN
test/pprof/hlm/profile.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 312 KiB

After

Width:  |  Height:  |  Size: 305 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 287 KiB

After

Width:  |  Height:  |  Size: 387 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 833 KiB

After

Width:  |  Height:  |  Size: 830 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 281 KiB

BIN
test/pprof/hlt/heap.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 609 KiB

BIN
test/pprof/hlt/profile.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 868 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 77 KiB

View File

@ -1,58 +1,68 @@
ok github.com/number571/go-peer/cmd/hidden_lake/adapters/common 0.028s coverage: [no statements]
ok github.com/number571/go-peer/cmd/hidden_lake/adapters/common/recv 0.025s coverage: 0.0% of statements
ok github.com/number571/go-peer/cmd/hidden_lake/adapters/common/send 0.032s coverage: 0.0% of statements
ok github.com/number571/go-peer/cmd/hidden_lake/adapters/common/service 0.028s coverage: 0.0% of statements
ok github.com/number571/go-peer/cmd/hidden_lake/messenger/cmd/hlm 0.028s coverage: 0.0% of statements
ok github.com/number571/go-peer/cmd/hidden_lake/messenger/internal/app 0.027s coverage: 0.0% of statements
ok github.com/number571/go-peer/cmd/hidden_lake/messenger/internal/app/state 0.036s coverage: 0.0% of statements
ok github.com/number571/go-peer/cmd/hidden_lake/messenger/internal/chat_queue 0.033s coverage: 0.0% of statements
ok github.com/number571/go-peer/cmd/hidden_lake/messenger/internal/config 0.027s coverage: 60.0% of statements
ok github.com/number571/go-peer/cmd/hidden_lake/messenger/internal/database 0.037s coverage: 0.0% of statements
ok github.com/number571/go-peer/cmd/hidden_lake/messenger/internal/handler 0.053s coverage: 0.0% of statements
ok github.com/number571/go-peer/cmd/hidden_lake/messenger/internal/settings 0.052s coverage: [no statements]
ok github.com/number571/go-peer/cmd/hidden_lake/messenger/pkg/settings 0.064s coverage: [no statements]
ok github.com/number571/go-peer/cmd/hidden_lake/messenger/web 0.058s coverage: 0.0% of statements
ok github.com/number571/go-peer/cmd/hidden_lake/adapters/common/recv 0.026s coverage: 0.0% of statements
ok github.com/number571/go-peer/cmd/hidden_lake/adapters/common/send 0.026s coverage: 0.0% of statements
ok github.com/number571/go-peer/cmd/hidden_lake/adapters/common/service 0.026s coverage: 0.0% of statements
ok github.com/number571/go-peer/cmd/hidden_lake/messenger/cmd/hlm 0.054s coverage: 0.0% of statements
ok github.com/number571/go-peer/cmd/hidden_lake/messenger/internal/app 0.048s coverage: 0.0% of statements
ok github.com/number571/go-peer/cmd/hidden_lake/messenger/internal/app/state 0.068s coverage: 0.0% of statements
ok github.com/number571/go-peer/cmd/hidden_lake/messenger/internal/chat_queue 0.062s coverage: 0.0% of statements
ok github.com/number571/go-peer/cmd/hidden_lake/messenger/internal/config 0.069s coverage: 60.0% of statements
ok github.com/number571/go-peer/cmd/hidden_lake/messenger/internal/database 0.068s coverage: 0.0% of statements
ok github.com/number571/go-peer/cmd/hidden_lake/messenger/internal/handler 0.040s coverage: 0.0% of statements
ok github.com/number571/go-peer/cmd/hidden_lake/messenger/internal/settings 0.040s coverage: [no statements]
ok github.com/number571/go-peer/cmd/hidden_lake/messenger/pkg/settings 0.050s coverage: [no statements]
ok github.com/number571/go-peer/cmd/hidden_lake/messenger/web 0.042s coverage: 0.0% of statements
ok github.com/number571/go-peer/cmd/hidden_lake/service/cmd/hls 0.051s coverage: 0.0% of statements
ok github.com/number571/go-peer/cmd/hidden_lake/service/internal/handler 7.763s coverage: 63.5% of statements
ok github.com/number571/go-peer/cmd/hidden_lake/service/pkg/app 6.906s coverage: 76.1% of statements
ok github.com/number571/go-peer/cmd/hidden_lake/service/pkg/client 0.042s coverage: 0.0% of statements
ok github.com/number571/go-peer/cmd/hidden_lake/service/pkg/config 0.048s coverage: 51.6% of statements
ok github.com/number571/go-peer/cmd/hidden_lake/service/pkg/request 0.038s coverage: 95.0% of statements
ok github.com/number571/go-peer/cmd/hidden_lake/service/pkg/response 0.032s coverage: 0.0% of statements [no tests to run]
ok github.com/number571/go-peer/cmd/hidden_lake/service/pkg/settings 0.038s coverage: 0.0% of statements
ok github.com/number571/go-peer/cmd/hidden_lake/traffic/cmd/hlt 0.035s coverage: 0.0% of statements
ok github.com/number571/go-peer/cmd/hidden_lake/traffic/internal/app 6.677s coverage: 57.7% of statements
ok github.com/number571/go-peer/cmd/hidden_lake/traffic/internal/config 0.033s coverage: 58.3% of statements
ok github.com/number571/go-peer/cmd/hidden_lake/traffic/internal/database 0.558s coverage: 63.9% of statements
ok github.com/number571/go-peer/cmd/hidden_lake/traffic/internal/handler 1.145s coverage: 61.9% of statements
ok github.com/number571/go-peer/cmd/hidden_lake/traffic/pkg/client 0.028s coverage: 0.0% of statements
ok github.com/number571/go-peer/cmd/hidden_lake/traffic/pkg/settings 0.033s coverage: [no statements]
ok github.com/number571/go-peer/internal/api 0.032s coverage: 0.0% of statements
ok github.com/number571/go-peer/cmd/hidden_lake/service/internal/handler 7.191s coverage: 63.3% of statements
ok github.com/number571/go-peer/cmd/hidden_lake/service/pkg/app 6.227s coverage: 76.1% of statements
ok github.com/number571/go-peer/cmd/hidden_lake/service/pkg/client 0.063s coverage: 0.0% of statements
ok github.com/number571/go-peer/cmd/hidden_lake/service/pkg/config 0.073s coverage: 51.6% of statements
ok github.com/number571/go-peer/cmd/hidden_lake/service/pkg/request 0.059s coverage: 95.0% of statements
ok github.com/number571/go-peer/cmd/hidden_lake/service/pkg/response 0.052s coverage: 0.0% of statements [no tests to run]
ok github.com/number571/go-peer/cmd/hidden_lake/service/pkg/settings 0.050s coverage: 0.0% of statements
ok github.com/number571/go-peer/cmd/hidden_lake/traffic/cmd/hlt 0.047s coverage: 0.0% of statements
ok github.com/number571/go-peer/cmd/hidden_lake/traffic/internal/app 6.051s coverage: 71.4% of statements
ok github.com/number571/go-peer/cmd/hidden_lake/traffic/internal/config 0.055s coverage: 61.8% of statements
ok github.com/number571/go-peer/cmd/hidden_lake/traffic/internal/database 0.756s coverage: 60.5% of statements
ok github.com/number571/go-peer/cmd/hidden_lake/traffic/internal/handler 1.216s coverage: 37.9% of statements
ok github.com/number571/go-peer/cmd/hidden_lake/traffic/pkg/client 0.043s coverage: 0.0% of statements
ok github.com/number571/go-peer/cmd/hidden_lake/traffic/pkg/settings 0.047s coverage: [no statements]
ok github.com/number571/go-peer/cmd/micro_anon 0.049s coverage: 0.0% of statements
ok github.com/number571/go-peer/cmd/micro_anon/keygen 0.041s coverage: 0.0% of statements
ok github.com/number571/go-peer/cmd/tools/encryptor 0.042s coverage: 0.0% of statements
ok github.com/number571/go-peer/cmd/tools/keygen 0.033s coverage: 0.0% of statements
ok github.com/number571/go-peer/cmd/tools/pmanager 0.031s coverage: 0.0% of statements
ok github.com/number571/go-peer/cmd/tools/storage 0.023s coverage: 0.0% of statements
ok github.com/number571/go-peer/examples/echo_service/default/recv_hls/service 0.029s coverage: 0.0% of statements
ok github.com/number571/go-peer/examples/echo_service/routing/recv_hls/service 0.032s coverage: 0.0% of statements
ok github.com/number571/go-peer/examples/echo_service/secret_channel/recv_hls/service 0.034s coverage: 0.0% of statements
ok github.com/number571/go-peer/examples/traffic_keeper/client_hlt 0.031s coverage: 0.0% of statements
ok github.com/number571/go-peer/internal/api 0.034s coverage: 0.0% of statements
ok github.com/number571/go-peer/internal/logger 0.033s coverage: 88.9% of statements
ok github.com/number571/go-peer/internal/pprof 0.032s coverage: 0.0% of statements
ok github.com/number571/go-peer/pkg/client 0.632s coverage: 73.4% of statements
ok github.com/number571/go-peer/pkg/client/message 0.043s coverage: 76.3% of statements
ok github.com/number571/go-peer/pkg/client/queue 6.453s coverage: 89.0% of statements
ok github.com/number571/go-peer/pkg/crypto 0.032s coverage: [no statements]
ok github.com/number571/go-peer/pkg/crypto/asymmetric 0.133s coverage: 84.9% of statements
ok github.com/number571/go-peer/pkg/crypto/entropy 0.032s coverage: 100.0% of statements
ok github.com/number571/go-peer/pkg/crypto/hashing 0.031s coverage: 85.7% of statements
ok github.com/number571/go-peer/pkg/crypto/puzzle 0.029s coverage: 94.7% of statements
ok github.com/number571/go-peer/pkg/crypto/random 0.025s coverage: 81.8% of statements
ok github.com/number571/go-peer/internal/pprof 0.036s coverage: 0.0% of statements
ok github.com/number571/go-peer/pkg/client 0.770s coverage: 70.3% of statements
ok github.com/number571/go-peer/pkg/client/message 0.058s coverage: 76.3% of statements
ok github.com/number571/go-peer/pkg/client/queue 6.505s coverage: 87.7% of statements
ok github.com/number571/go-peer/pkg/crypto 0.043s coverage: [no statements]
ok github.com/number571/go-peer/pkg/crypto/asymmetric 0.179s coverage: 84.9% of statements
ok github.com/number571/go-peer/pkg/crypto/entropy 0.052s coverage: 100.0% of statements
ok github.com/number571/go-peer/pkg/crypto/hashing 0.052s coverage: 85.7% of statements
ok github.com/number571/go-peer/pkg/crypto/puzzle 0.052s coverage: 94.7% of statements
ok github.com/number571/go-peer/pkg/crypto/random 0.030s coverage: 81.8% of statements
ok github.com/number571/go-peer/pkg/crypto/symmetric 0.028s coverage: 72.0% of statements
ok github.com/number571/go-peer/pkg/encoding 0.026s coverage: 78.3% of statements
ok github.com/number571/go-peer/pkg/errors 0.027s coverage: 100.0% of statements
ok github.com/number571/go-peer/pkg/filesystem 0.028s coverage: 90.0% of statements
ok github.com/number571/go-peer/pkg/logger 0.031s coverage: 84.6% of statements
ok github.com/number571/go-peer/pkg/network 8.969s coverage: 90.6% of statements
ok github.com/number571/go-peer/pkg/network/anonymity 16.813s coverage: 76.0% of statements
ok github.com/number571/go-peer/pkg/network/anonymity/adapters 0.035s coverage: 0.0% of statements
ok github.com/number571/go-peer/pkg/network/anonymity/logger 0.030s coverage: 90.9% of statements
ok github.com/number571/go-peer/pkg/network/conn 0.046s coverage: 78.4% of statements
ok github.com/number571/go-peer/pkg/network/conn_keeper 1.049s coverage: 94.9% of statements
ok github.com/number571/go-peer/pkg/network/message 0.030s coverage: 81.2% of statements
ok github.com/number571/go-peer/pkg/payload 0.030s coverage: 90.0% of statements
ok github.com/number571/go-peer/pkg/storage 0.054s coverage: 65.1% of statements
ok github.com/number571/go-peer/pkg/storage/database 0.127s coverage: 86.0% of statements
ok github.com/number571/go-peer/pkg/types 0.026s coverage: 100.0% of statements
ok github.com/number571/go-peer/pkg/wrapper 0.026s coverage: 100.0% of statements
ok github.com/number571/go-peer/pkg/encoding 0.030s coverage: 78.3% of statements
ok github.com/number571/go-peer/pkg/errors 0.032s coverage: 100.0% of statements
ok github.com/number571/go-peer/pkg/filesystem 0.033s coverage: 90.0% of statements
ok github.com/number571/go-peer/pkg/logger 0.029s coverage: 84.6% of statements
ok github.com/number571/go-peer/pkg/network 8.038s coverage: 87.8% of statements
ok github.com/number571/go-peer/pkg/network/anonymity 16.854s coverage: 75.4% of statements
ok github.com/number571/go-peer/pkg/network/anonymity/adapters 0.048s coverage: 0.0% of statements
ok github.com/number571/go-peer/pkg/network/anonymity/logbuilder 0.043s coverage: 84.2% of statements
ok github.com/number571/go-peer/pkg/network/conn 0.055s coverage: 77.3% of statements
ok github.com/number571/go-peer/pkg/network/conn_keeper 1.055s coverage: 92.3% of statements
ok github.com/number571/go-peer/pkg/network/message 0.054s coverage: 81.2% of statements
ok github.com/number571/go-peer/pkg/payload 0.029s coverage: 90.0% of statements
ok github.com/number571/go-peer/pkg/storage 0.087s coverage: 81.7% of statements
ok github.com/number571/go-peer/pkg/storage/database 0.076s coverage: 85.4% of statements
ok github.com/number571/go-peer/pkg/types 0.036s coverage: 100.0% of statements
ok github.com/number571/go-peer/pkg/wrapper 0.034s coverage: 100.0% of statements