diff options
author | evuez <julien@mulga.net> | 2022-11-26 15:38:06 -0500 |
---|---|---|
committer | evuez <julien@mulga.net> | 2024-04-03 22:44:12 +0200 |
commit | 86098797034cbc7eb6db0cee54e17f8dcaedbc5d (patch) | |
tree | 29b6225ead843eb9022296a54657bbadfa1c4da0 /Makefile | |
download | blom-main.tar.gz |
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c097d9b --- /dev/null +++ b/Makefile @@ -0,0 +1,50 @@ +.PHONY: help +help: # HELP: This output + @awk -F: '/HELP: [A-Za-z]/{print "\033[1m" $$1 "\033[0m:" $$3}' Makefile + +.PHONY: format +format: # HELP: Format every file in the project + @cargo fmt + +.PHONY: server +server: # HELP: Start the server + @cargo run server + +.PHONY: server.debug +server.debug: # HELP: Start the server with log level set to "debug" + @RUST_LOG=debug cargo run server + +.PHONY: server.daemon +server.daemon: # HELP: Start the server in the background + @cargo run server > /dev/null & + @sleep 1 + +.PHONY: test +test: server.daemon # HELP: Run the tests + @awk -v RS= '{print $$0; system("sleep .1")}' query.bl | nc 127.0.0.1 4902 > result + @diff -c expected result + @killall blom + +.PHONY: server.seed +server.seed: # HELP: Seed the server with some IP blocks + @awk '{print "SET "$$0" Foo"}' samples/ip-prefixes | xargs -I{} -n1 -P8 ./target/release/blom query "{}" + +.PHONY: server.seed.tiny +server.seed.tiny: # HELP: Seed the server with less IP blocks + @head -n20 samples/ip-prefixes | awk '{print "SET "$$0" Foo"}' | xargs -I{} ./target/release/blom query "{}" + +.PHONY: flamegraph +flamegraph: # HELP: Generate a flamegraph + @CARGO_PROFILE_RELEASE_DEBUG=true cargo flamegraph -- server > /dev/null & + @sleep 1 + @awk '{print "SET "$$0" Foo"}' samples/ip-prefixes | xargs -I{} -n1 -P8 ./target/release/blom query "{}" > /dev/null + @killall blom + +.PHONY: memprof +memprof: # HELP: Generate a memory profile + @cargo build --release --features debug-logs + @env MEMORY_PROFILER_LOG=warn LD_PRELOAD=./bin/libbytehound.so ./target/release/blom server > /dev/null & + @sleep 1 + @awk '{print "SET "$$0" Foo"}' samples/ip-prefixes | xargs -I{} -n1 -P8 ./target/release/blom query "{}" > /dev/null + @killall blom + @./bin/bytehound server memory-profiling_*.dat |