nostrdb

an unfairly fast embedded nostr database backed by lmdb
git clone git://jb55.com/nostrdb
Log | Files | Refs | Submodules | README | LICENSE

commit 9f4cc23022fee889a1c07e5c17b548376dcf5c82
parent e3cc896e25f68778401e5a87cb251290da2b062d
Author: William Casarin <jb55@jb55.com>
Date:   Mon,  8 Jan 2024 12:09:20 -0800

perf: add some flamegraph helpers to makefile

Diffstat:
M.gitignore | 6++++++
MMakefile | 14+++++++++++++-
Mshell.nix | 2+-
3 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -10,6 +10,12 @@ test *.zst *.o libnostrdb.a +perf.data +perf.folded +perf.data.old +perf.out +ndb.svg +flamegraph.html testdata/many-events.json testdata/db/ndb-v0.tar testdata/db/v0 diff --git a/Makefile b/Makefile @@ -159,6 +159,18 @@ testdata/many-events.json: testdata/many-events.json.zst bench: bench-ingest-many.c $(DEPS) $(CC) $(CFLAGS) $< $(LDS) -o $@ +perf.out: fake + perf script > $@ + +perf.folded: perf.out + stackcollapse-perf.pl $< > $@ + +ndb.svg: perf.folded + flamegraph.pl $< > $@ + +flamegraph: ndb.svg + browser $< + run-bench: testdata/many-events.json bench ./bench @@ -169,4 +181,4 @@ testdata/db/.dir: test: test.c $(DEPS) testdata/db/.dir $(CC) $(CFLAGS) test.c $(LDS) -o $@ -.PHONY: tags clean +.PHONY: tags clean fake diff --git a/shell.nix b/shell.nix @@ -1,7 +1,7 @@ { pkgs ? import <nixpkgs> {} }: with pkgs; mkShell { - buildInputs = [ autoreconfHook flatbuffers flatcc pkg-config ]; + buildInputs = [ autoreconfHook flatbuffers flatcc pkg-config flamegraph ]; LIBCLANG_PATH="${llvmPackages.libclang}/lib"; }