From 86098797034cbc7eb6db0cee54e17f8dcaedbc5d Mon Sep 17 00:00:00 2001 From: evuez Date: Sat, 26 Nov 2022 15:38:06 -0500 Subject: Initial commit --- Makefile | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 Makefile (limited to 'Makefile') 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 -- cgit v1.2.3