From 8df7efddc8ffe398cde4106d32b39848e5948df9 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sun, 11 Apr 2010 10:26:52 +0200 Subject: [PATCH] maint.mk: print the elapsed time for each syntax-check rule * top/maint.mk (sc_m_rules_): Save start time in a file. (sc_z_rules_): New rules: remove temp file and print elapsed time. (local-check): Interpose the .z rules --- ChangeLog | 7 +++++++ top/maint.mk | 19 +++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1fdfa06e1..688f8c097 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2010-04-11 Jim Meyering + maint.mk: print the elapsed time for each syntax-check rule + * top/maint.mk (sc_m_rules_): Save start time in a file. + (sc_z_rules_): New rules: remove temp file and print elapsed time. + (local-check): Interpose the .z rules + +2010-04-11 Jim Meyering + maint.mk: detect_empty_lines_at_EOF_: avoid FP for an empty file * top/maint.mk (detect_empty_lines_at_EOF_): Don't confuse an empty file with one that ends in an empty line. diff --git a/top/maint.mk b/top/maint.mk index b71304dc4..bc62fa3a0 100644 --- a/top/maint.mk +++ b/top/maint.mk @@ -129,8 +129,23 @@ sc_m_rules_ = $(patsubst %, %.m, $(syntax-check-rules)) .PHONY: $(sc_m_rules_) $(sc_m_rules_): @echo $(patsubst sc_%.m, %, $@) - -local-check := $(filter-out $(local-checks-to-skip), $(local-checks-available)) + @date +%s.%N > .sc-start-$(basename $@) + +# Compute and print the elapsed time for each syntax-check rule. +sc_z_rules_ = $(patsubst %, %.z, $(syntax-check-rules)) +.PHONY: $(sc_z_rules_) +$(sc_z_rules_): %.z: % + @end=$$(date +%s.%N); \ + start=$$(cat .sc-start-$*); \ + rm -f .sc-start-$*; \ + awk -v s=$$start -v e=$$end \ + 'END {printf "%.2f: $* done\n", e - s}' < /dev/null + +# The patsubst here is to replace each sc_% rule with its sc_%.z wrapper +# that computes and prints elapsed time. +local-check := \ + $(patsubst sc_%, sc_%.z, \ + $(filter-out $(local-checks-to-skip), $(local-checks-available))) syntax-check: $(local-check) # @grep -nE '# *include <(limits|std(def|arg|bool))\.h>' \ -- 2.11.0