summaryrefslogtreecommitdiff
path: root/solenv
diff options
context:
space:
mode:
authorChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2022-12-20 12:49:01 +0100
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2022-12-20 14:11:36 +0000
commit4b67515418ee4f10071b3f0f2275ba37f32b0ae5 (patch)
treefd27d2c17f0069e11c52f1f7887d47434bf9b255 /solenv
parent0904f6ccc1a378743d1db56d330a691d90ba9720 (diff)
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+LibreOffice@googlemail.com>
Diffstat (limited to 'solenv')
-rw-r--r--solenv/gbuild/Trace.mk10
1 files changed, 7 insertions, 3 deletions
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