git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Jeff Hostetler via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Jeff Hostetler <jeffhost@microsoft.com>,
	Jeff Hostetler <jeffhost@microsoft.com>
Subject: [PATCH 04/11] p7519: add trace logging during perf test
Date: Mon, 01 Feb 2021 22:02:13 +0000	[thread overview]
Message-ID: <8de9985a706675ff41a3549ce00dd42a9dc92c88.1612216941.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.860.git.1612216941.gitgitgadget@gmail.com>

From: Jeff Hostetler <jeffhost@microsoft.com>

Add optional trace logging to allow us to better compare performance of
various fsmonitor providers and compare results with non-fsmonitor runs.

Currently, this includes Trace2 logging, but may be extended to include
other trace targets, such as GIT_TRACE_FSMONITOR if desired.

Using this logging helped me explain an odd behavior on MacOS where the
kernel was dropping events and causing the hook to Watchman to timeout.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
---
 t/perf/.gitignore         |  1 +
 t/perf/Makefile           |  4 ++--
 t/perf/p7519-fsmonitor.sh | 32 ++++++++++++++++++++++++++++++++
 3 files changed, 35 insertions(+), 2 deletions(-)

diff --git a/t/perf/.gitignore b/t/perf/.gitignore
index 982eb8e3a94..72f5d0d3148 100644
--- a/t/perf/.gitignore
+++ b/t/perf/.gitignore
@@ -1,3 +1,4 @@
 /build/
 /test-results/
+/test-trace/
 /trash directory*/
diff --git a/t/perf/Makefile b/t/perf/Makefile
index fcb0e8865e4..2465770a782 100644
--- a/t/perf/Makefile
+++ b/t/perf/Makefile
@@ -7,10 +7,10 @@ perf: pre-clean
 	./run
 
 pre-clean:
-	rm -rf test-results
+	rm -rf test-results test-trace
 
 clean:
-	rm -rf build "trash directory".* test-results
+	rm -rf build "trash directory".* test-results test-trace
 
 test-lint:
 	$(MAKE) -C .. test-lint
diff --git a/t/perf/p7519-fsmonitor.sh b/t/perf/p7519-fsmonitor.sh
index 45bbba3c92f..e6724d3604b 100755
--- a/t/perf/p7519-fsmonitor.sh
+++ b/t/perf/p7519-fsmonitor.sh
@@ -32,6 +32,8 @@ test_description="Test core.fsmonitor"
 #
 # GIT_PERF_7519_DROP_CACHE: if set, the OS caches are dropped between tests
 #
+# GIT_PERF_7519_TRACE: if set, enable trace logging during the test.
+#   Trace logs will be grouped by fsmonitor provider.
 
 test_perf_large_repo
 test_checkout_worktree
@@ -70,6 +72,32 @@ then
 	fi
 fi
 
+trace_start() {
+	if test -n "$GIT_PERF_7519_TRACE"
+	then
+		name="$1"
+		TEST_TRACE_DIR="$TEST_OUTPUT_DIRECTORY/test-trace/p7519/"
+		echo "Writing trace logging to $TEST_TRACE_DIR"
+
+		mkdir -p "$TEST_TRACE_DIR"
+
+		# Start Trace2 logging and any other GIT_TRACE_* logs that you
+		# want for this named test case.
+
+		GIT_TRACE2_PERF="$TEST_TRACE_DIR/$name.trace2perf"
+		export GIT_TRACE2_PERF
+
+		>"$GIT_TRACE2_PERF"
+	fi
+}
+
+trace_stop() {
+	if test -n "$GIT_PERF_7519_TRACE"
+	then
+		unset GIT_TRACE2_PERF
+	fi
+}
+
 test_expect_success "one time repo setup" '
 	# set untrackedCache depending on the environment
 	if test -n "$GIT_PERF_7519_UNTRACKED_CACHE"
