From: Jeff Hostetler via GitGitGadget <hidden> Date: 2021-02-01 22:03:15
This patch series fixes runtime errors in t/perf/p7519 on Windows and MacOS.
It adds Trace2 logging to p7519 to make it easier to compare results when
Watchman is enabled and disabled. And finally, it adds some Trace2 regions
and data events around our usage of Watchman and the existing FSMonitor
framework.
This series is independent of the "Simple IPC" series.
A future series to add a builtin FSMonitor daemon will build upon both of
these series.
Jeff Hostetler (10):
p7519: use xargs -0 rather than -d in test
p7519: fix watchman watch-list test on Windows
p7519: move watchman cleanup earlier in the test
p7519: add trace logging during perf test
preload-index: log the number of lstat calls to trace2
read-cache: log the number of lstat calls to trace2
read-cache: log the number of scanned files to trace2
fsmonitor: log invocation of FSMonitor hook to trace2
fsmonitor: log FSMN token when reading and writing the index
fsmonitor: refactor initialization of fsmonitor_last_update token
Kevin Willford (1):
fsmonitor: allow all entries for a folder to be invalidated
fsmonitor.c | 107 ++++++++++++++++++++++++++++++++++----
fsmonitor.h | 5 ++
preload-index.c | 10 ++++
read-cache.c | 24 +++++++--
t/perf/.gitignore | 1 +
t/perf/Makefile | 4 +-
t/perf/p7519-fsmonitor.sh | 61 ++++++++++++++++++----
7 files changed, 186 insertions(+), 26 deletions(-)
base-commit: 71ca53e8125e36efbda17293c50027d31681a41f
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-860%2Fjeffhostetler%2Ffsmonitor-prework-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-860/jeffhostetler/fsmonitor-prework-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/860
--
gitgitgadget
From: Jeff Hostetler via GitGitGadget <hidden> Date: 2021-02-01 22:03:15
From: Jeff Hostetler <redacted>
The Mac version of xargs does not support the "-d" option. Convert the test
setup to pipe the data set thru `lf_to_nul | xargs -0` instead.
Signed-off-by: Jeff Hostetler <redacted>
---
t/perf/p7519-fsmonitor.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Jeff Hostetler via GitGitGadget <hidden> Date: 2021-02-01 22:03:15
From: Jeff Hostetler <redacted>
Only use the final portion of the test trash directory file name
when verifying that Watchman was started.
On Windows and under the SDK, $GIT_WORKTREE is a cygwin-style
path with forward slashes and a "/c/" drive name. However
`watchman watch-list` reports a proper Windows-style pathname
with drive letters and backslashes. This causes the grep to
fail. Since we don't really care about the full pathname (and
we really don't want to bother with normalizaing them), just see
if the test-name portion of the path is found.
Signed-off-by: Jeff Hostetler <redacted>
---
t/perf/p7519-fsmonitor.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -101,7 +101,7 @@ test_expect_success "one time repo setup" '# If Watchman exists, watch the work tree and attempt a query.iftest_have_prereqWATCHMAN;thenwatchmanwatch"$GIT_WORK_TREE"&&-watchmanwatch-list|grep-q-F"$GIT_WORK_TREE"+watchmanwatch-list|grep-q-F"p7519-fsmonitor"fi'
@@ -87,7 +87,11 @@ int read_fsmonitor_extension(struct index_state *istate, const void *data,BUG("fsmonitor_dirty has more entries than the index (%"PRIuMAX" > %u)",(uintmax_t)istate->fsmonitor_dirty->bit_size,istate->cache_nr);-trace_printf_key(&trace_fsmonitor,"read fsmonitor extension successful");+trace2_data_string("index",NULL,"extension/fsmn/read/token",+istate->fsmonitor_last_update);+trace_printf_key(&trace_fsmonitor,+"read fsmonitor extension successful '%s'",+istate->fsmonitor_last_update);return0;}
From: Jeff Hostetler via GitGitGadget <hidden> Date: 2021-02-01 22:03:41
From: Jeff Hostetler <redacted>
Isolate and document initialization of `istate->fsmonitor_last_update`.
This field should contain a fsmonitor-specific opaque token, but we
need to initialize it before we can actually talk to a fsmonitor process,
so we create a generic default value.
Signed-off-by: Jeff Hostetler <redacted>
---
fsmonitor.c | 35 ++++++++++++++++++++++++++++++++---
1 file changed, 32 insertions(+), 3 deletions(-)
From: Jeff Hostetler via GitGitGadget <hidden> Date: 2021-02-01 22:03:45
From: Jeff Hostetler <redacted>
Shutdown Watchman after the Watchman-based tests and before the block of
"no fsmonitor" tests.
This helps ensure that Watchman cannot affect the test results for the
other.
Signed-off-by: Jeff Hostetler <redacted>
---
t/perf/p7519-fsmonitor.sh | 25 +++++++++++++++++--------
1 file changed, 17 insertions(+), 8 deletions(-)
@@ -198,6 +198,11 @@ test_fsmonitor_suite() {'}+#+# Run a full set of perf tests using each Hook-based fsmonitor provider,+# such as Watchman.+#+iftest-n"$GIT_PERF_7519_FSMONITOR";thenforINTEGRATION_PATHin$GIT_PERF_7519_FSMONITOR;dotest_expect_success"setup for fsmonitor $INTEGRATION_PATH"'setup_for_fsmonitor'
@@ -208,14 +213,6 @@ elsetest_fsmonitor_suitefi-test_expect_success"setup without fsmonitor"'-unsetINTEGRATION_SCRIPT&&-gitconfig--unsetcore.fsmonitor&&-gitupdate-index--no-fsmonitor-'--test_fsmonitor_suite-iftest_have_prereqWATCHMANthenwatchmanwatch-del"$GIT_WORK_TREE">/dev/null2>&1&&
@@ -225,4 +222,16 @@ thenwatchmanshutdown-server>/dev/null2>&1fi+#+# Run a full set of perf tests with the fsmonitor feature disabled.+#++test_expect_success"setup without fsmonitor"'+unsetINTEGRATION_SCRIPT&&+gitconfig--unsetcore.fsmonitor&&+gitupdate-index--no-fsmonitor+'++test_fsmonitor_suite+ test_done
From: Jeff Hostetler via GitGitGadget <hidden> Date: 2021-02-01 22:03:47
From: Jeff Hostetler <redacted>
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 <redacted>
---
t/perf/.gitignore | 1 +
t/perf/Makefile | 4 ++--
t/perf/p7519-fsmonitor.sh | 32 ++++++++++++++++++++++++++++++++
3 files changed, 35 insertions(+), 2 deletions(-)
@@ -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 @@ thenfifi+trace_start(){+iftest-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"+exportGIT_TRACE2_PERF++>"$GIT_TRACE2_PERF"+fi+}++trace_stop(){+iftest-n"$GIT_PERF_7519_TRACE"+then+unsetGIT_TRACE2_PERF+fi+}+ test_expect_success"one time repo setup"'# set untrackedCache depending on the environmentiftest-n"$GIT_PERF_7519_UNTRACKED_CACHE"
@@ -203,6 +231,7 @@ test_fsmonitor_suite() {# such as Watchman.#+trace_startfsmonitor-watchmaniftest-n"$GIT_PERF_7519_FSMONITOR";thenforINTEGRATION_PATHin$GIT_PERF_7519_FSMONITOR;dotest_expect_success"setup for fsmonitor $INTEGRATION_PATH"'setup_for_fsmonitor'
@@ -221,11 +250,13 @@ then# preventing the removal of the trash directorywatchmanshutdown-server>/dev/null2>&1fi+trace_stop## Run a full set of perf tests with the fsmonitor feature disabled.#+trace_startfsmonitor-disabled test_expect_success"setup without fsmonitor"'unsetINTEGRATION_SCRIPT&&gitconfig--unsetcore.fsmonitor&&
From: Jeff Hostetler via GitGitGadget <hidden> Date: 2021-02-01 22:03:56
From: Jeff Hostetler <redacted>
Report the total number of calls made to lstat() inside preload_index().
FSMonitor improves the performance of commands like `git status` by
avoiding scanning the disk for changed files. This can be seen in
`preload_index()`. Let's measure this.
Signed-off-by: Jeff Hostetler <redacted>
---
preload-index.c | 10 ++++++++++
1 file changed, 10 insertions(+)
From: Jeff Hostetler via GitGitGadget <hidden> Date: 2021-02-01 22:04:00
From: Jeff Hostetler <redacted>
Report the number of files in the working directory that were read and
their hashes verified in `refresh_index()`.
FSMonitor improves the performance of commands like `git status` by
avoiding scanning the disk for changed files. Let's measure this.
Signed-off-by: Jeff Hostetler <redacted>
---
read-cache.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
@@ -190,13 +190,34 @@ int fsmonitor_is_trivial_response(const struct strbuf *query_result)returnis_trivial;}-staticvoidfsmonitor_refresh_callback(structindex_state*istate,constchar*name)+staticvoidfsmonitor_refresh_callback(structindex_state*istate,char*name){-intpos=index_name_pos(istate,name,strlen(name));+inti,len=strlen(name);+if(name[len-1]=='/'){++/*+*TODOWeshouldbinarysearchtofindthefirstpathwith+*TODOthisdirectoryprefix.Thenlinearlyupdateentries+*TODOwhiletheprefixmatches.Takingcaretosearchwithout+*TODOthetrailingslash--because'/'sortsafterafew+*TODOinterestingspecialchars,like'.'and' '.+*/++/* Mark all entries for the folder invalid */+for(i=0;i<istate->cache_nr;i++){+if(istate->cache[i]->ce_flags&CE_FSMONITOR_VALID&&+starts_with(istate->cache[i]->name,name))+istate->cache[i]->ce_flags&=~CE_FSMONITOR_VALID;+}+/* Need to remove the / from the path for the untracked cache */+name[len-1]='\0';+}else{+intpos=index_name_pos(istate,name,strlen(name));-if(pos>=0){-structcache_entry*ce=istate->cache[pos];-ce->ce_flags&=~CE_FSMONITOR_VALID;+if(pos>=0){+structcache_entry*ce=istate->cache[pos];+ce->ce_flags&=~CE_FSMONITOR_VALID;+}}/*
From: Jeff Hostetler via GitGitGadget <hidden> Date: 2021-02-01 22:04:26
From: Jeff Hostetler <redacted>
Let's measure the time taken to request and receive FSMonitor data
via the hook API and the size of the response.
Signed-off-by: Jeff Hostetler <redacted>
---
fsmonitor.c | 29 ++++++++++++++++++++++++++++-
fsmonitor.h | 5 +++++
2 files changed, 33 insertions(+), 1 deletion(-)
From: Jeff Hostetler via GitGitGadget <hidden> Date: 2021-02-01 22:04:31
From: Jeff Hostetler <redacted>
Report the total number of calls made to lstat() inside of refresh_index().
FSMonitor improves the performance of commands like `git status` by
avoiding scanning the disk for changed files. This can be seen in
`refresh_index()`. Let's measure this.
Signed-off-by: Jeff Hostetler <redacted>
---
read-cache.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
From: Jeff Hostetler via GitGitGadget <hidden> Date: 2021-02-03 15:38:14
From: Jeff Hostetler <redacted>
Shutdown Watchman after the Watchman-based tests and before the block of
"no fsmonitor" tests.
This helps ensure that Watchman cannot affect the test results for the
other.
Signed-off-by: Jeff Hostetler <redacted>
---
t/perf/p7519-fsmonitor.sh | 25 +++++++++++++++++--------
1 file changed, 17 insertions(+), 8 deletions(-)
@@ -208,6 +208,11 @@ test_fsmonitor_suite() {'}+#+# Run a full set of perf tests using each Hook-based fsmonitor provider,+# such as Watchman.+#+iftest-n"$GIT_PERF_7519_FSMONITOR";thenforINTEGRATION_PATHin$GIT_PERF_7519_FSMONITOR;dotest_expect_success"setup for fsmonitor $INTEGRATION_PATH"'setup_for_fsmonitor'
@@ -218,14 +223,6 @@ elsetest_fsmonitor_suitefi-test_expect_success"setup without fsmonitor"'-unsetINTEGRATION_SCRIPT&&-gitconfig--unsetcore.fsmonitor&&-gitupdate-index--no-fsmonitor-'--test_fsmonitor_suite-iftest_have_prereqWATCHMANthenwatchmanwatch-del"$GIT_WORK_TREE">/dev/null2>&1&&
@@ -235,4 +232,16 @@ thenwatchmanshutdown-server>/dev/null2>&1fi+#+# Run a full set of perf tests with the fsmonitor feature disabled.+#++test_expect_success"setup without fsmonitor"'+unsetINTEGRATION_SCRIPT&&+gitconfig--unsetcore.fsmonitor&&+gitupdate-index--no-fsmonitor+'++test_fsmonitor_suite+ test_done
From: Jeff Hostetler via GitGitGadget <hidden> Date: 2021-02-03 15:38:51
From: Jeff Hostetler <redacted>
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 <redacted>
---
t/perf/.gitignore | 1 +
t/perf/Makefile | 4 ++--
t/perf/p7519-fsmonitor.sh | 32 ++++++++++++++++++++++++++++++++
3 files changed, 35 insertions(+), 2 deletions(-)
@@ -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 @@ thenfifi+trace_start(){+iftest-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"+exportGIT_TRACE2_PERF++>"$GIT_TRACE2_PERF"+fi+}++trace_stop(){+iftest-n"$GIT_PERF_7519_TRACE"+then+unsetGIT_TRACE2_PERF+fi+}+ test_expect_success"one time repo setup"'# set untrackedCache depending on the environmentiftest-n"$GIT_PERF_7519_UNTRACKED_CACHE"
@@ -213,6 +241,7 @@ test_fsmonitor_suite() {# such as Watchman.#+trace_startfsmonitor-watchmaniftest-n"$GIT_PERF_7519_FSMONITOR";thenforINTEGRATION_PATHin$GIT_PERF_7519_FSMONITOR;dotest_expect_success"setup for fsmonitor $INTEGRATION_PATH"'setup_for_fsmonitor'
@@ -231,11 +260,13 @@ then# preventing the removal of the trash directorywatchmanshutdown-server>/dev/null2>&1fi+trace_stop## Run a full set of perf tests with the fsmonitor feature disabled.#+trace_startfsmonitor-disabled test_expect_success"setup without fsmonitor"'unsetINTEGRATION_SCRIPT&&gitconfig--unsetcore.fsmonitor&&
From: Jeff Hostetler via GitGitGadget <hidden> Date: 2021-02-03 15:38:51
From: Jeff Hostetler <redacted>
Convert the test to use a more portable method to update the mtime on a
large number of files under version control.
The Mac version of xargs does not support the "-d" option.
Likewise, the "-0" and "--null" options are not portable.
Furthermore, use `test-tool chmtime` rather than `touch` to update the
mtime to ensure that it is actually updated (especially on file systems
with only whole second resolution).
Signed-off-by: Jeff Hostetler <redacted>
---
t/perf/p7519-fsmonitor.sh | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
@@ -164,8 +164,18 @@ test_fsmonitor_suite() {gitstatus-uall'+# Update the mtimes on upto 100k files to make status think+# that they are dirty. For simplicity, omit any files with+# LFs (i.e. anything that ls-files thinks it needs to dquote).+# Then fully backslash-quote the paths to capture any+# whitespace so that they pass thru xargs properly.+#test_perf_w_drop_caches"status (dirty) ($DESC)"'-gitls-files|head-100000|xargs-d"\n"touch-h&&+gitls-files|\+head-100000|\+grep-v\"|\+sed'\''s/\(.\)/\\\1/g'\''|\+xargstest-toolchmtime-300&&gitstatus'
From: Jeff Hostetler via GitGitGadget <hidden> Date: 2021-02-03 15:39:26
From: Jeff Hostetler <redacted>
Only use the final portion of the test trash directory file name
when verifying that Watchman was started.
On Windows and under the SDK, $GIT_WORKTREE is a cygwin-style
path with forward slashes and a "/c/" drive name. However
`watchman watch-list` reports a proper Windows-style pathname
with drive letters and backslashes. This causes the grep to
fail. Since we don't really care about the full pathname (and
we really don't want to bother with normalizaing them), just see
if the test-name portion of the path is found.
Signed-off-by: Jeff Hostetler <redacted>
---
t/perf/p7519-fsmonitor.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -101,7 +101,7 @@ test_expect_success "one time repo setup" '# If Watchman exists, watch the work tree and attempt a query.iftest_have_prereqWATCHMAN;thenwatchmanwatch"$GIT_WORK_TREE"&&-watchmanwatch-list|grep-q-F"$GIT_WORK_TREE"+watchmanwatch-list|grep-q-F"p7519-fsmonitor"fi'
From: Jeff Hostetler via GitGitGadget <hidden> Date: 2021-02-03 15:40:05
From: Jeff Hostetler <redacted>
Report the total number of calls made to lstat() inside of refresh_index().
FSMonitor improves the performance of commands like `git status` by
avoiding scanning the disk for changed files. This can be seen in
`refresh_index()`. Let's measure this.
Signed-off-by: Jeff Hostetler <redacted>
---
read-cache.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
From: Jeff Hostetler via GitGitGadget <hidden> Date: 2021-02-03 15:40:09
From: Jeff Hostetler <redacted>
Report the number of files in the working directory that were read and
their hashes verified in `refresh_index()`.
FSMonitor improves the performance of commands like `git status` by
avoiding scanning the disk for changed files. Let's measure this.
Signed-off-by: Jeff Hostetler <redacted>
---
read-cache.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
From: Jeff Hostetler via GitGitGadget <hidden> Date: 2021-02-03 15:40:27
From: Jeff Hostetler <redacted>
Isolate and document initialization of `istate->fsmonitor_last_update`.
This field should contain a fsmonitor-specific opaque token, but we
need to initialize it before we can actually talk to a fsmonitor process,
so we create a generic default value.
Signed-off-by: Jeff Hostetler <redacted>
---
fsmonitor.c | 35 ++++++++++++++++++++++++++++++++---
1 file changed, 32 insertions(+), 3 deletions(-)
@@ -87,7 +87,11 @@ int read_fsmonitor_extension(struct index_state *istate, const void *data,BUG("fsmonitor_dirty has more entries than the index (%"PRIuMAX" > %u)",(uintmax_t)istate->fsmonitor_dirty->bit_size,istate->cache_nr);-trace_printf_key(&trace_fsmonitor,"read fsmonitor extension successful");+trace2_data_string("index",NULL,"extension/fsmn/read/token",+istate->fsmonitor_last_update);+trace_printf_key(&trace_fsmonitor,+"read fsmonitor extension successful '%s'",+istate->fsmonitor_last_update);return0;}
@@ -190,13 +190,34 @@ int fsmonitor_is_trivial_response(const struct strbuf *query_result)returnis_trivial;}-staticvoidfsmonitor_refresh_callback(structindex_state*istate,constchar*name)+staticvoidfsmonitor_refresh_callback(structindex_state*istate,char*name){-intpos=index_name_pos(istate,name,strlen(name));+inti,len=strlen(name);+if(name[len-1]=='/'){++/*+*TODOWeshouldbinarysearchtofindthefirstpathwith+*TODOthisdirectoryprefix.Thenlinearlyupdateentries+*TODOwhiletheprefixmatches.Takingcaretosearchwithout+*TODOthetrailingslash--because'/'sortsafterafew+*TODOinterestingspecialchars,like'.'and' '.+*/++/* Mark all entries for the folder invalid */+for(i=0;i<istate->cache_nr;i++){+if(istate->cache[i]->ce_flags&CE_FSMONITOR_VALID&&+starts_with(istate->cache[i]->name,name))+istate->cache[i]->ce_flags&=~CE_FSMONITOR_VALID;+}+/* Need to remove the / from the path for the untracked cache */+name[len-1]='\0';+}else{+intpos=index_name_pos(istate,name,strlen(name));-if(pos>=0){-structcache_entry*ce=istate->cache[pos];-ce->ce_flags&=~CE_FSMONITOR_VALID;+if(pos>=0){+structcache_entry*ce=istate->cache[pos];+ce->ce_flags&=~CE_FSMONITOR_VALID;+}}/*
From: Jeff Hostetler via GitGitGadget <hidden> Date: 2021-02-03 15:40:54
From: Jeff Hostetler <redacted>
Let's measure the time taken to request and receive FSMonitor data
via the hook API and the size of the response.
Signed-off-by: Jeff Hostetler <redacted>
---
fsmonitor.c | 29 ++++++++++++++++++++++++++++-
fsmonitor.h | 5 +++++
2 files changed, 33 insertions(+), 1 deletion(-)
From: Jeff Hostetler via GitGitGadget <hidden> Date: 2021-02-03 15:52:47
From: Jeff Hostetler <redacted>
Report the total number of calls made to lstat() inside preload_index().
FSMonitor improves the performance of commands like `git status` by
avoiding scanning the disk for changed files. This can be seen in
`preload_index()`. Let's measure this.
Signed-off-by: Jeff Hostetler <redacted>
---
preload-index.c | 10 ++++++++++
1 file changed, 10 insertions(+)
From: Jeff Hostetler via GitGitGadget <hidden> Date: 2021-02-03 15:54:54
Here is version 2 of this series.
In version 1, I replaced the non-portable "xargs -d" with "xargs -0", but it
turns out that that too is not universally available. In this version I
replace the need for either one by filtering out the problematic paths (such
as ones with LFs) and quoting paths to handle whitespace. The resulting
paths can be passed to xargs without any arguments.
Also, I updated the test to use test-tool chmtime rather than touch to
ensure that the files actually look dirty on low-resolution file systems.
Jeff Hostetler (10):
p7519: do not rely on "xargs -d" in test
p7519: fix watchman watch-list test on Windows
p7519: move watchman cleanup earlier in the test
p7519: add trace logging during perf test
preload-index: log the number of lstat calls to trace2
read-cache: log the number of lstat calls to trace2
read-cache: log the number of scanned files to trace2
fsmonitor: log invocation of FSMonitor hook to trace2
fsmonitor: log FSMN token when reading and writing the index
fsmonitor: refactor initialization of fsmonitor_last_update token
Kevin Willford (1):
fsmonitor: allow all entries for a folder to be invalidated
fsmonitor.c | 107 ++++++++++++++++++++++++++++++++++----
fsmonitor.h | 5 ++
preload-index.c | 10 ++++
read-cache.c | 24 +++++++--
t/perf/.gitignore | 1 +
t/perf/Makefile | 4 +-
t/perf/p7519-fsmonitor.sh | 71 +++++++++++++++++++++----
7 files changed, 196 insertions(+), 26 deletions(-)
base-commit: 71ca53e8125e36efbda17293c50027d31681a41f
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-860%2Fjeffhostetler%2Ffsmonitor-prework-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-860/jeffhostetler/fsmonitor-prework-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/860
Range-diff vs v1:
1: cf252e24b8c ! 1: e570f7316cc p7519: use xargs -0 rather than -d in test
@@ Metadata
Author: Jeff Hostetler [off-list ref]
## Commit message ##
- p7519: use xargs -0 rather than -d in test
+ p7519: do not rely on "xargs -d" in test
- The Mac version of xargs does not support the "-d" option. Convert the test
- setup to pipe the data set thru `lf_to_nul | xargs -0` instead.
+ Convert the test to use a more portable method to update the mtime on a
+ large number of files under version control.
+
+ The Mac version of xargs does not support the "-d" option.
+ Likewise, the "-0" and "--null" options are not portable.
+
+ Furthermore, use `test-tool chmtime` rather than `touch` to update the
+ mtime to ensure that it is actually updated (especially on file systems
+ with only whole second resolution).
Signed-off-by: Jeff Hostetler [off-list ref]
## t/perf/p7519-fsmonitor.sh ##
@@ t/perf/p7519-fsmonitor.sh: test_fsmonitor_suite() {
+ git status -uall
'
++ # Update the mtimes on upto 100k files to make status think
++ # that they are dirty. For simplicity, omit any files with
++ # LFs (i.e. anything that ls-files thinks it needs to dquote).
++ # Then fully backslash-quote the paths to capture any
++ # whitespace so that they pass thru xargs properly.
++ #
test_perf_w_drop_caches "status (dirty) ($DESC)" '
- git ls-files | head -100000 | xargs -d "\n" touch -h &&
-+ git ls-files | head -100000 | lf_to_nul | xargs -0 touch -h &&
++ git ls-files | \
++ head -100000 | \
++ grep -v \" | \
++ sed '\''s/\(.\)/\\\1/g'\'' | \
++ xargs test-tool chmtime -300 &&
git status
'
2: a641f9e357c = 2: 3042fc92fe6 p7519: fix watchman watch-list test on Windows
3: 2af6858716f = 3: 9ceba5e6942 p7519: move watchman cleanup earlier in the test
4: 8de9985a706 = 4: f6ea0a51f50 p7519: add trace logging during perf test
5: cdd49f1fdb1 = 5: 3c5035e4649 preload-index: log the number of lstat calls to trace2
6: 65488f7a1bf = 6: d150a2d4576 read-cache: log the number of lstat calls to trace2
7: c84531f6244 = 7: 33cc0b838fa read-cache: log the number of scanned files to trace2
8: ef64b60c7a0 = 8: c043bccc8af fsmonitor: log invocation of FSMonitor hook to trace2
9: edb88ffe39e = 9: 6ec4a4468f6 fsmonitor: log FSMN token when reading and writing the index
10: 384d2eff863 = 10: 2ac66f07a59 fsmonitor: allow all entries for a folder to be invalidated
11: 4686196bbc6 = 11: 5410d3ab61d fsmonitor: refactor initialization of fsmonitor_last_update token
--
gitgitgadget
From: Taylor Blau <hidden> Date: 2021-02-03 21:20:47
Hi Jeff,
On Mon, Feb 01, 2021 at 10:02:09PM +0000, Jeff Hostetler via GitGitGadget wrote:
This patch series fixes runtime errors in t/perf/p7519 on Windows and MacOS.
It adds Trace2 logging to p7519 to make it easier to compare results when
Watchman is enabled and disabled. And finally, it adds some Trace2 regions
and data events around our usage of Watchman and the existing FSMonitor
framework.
I read v2 of this series and it all looked very sane to me. I didn't
have much in the way of comments or concerns along the way, so that
version of the series has my reviewed-by.
Thanks,
Taylor
From: Jeff Hostetler <hidden> Date: 2021-02-16 19:00:50
On 2/3/21 10:34 AM, Jeff Hostetler via GitGitGadget wrote:
Here is version 2 of this series.
I didn't see this series in the "what's cooking" emails and
was wondering if there was something that I still needed to
attend to.
Thanks
Jeff
In version 1, I replaced the non-portable "xargs -d" with "xargs -0", but it
turns out that that too is not universally available. In this version I
replace the need for either one by filtering out the problematic paths (such
as ones with LFs) and quoting paths to handle whitespace. The resulting
paths can be passed to xargs without any arguments.
Also, I updated the test to use test-tool chmtime rather than touch to
ensure that the files actually look dirty on low-resolution file systems.
Jeff Hostetler (10):
p7519: do not rely on "xargs -d" in test
p7519: fix watchman watch-list test on Windows
p7519: move watchman cleanup earlier in the test
p7519: add trace logging during perf test
preload-index: log the number of lstat calls to trace2
read-cache: log the number of lstat calls to trace2
read-cache: log the number of scanned files to trace2
fsmonitor: log invocation of FSMonitor hook to trace2
fsmonitor: log FSMN token when reading and writing the index
fsmonitor: refactor initialization of fsmonitor_last_update token
Kevin Willford (1):
fsmonitor: allow all entries for a folder to be invalidated
fsmonitor.c | 107 ++++++++++++++++++++++++++++++++++----
fsmonitor.h | 5 ++
preload-index.c | 10 ++++
read-cache.c | 24 +++++++--
t/perf/.gitignore | 1 +
t/perf/Makefile | 4 +-
t/perf/p7519-fsmonitor.sh | 71 +++++++++++++++++++++----
7 files changed, 196 insertions(+), 26 deletions(-)
base-commit: 71ca53e8125e36efbda17293c50027d31681a41f
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-860%2Fjeffhostetler%2Ffsmonitor-prework-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-860/jeffhostetler/fsmonitor-prework-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/860
Range-diff vs v1:
1: cf252e24b8c ! 1: e570f7316cc p7519: use xargs -0 rather than -d in test
@@ Metadata
Author: Jeff Hostetler [off-list ref]
## Commit message ##
- p7519: use xargs -0 rather than -d in test
+ p7519: do not rely on "xargs -d" in test
- The Mac version of xargs does not support the "-d" option. Convert the test
- setup to pipe the data set thru `lf_to_nul | xargs -0` instead.
+ Convert the test to use a more portable method to update the mtime on a
+ large number of files under version control.
+
+ The Mac version of xargs does not support the "-d" option.
+ Likewise, the "-0" and "--null" options are not portable.
+
+ Furthermore, use `test-tool chmtime` rather than `touch` to update the
+ mtime to ensure that it is actually updated (especially on file systems
+ with only whole second resolution).
Signed-off-by: Jeff Hostetler [off-list ref]
## t/perf/p7519-fsmonitor.sh ##
@@ t/perf/p7519-fsmonitor.sh: test_fsmonitor_suite() {
+ git status -uall
'
++ # Update the mtimes on upto 100k files to make status think
++ # that they are dirty. For simplicity, omit any files with
++ # LFs (i.e. anything that ls-files thinks it needs to dquote).
++ # Then fully backslash-quote the paths to capture any
++ # whitespace so that they pass thru xargs properly.
++ #
test_perf_w_drop_caches "status (dirty) ($DESC)" '
- git ls-files | head -100000 | xargs -d "\n" touch -h &&
-+ git ls-files | head -100000 | lf_to_nul | xargs -0 touch -h &&
++ git ls-files | \
++ head -100000 | \
++ grep -v \" | \
++ sed '\''s/\(.\)/\\\1/g'\'' | \
++ xargs test-tool chmtime -300 &&
git status
'
2: a641f9e357c = 2: 3042fc92fe6 p7519: fix watchman watch-list test on Windows
3: 2af6858716f = 3: 9ceba5e6942 p7519: move watchman cleanup earlier in the test
4: 8de9985a706 = 4: f6ea0a51f50 p7519: add trace logging during perf test
5: cdd49f1fdb1 = 5: 3c5035e4649 preload-index: log the number of lstat calls to trace2
6: 65488f7a1bf = 6: d150a2d4576 read-cache: log the number of lstat calls to trace2
7: c84531f6244 = 7: 33cc0b838fa read-cache: log the number of scanned files to trace2
8: ef64b60c7a0 = 8: c043bccc8af fsmonitor: log invocation of FSMonitor hook to trace2
9: edb88ffe39e = 9: 6ec4a4468f6 fsmonitor: log FSMN token when reading and writing the index
10: 384d2eff863 = 10: 2ac66f07a59 fsmonitor: allow all entries for a folder to be invalidated
11: 4686196bbc6 = 11: 5410d3ab61d fsmonitor: refactor initialization of fsmonitor_last_update token