Merge commit '22cb2f79ddb89a368dd823e815fa1b0587ff1b6a'

pull/2415/head
Roman Perepelitsa 1 year ago
commit 2d9c1f271b

@ -255,7 +255,7 @@ repository was checked out to an ext4 filesystem on M.2 SSD.
Three functionally equivalent tools for computing git status were benchmarked: Three functionally equivalent tools for computing git status were benchmarked:
* `gitstatusd` * `gitstatusd`
* `git` with untracked cache enabled * `git` with `core.untrackedcache` enabled and `core.fsmonitor` disabled
* `lg2` -- a demo/example executable from [libgit2](https://github.com/romkatv/libgit2) that * `lg2` -- a demo/example executable from [libgit2](https://github.com/romkatv/libgit2) that
implements a subset of `git` functionality on top of libgit2 API; for the purposes of this implements a subset of `git` functionality on top of libgit2 API; for the purposes of this
benchmark the subset is sufficient to generate the same data as the other tools benchmark the subset is sufficient to generate the same data as the other tools
@ -381,7 +381,7 @@ generated with the same tools and the same flags as the profile of libgit2.
Since both profiles were generated from the same workload, absolute numbers can be compared. We can Since both profiles were generated from the same workload, absolute numbers can be compared. We can
see that gitstatusd took 62 seconds in total compared to libgit2's 232 seconds. System calls at the see that gitstatusd took 62 seconds in total compared to libgit2's 232 seconds. System calls at the
core of the algorithm are cleary visible. `__GI___fxstatat` is a flavor of `stat()`, and the other core of the algorithm are clearly visible. `__GI___fxstatat` is a flavor of `stat()`, and the other
three calls -- `__libc_openat64`, `__libc_close` and `__GI___fxstat` are responsible for opening three calls -- `__libc_openat64`, `__libc_close` and `__GI___fxstat` are responsible for opening
directories and finding untracked files. Notice that there is almost nothing else in the profile directories and finding untracked files. Notice that there is almost nothing else in the profile
apart from these calls. The rest of the code accounts for 3.77 seconds of CPU time -- 32 times less apart from these calls. The rest of the code accounts for 3.77 seconds of CPU time -- 32 times less

@ -290,7 +290,7 @@ function gitstatus_stop() {
unset _GITSTATUS_DIRTY_MAX_INDEX_SIZE _GITSTATUS_CLIENT_PID unset _GITSTATUS_DIRTY_MAX_INDEX_SIZE _GITSTATUS_CLIENT_PID
} }
# Retrives status of a git repository from a directory under its working tree. # Retrieves status of a git repository from a directory under its working tree.
# #
# Usage: gitstatus_query [OPTION]... # Usage: gitstatus_query [OPTION]...
# #

@ -59,7 +59,7 @@ zmodload -F zsh/files b:zf_rm || return
typeset -g _gitstatus_plugin_dir"${1:-}"="${${(%):-%x}:A:h}" typeset -g _gitstatus_plugin_dir"${1:-}"="${${(%):-%x}:A:h}"
# Retrives status of a git repo from a directory under its working tree. # Retrieves status of a git repo from a directory under its working tree.
# #
## Usage: gitstatus_query [OPTION]... NAME ## Usage: gitstatus_query [OPTION]... NAME
# #

@ -23,7 +23,7 @@
#include <stdexcept> #include <stdexcept>
// The argument must be an expression convertible to bool. // The argument must be an expression convertible to bool.
// Does nothing if the expression evalutes to true. Otherwise // Does nothing if the expression evaluates to true. Otherwise
// it's equivalent to LOG(FATAL). // it's equivalent to LOG(FATAL).
#define CHECK(cond...) \ #define CHECK(cond...) \
static_cast<void>(0), (!!(cond)) ? static_cast<void>(0) : LOG(FATAL) << #cond << ": " static_cast<void>(0), (!!(cond)) ? static_cast<void>(0) : LOG(FATAL) << #cond << ": "