@@ -203,6 +231,7 @@ test_fsmonitor_suite() {
 # such as Watchman.
 #
 
+trace_start fsmonitor-watchman
 if test -n "$GIT_PERF_7519_FSMONITOR"; then
 	for INTEGRATION_PATH in $GIT_PERF_7519_FSMONITOR; do
 		test_expect_success "setup for fsmonitor $INTEGRATION_PATH" 'setup_for_fsmonitor'
@@ -221,11 +250,13 @@ then
 	# preventing the removal of the trash directory
 	watchman shutdown-server >/dev/null 2>&1
 fi
+trace_stop
 
 #
 # Run a full set of perf tests with the fsmonitor feature disabled.
 #
 
+trace_start fsmonitor-disabled
 test_expect_success "setup without fsmonitor" '
 	unset INTEGRATION_SCRIPT &&
 	git config --unset core.fsmonitor &&
@@ -233,5 +264,6 @@ test_expect_success "setup without fsmonitor" '
 '
 
 test_fsmonitor_suite
+trace_stop
 
 test_done
-- 
gitgitgadget


  parent reply	other threads:[~2021-02-01 22:03 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-01 22:02 [PATCH 00/11] FSMonitor Preliminary Commits Jeff Hostetler via GitGitGadget
2021-02-01 22:02 ` [PATCH 01/11] p7519: use xargs -0 rather than -d in test Jeff Hostetler via GitGitGadget
2021-02-01 23:25   ` Junio C Hamano
2021-02-02 18:16     ` Jeff Hostetler
2021-02-02 21:23       ` Junio C Hamano
2021-02-01 22:02 ` [PATCH 02/11] p7519: fix watchman watch-list test on Windows Jeff Hostetler via GitGitGadget
2021-02-01 22:02 ` [PATCH 03/11] p7519: move watchman cleanup earlier in the test Jeff Hostetler via GitGitGadget
2021-02-01 22:02 ` Jeff Hostetler via GitGitGadget [this message]
2021-02-01 22:02 ` [PATCH 05/11] preload-index: log the number of lstat calls to trace2 Jeff Hostetler via GitGitGadget
2021-02-01 22:02 ` [PATCH 06/11] read-cache: " Jeff Hostetler via GitGitGadget
2021-02-01 22:02 ` [PATCH 07/11] read-cache: log the number of scanned files " Jeff Hostetler via GitGitGadget
2021-02-01 22:02 ` [PATCH 08/11] fsmonitor: log invocation of FSMonitor hook " Jeff Hostetler via GitGitGadget
2021-02-01 22:02 ` [PATCH 09/11] fsmonitor: log FSMN token when reading and writing the index Jeff Hostetler via GitGitGadget
2021-02-01 22:02 ` [PATCH 10/11] fsmonitor: allow all entries for a folder to be invalidated Kevin Willford via GitGitGadget
2021-02-01 22:02 ` [PATCH 11/11] fsmonitor: refactor initialization of fsmonitor_last_update token Jeff Hostetler via GitGitGadget
2021-02-03 15:34 ` [PATCH v2 00/11] FSMonitor Preliminary Commits Jeff Hostetler via GitGitGadget
2021-02-03 15:34   ` [PATCH v2 01/11] p7519: do not rely on "xargs -d" in test Jeff Hostetler via GitGitGadget
2021-02-03 15:34   ` [PATCH v2 02/11] p7519: fix watchman watch-list test on Windows Jeff Hostetler via GitGitGadget
2021-02-03 15:34   ` [PATCH v2 03/11] p7519: move watchman cleanup earlier in the test Jeff Hostetler via GitGitGadget
2021-02-03 15:34   ` [PATCH v2 04/11] p7519: add trace logging during perf test Jeff Hostetler via GitGitGadget
2021-02-03 15:34   ` [PATCH v2 05/11] preload-index: log the number of lstat calls to trace2 Jeff Hostetler via GitGitGadget
2021-02-03 15:34   ` [PATCH v2 06/11] read-cache: " Jeff Hostetler via GitGitGadget
2021-02-03 15:34   ` [PATCH v2 07/11] read-cache: log the number of scanned files " Jeff Hostetler via GitGitGadget
2021-02-03 15:34   ` [PATCH v2 08/11] fsmonitor: log invocation of FSMonitor hook " Jeff Hostetler via GitGitGadget
2021-02-03 15:34   ` [PATCH v2 09/11] fsmonitor: log FSMN token when reading and writing the index Jeff Hostetler via GitGitGadget
2021-02-03 15:34   ` [PATCH v2 10/11] fsmonitor: allow all entries for a folder to be invalidated Kevin Willford via GitGitGadget
2021-02-03 15:34   ` [PATCH v2 11/11] fsmonitor: refactor initialization of fsmonitor_last_update token Jeff Hostetler via GitGitGadget
2021-02-16 19:00   ` [PATCH v2 00/11] FSMonitor Preliminary Commits Jeff Hostetler
2021-02-17  1:54     ` Junio C Hamano
2021-02-03 21:19 ` [PATCH " Taylor Blau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8de9985a706675ff41a3549ce00dd42a9dc92c88.1612216941.git.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jeffhost@microsoft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).