solenv/gbuild/Trace.mk | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
New commits: commit 4b67515418ee4f10071b3f0f2275ba37f32b0ae5 Author: Christian Lohmaier <lohmaier+libreoff...@googlemail.com> AuthorDate: Tue Dec 20 12:49:01 2022 +0100 Commit: Christian Lohmaier <lohmaier+libreoff...@googlemail.com> CommitDate: Tue Dec 20 14:11:36 2022 +0000 gbuild trace: make it work nicer on macOS (seconds-only accuracy) the finish-gbuild-trace.py matches a nanoseconds timestamp and truncates it to milliseconds, so could also adjust that and look for the unchanged %N for mac in the tracefile and handle it that way, but since there is another conditional needed for the lack of flock on macOS doing it in the makefile seemd like the more natural choice. (well, not trictly needed unless you mind the thousands of command not found messages :-)) Change-Id: I768bc9dd8be232567644ae000b6419bb87f58509 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144590 Tested-by: Jenkins Reviewed-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com> diff --git a/solenv/gbuild/Trace.mk b/solenv/gbuild/Trace.mk index 8d416157d28d..5ff0d0bf4ded 100644 --- a/solenv/gbuild/Trace.mk +++ b/solenv/gbuild/Trace.mk @@ -28,11 +28,15 @@ gb_TRACE := $(abspath $(GBUILD_TRACE)) endif ifneq ($(gb_TRACE),) - -# call gb_Trace_AddMark,marktype,detail,type,extra +# macOS date doesn't know about nanoseconds switch, and instead of resorting to perl or python +# to create a millisecond timestamp, just avoid the overhead and live with seconds-only accuracy +gb_Trace_Timestamp := $(if $(filter MACOSX,$(OS)),$$(date +%s)000000000,$(date +%s%N)) +# macOS also doesn't provide flock, so skip that part on mac # The (flock;cat) part is to minimize lock time. +gb_Trace_Flock := $(if $(filter MACOSX,$(OS)),,| ( flock 1; cat )) +# call gb_Trace_AddMark,marktype,detail,type,extra define gb_Trace__AddMark -echo "{\"name\": \"$(3)\", \"ph\": \"$(1)\", \"pid\": 1, \"tid\": 1, \"ts\": $$(date +%s%N),\"args\":{\"message\":\"[$(3)]: $(2)\"}}," | ( flock 1; cat ) >>$(gb_TRACE) +echo "{\"name\": \"$(3)\", \"ph\": \"$(1)\", \"pid\": 1, \"tid\": 1, \"ts\": $(gb_Trace_Timestamp),\"args\":{\"message\":\"[$(3)]: $(2)\"}}," $(gb_Trace_Flock) >>$(gb_TRACE) endef # call gb_Trace_StartRange,detail,type