@ -25,7 +25,7 @@
namespace gitstatus { namespace gitstatus {
// On error, leaves entries unchaged and returns false. Does not throw. // On error, leaves entries unchanged and returns false. Does not throw.
// //
// On success, appends names of files from the specified directory to entries and returns true. // On success, appends names of files from the specified directory to entries and returns true.
// Every appended entry is a null-terminated string. At -1 offset is its d_type. All elements // Every appended entry is a null-terminated string. At -1 offset is its d_type. All elements

@ -61,7 +61,7 @@ size_t ParseSizeT(const char* s) {
void PrintUsage() { void PrintUsage() {
std::cout << "Usage: gitstatusd [OPTION]...\n" std::cout << "Usage: gitstatusd [OPTION]...\n"
<< "Print machine-readable status of the git repos for directores in stdin.\n" << "Print machine-readable status of the git repos for directories in stdin.\n"
<< "\n" << "\n"
<< "OPTIONS\n" << "OPTIONS\n"
<< " -l, --lock-fd=NUM [default=-1]\n" << " -l, --lock-fd=NUM [default=-1]\n"
@ -78,7 +78,7 @@ void PrintUsage() {
<< " maximum performance.\n" << " maximum performance.\n"
<< "\n" << "\n"
<< " -v, --log-level=STR [default=INFO]\n" << " -v, --log-level=STR [default=INFO]\n"
<< " Don't write entires to log whose log level is below this. Log levels in\n" << " Don't write entries to log whose log level is below this. Log levels in\n"
<< " increasing order: DEBUG, INFO, WARN, ERROR, FATAL.\n" << " increasing order: DEBUG, INFO, WARN, ERROR, FATAL.\n"
<< "\n" << "\n"
<< " -r, --repo-ttl-seconds=NUM [default=3600]\n" << " -r, --repo-ttl-seconds=NUM [default=3600]\n"
@ -141,7 +141,7 @@ void PrintUsage() {
<< "\n" << "\n"
<< " 1. Request ID. Any string. Can be empty.\n" << " 1. Request ID. Any string. Can be empty.\n"
<< " 2. Path to the directory for which git stats are being requested.\n" << " 2. Path to the directory for which git stats are being requested.\n"
<< " If the first character is ':', it is removed and the remaning path\n" << " If the first character is ':', it is removed and the remaining path\n"
<< " is treated as GIT_DIR.\n" << " is treated as GIT_DIR.\n"
<< " 3. (Optional) '1' to disable computation of anything that requires reading\n" << " 3. (Optional) '1' to disable computation of anything that requires reading\n"
<< " git index; '0' for the default behavior of computing everything.\n" << " git index; '0' for the default behavior of computing everything.\n"

@ -62,7 +62,7 @@ struct Options : Limits {
// If non-negative, send signal 0 to the specified PID when not receiving any requests for one // If non-negative, send signal 0 to the specified PID when not receiving any requests for one
// second; exit if signal sending fails. // second; exit if signal sending fails.
int parent_pid = -1; int parent_pid = -1;
// Don't write entires to log whose log level is below this. Log levels in increasing order: // Don't write entries to log whose log level is below this. Log levels in increasing order:
// DEBUG, INFO, WARN, ERROR, FATAL. // DEBUG, INFO, WARN, ERROR, FATAL.
LogLevel log_level = INFO; LogLevel log_level = INFO;
// Close git repositories that haven't been used for this long. This is meant to release resources // Close git repositories that haven't been used for this long. This is meant to release resources

@ -155,7 +155,7 @@ IndexStats Repo::GetIndexStats(const git_oid* head, git_config* cfg) {
VERIFY(!git_repository_index(&git_index_, repo_)) << GitError(); VERIFY(!git_repository_index(&git_index_, repo_)) << GitError();
// Query an attribute (doesn't matter which) to initialize repo's attribute // Query an attribute (doesn't matter which) to initialize repo's attribute
// cache. It's a workaround for synchronization bugs (data races) in libgit2 // cache. It's a workaround for synchronization bugs (data races) in libgit2
// that result from lazy cache initialization without synchrnonization. // that result from lazy cache initialization without synchronization.
// Thankfully, subsequent cache reads and writes are properly synchronized. // Thankfully, subsequent cache reads and writes are properly synchronized.
const char* attr; const char* attr;
VERIFY(!git_attr_get(&attr, repo_, 0, "x", "x")) << GitError(); VERIFY(!git_attr_get(&attr, repo_, 0, "x", "x")) << GitError();

@ -268,7 +268,7 @@ void TagDb::ParsePack() {
} }
if (!std::is_sorted(name2id_.begin(), name2id_.end(), ByName)) { if (!std::is_sorted(name2id_.begin(), name2id_.end(), ByName)) {
// "sorted" in the header of packed-refs promisses that this won't trigger. // "sorted" in the header of packed-refs promises that this won't trigger.
std::sort(name2id_.begin(), name2id_.end(), ByName); std::sort(name2id_.begin(), name2id_.end(), ByName);
} }

Loading…
Cancel
Save