diff options
Diffstat (limited to 'exp/Makefile')
-rw-r--r-- | exp/Makefile | 41 |
1 files changed, 32 insertions, 9 deletions
diff --git a/exp/Makefile b/exp/Makefile index f49d2f1..b69b0bf 100644 --- a/exp/Makefile +++ b/exp/Makefile @@ -8,33 +8,38 @@ export LC_NUMERIC := export DNA_BACKUP ?= ../dna-backup export DNA_PARAMS ?= dna_params export MAX_VERSION ?= 5 -export COMMITS ?= commits +export COMMITS ?= commits.daily DNA_4K ?= dna_4k DNA_8K ?= dna_8k NOPACK ?= nopack export GIT_NOPACK ?= $(abspath $(NOPACK)) +export REAL ?= real export DIFFS ?= diffs export REPO_PATH ?= repo export GIT_PATH ?= $(abspath git) GITC := git -C $(REPO_PATH) +# Number of initial commits to skip. This option has been added for the +# Linux kernel repo, as the first commits are too far away date wise. +SKIP_COMMITS ?= 30 + DNADIRS := $(DNA_4K) $(DNA_8K) -DATADIRS := $(DNA_4K) $(DNA_8K) $(DIFFS) $(NOPACK) +DATADIRS := $(DNA_4K) $(DNA_8K) $(DIFFS) $(NOPACK) $(REAL) SIZEFILES := $(DATADIRS:%=%.size) .PHONY: all exp all exp: summary.csv $(SIZEFILES) @echo "=============== SUMMARY ===============" @head -n 1 $< | while IFS="," read -r $(DATADIRS); do \ - printf "$(DATADIRS:%=\%13s)\n" $(DATADIRS:%=$$%); \ + printf "$(DATADIRS:%=\%14s)\n" $(DATADIRS:%=$$%); \ done @tail -n +2 $< | while IFS="," read -r $(DATADIRS); do \ - printf "$(DATADIRS:%=\%'13d)\n" $(DATADIRS:%=$$%); \ + printf "$(DATADIRS:%=\%'14d)\n" $(DATADIRS:%=$$%); \ done @echo "================ TOTAL ================" @for i in $(SIZEFILES); do cat $$i | paste -sd+ | bc; done | while read j; do \ - printf "%'13d " $$j; \ + printf "%'14d " $$j; \ done @echo @@ -42,12 +47,23 @@ summary.csv: $(SIZEFILES) echo $(DATADIRS) | tr ' ' ',' > $@ paste -d "," $^ >> $@ -$(DNADIRS:%=%.size) $(NOPACK).size: %.size: %.versions run +$(DNADIRS:%=%.size) $(REAL).size: %.size: %.versions run rm -rf $@ for i in $</*; do \ cut -f1 $$i | paste -sd+ | bc >> $@; \ done +$(NOPACK).size: $(NOPACK).versions + prev=/dev/null; for i in $</*; do \ + diff -u0 $$prev $$i \ + | sed -e '1,2d' -e '/^-/d' -e 's/^+//' -e '/^@@/d' \ + | cut -f1 \ + | paste -sd+ \ + | bc \ + >> $@; \ + prev=$$i; \ + done + %.size: % run find $< -type f -exec du -ba {} + | sort -k2 | cut -f1 > $@ @@ -65,7 +81,7 @@ $(DNADIRS:%=%.size) $(NOPACK).size: %.size: %.versions run | sort -k2 \ > $@ -run: $(COMMITS) $(DNA_BACKUP) $(DNA_PARAMS) | $(DATADIRS) $(NOPACK).versions +run: $(COMMITS) $(DNA_BACKUP) $(DNA_PARAMS) | $(DATADIRS) $(NOPACK).versions $(REAL).versions rm -rf $(DATADIRS:%=%/*) ./exp.sh touch $@ @@ -74,15 +90,22 @@ $(DNA_PARAMS): echo "$(DNA_4K) -c 4096" >> $@ echo "$(DNA_8K) -c 8192" >> $@ -$(DATADIRS) $(NOPACK).versions: +$(DATADIRS) $(NOPACK).versions $(REAL).versions: mkdir $@ $(DNA_BACKUP): .FORCE @$(MAKE) -C $(@D) --no-print-directory $(@F) -$(COMMITS): | repo git +commits.monthly: commits.daily + sed -n '0~30p' $< > $@ + +commits.weekly: commits.daily + sed -n '0~7p' $< > $@ + +commits.daily: | repo git $(GITC) log --reverse --no-merges --pretty=tformat:"%H %as" \ | sort --unique --key=2 \ + | tail -n +$(SKIP_COMMITS) \ > $@ repo git &: |