bump product version to 7.2.5.1
[LibreOffice.git] / solenv / gbuild / Trace.mk
blob8d416157d28d6e89070558e8cdcac09716d44c70
1 # -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 # Support for tracing what gbuild does.
11 # Run 'make GBUILD_TRACE=/somewhere/log.json', process the file
12 # using solenv/bin/finish-gbuild-trace.py, and then view it in Chromium
13 # using the chrome://tracing URL:
14 # - the '?' icon in the top-right is the help
15 # - 'gbuild' rows represent per-parallelism (per-CPU) usage in time
16 # - 'totals' rows represent sums for reach build type
17 # - note that 'EXTERNAL' targets do not detect whether the external package
18 # is built with parallelism or not, so the actual CPU time may be higher
19 # - vertical lines represent targets that themselves do not take any time
20 # to build
21 # - any target can be found using the search field in the top right corner
22 # (just type e.g. '[MOD]: sal' and hit the '->' button, if you cannot see
23 # it pressing 'm' or 'f' can help)
25 gb_TRACE :=
26 ifneq ($(GBUILD_TRACE),)
27 gb_TRACE := $(abspath $(GBUILD_TRACE))
28 endif
30 ifneq ($(gb_TRACE),)
32 # call gb_Trace_AddMark,marktype,detail,type,extra
33 # The (flock;cat) part is to minimize lock time.
34 define gb_Trace__AddMark
35 echo "{\"name\": \"$(3)\", \"ph\": \"$(1)\", \"pid\": 1, \"tid\": 1, \"ts\": $$(date +%s%N),\"args\":{\"message\":\"[$(3)]: $(2)\"}}," | ( flock 1; cat ) >>$(gb_TRACE)
36 endef
38 # call gb_Trace_StartRange,detail,type
39 define gb_Trace_StartRange
40 $(call gb_Trace__AddMark,B,$(1),$(2))
41 endef
43 # call gb_Trace_EndRange,detail,type
44 define gb_Trace_EndRange
45 $(call gb_Trace__AddMark,E,$(1),$(2))
46 endef
48 # call gb_Trace_MakeMark,detail,type
49 define gb_Trace_MakeMark
50 $(call gb_Trace__AddMark,i,$(1),$(2))
51 endef
53 ifeq ($(MAKE_RESTARTS),)
54 $(shell rm -f $(gb_TRACE) 2>/dev/null)
55 else
56 $(shell $(call gb_Trace__AddMark,i,make restart,MAKE))
57 endif
59 endif
61 # vim: set noet sw=4 ts=4: