mdbx: a lot of spelling (squashed).

Many Thanks to Josh Soref for these fixes.
https://github.com/jsoref

Resolves https://github.com/erthink/libmdbx/pull/118.

Change-Id: I4e09347da5c9d7a77cdd918a3b15284371440076
This commit is contained in:
Josh Soref
2020-09-21 23:51:47 -04:00
committed by Leonid Yuriev
parent 6a99303ec1
commit 448728f584
26 changed files with 156 additions and 154 deletions

View File

@@ -103,7 +103,7 @@ time now_realtime() {
#endif
}
time now_motonic() {
time now_monotonic() {
#if defined(_WIN32) || defined(_WIN64) || defined(_WINDOWS)
static uint64_t reciprocal;
static LARGE_INTEGER Frequency;

View File

@@ -94,6 +94,6 @@ inline time from_timeval(const struct timeval &tv) {
#endif /* HAVE_TIMEVAL_TV_USEC */
time now_realtime();
time now_motonic();
time now_monotonic();
} /* namespace chrono */

View File

@@ -31,7 +31,7 @@ bool parse_option(int argc, char *const argv[], int &narg, const char *option,
if (!value) {
if (current[optlen + 2] == '=')
failure("Option '--%s' doen't accept any value\n", option);
failure("Option '--%s' doesn't accept any value\n", option);
return true;
}
@@ -45,7 +45,7 @@ bool parse_option(int argc, char *const argv[], int &narg, const char *option,
*value = argv[narg + 1];
if (strcmp(*value, "default") == 0) {
if (!default_value)
failure("Option '--%s' doen't accept default value\n", option);
failure("Option '--%s' doesn't accept default value\n", option);
*value = default_value;
}
++narg;
@@ -74,7 +74,7 @@ bool parse_option(int argc, char *const argv[], int &narg, const char *option,
return false;
if (!allow_empty && strlen(value_cstr) == 0)
failure("Value for option '--%s' could't be empty\n", option);
failure("Value for option '--%s' couldn't be empty\n", option);
value = value_cstr;
return true;
@@ -157,34 +157,34 @@ bool parse_option(int argc, char *const argv[], int &narg, const char *option,
failure("Option '--%s' expects a numeric value (%s)\n", option,
test_strerror(errno));
uint64_t multipler = 1;
uint64_t multiplier = 1;
if (suffix && *suffix) {
if (scale == no_scale)
failure("Option '--%s' doen't accepts suffixes, so '%s' is unexpected\n",
failure("Option '--%s' doesn't accepts suffixes, so '%s' is unexpected\n",
option, suffix);
if (strcmp(suffix, "K") == 0 || strcasecmp(suffix, "Kilo") == 0)
multipler = (scale == decimal) ? UINT64_C(1000) : UINT64_C(1024);
multiplier = (scale == decimal) ? UINT64_C(1000) : UINT64_C(1024);
else if (strcmp(suffix, "M") == 0 || strcasecmp(suffix, "Mega") == 0)
multipler =
multiplier =
(scale == decimal) ? UINT64_C(1000) * 1000 : UINT64_C(1024) * 1024;
else if (strcmp(suffix, "G") == 0 || strcasecmp(suffix, "Giga") == 0)
multipler = (scale == decimal) ? UINT64_C(1000) * 1000 * 1000
: UINT64_C(1024) * 1024 * 1024;
multiplier = (scale == decimal) ? UINT64_C(1000) * 1000 * 1000
: UINT64_C(1024) * 1024 * 1024;
else if (strcmp(suffix, "T") == 0 || strcasecmp(suffix, "Tera") == 0)
multipler = (scale == decimal) ? UINT64_C(1000) * 1000 * 1000 * 1000
: UINT64_C(1024) * 1024 * 1024 * 1024;
multiplier = (scale == decimal) ? UINT64_C(1000) * 1000 * 1000 * 1000
: UINT64_C(1024) * 1024 * 1024 * 1024;
else if (scale == duration &&
(strcmp(suffix, "s") == 0 || strcasecmp(suffix, "Seconds") == 0))
multipler = 1;
multiplier = 1;
else if (scale == duration &&
(strcmp(suffix, "m") == 0 || strcasecmp(suffix, "Minutes") == 0))
multipler = 60;
multiplier = 60;
else if (scale == duration &&
(strcmp(suffix, "h") == 0 || strcasecmp(suffix, "Hours") == 0))
multipler = 3600;
multiplier = 3600;
else if (scale == duration &&
(strcmp(suffix, "d") == 0 || strcasecmp(suffix, "Days") == 0))
multipler = 3600 * 24;
multiplier = 3600 * 24;
else
failure(
"Option '--%s' expects a numeric value with Kilo/Mega/Giga/Tera %s"
@@ -193,10 +193,10 @@ bool parse_option(int argc, char *const argv[], int &narg, const char *option,
suffix);
}
if (raw >= UINT64_MAX / multipler)
if (raw >= UINT64_MAX / multiplier)
failure("The value for option '--%s' is too huge\n", option);
value = raw * multipler;
value = raw * multiplier;
if (maxval && value > maxval)
failure("The maximal value for option '--%s' is %" PRIu64 "\n", option,
maxval);

View File

@@ -239,7 +239,7 @@ local_suffix::~local_suffix() { suffix.erase(trim_pos); }
void progress_canary(bool active) {
static chrono::time progress_timestamp;
chrono::time now = chrono::now_motonic();
chrono::time now = chrono::now_monotonic();
if (now.fixedpoint - progress_timestamp.fixedpoint <
chrono::from_ms(42).fixedpoint)

View File

@@ -26,7 +26,7 @@ void __noreturn usage(void) {
"Common parameters:\n"
" --pathname=... Path and/or name of database files\n"
" --repeat=N Set repeat counter\n"
" --threads=N Number of thread (unsunpported for now)\n"
" --threads=N Number of thread (unsupported for now)\n"
" --timeout=N[s|m|h|d] Set timeout in seconds/minutes/hours/days\n"
" --failfast[=YES/no] Lill all actors on first failure/error\n"
" --max-readers=N See mdbx_env_set_maxreaders() description\n"
@@ -43,7 +43,7 @@ void __noreturn usage(void) {
" --size Initial size in Kb/Mb/Gb/Tb\n"
" --shrink-threshold Shrink threshold in Kb/Mb/Gb/Tb\n"
" --growth-step Grow step in Kb/Mb/Gb/Tb\n"
"Predefined complext scenarios/cases:\n"
"Predefined complex scenarios/cases:\n"
" --case=... Only `basic` scenario implemented for now\n"
" basic == Simultaneous multi-process execution\n"
" of test-actors: nested,hill,ttl,copy,append,jitter,try\n"
@@ -186,8 +186,8 @@ std::unordered_map<unsigned, actor_config *> events;
std::unordered_map<mdbx_pid_t, actor_config *> pid2actor;
std::set<std::string> databases;
unsigned nactors;
chrono::time start_motonic;
chrono::time deadline_motonic;
chrono::time start_monotonic;
chrono::time deadline_monotonic;
bool singlemode;
namespace config {
@@ -504,11 +504,11 @@ int main(int argc, char *const argv[]) {
}
bool failed = false;
global::start_motonic = chrono::now_motonic();
global::deadline_motonic.fixedpoint =
global::start_monotonic = chrono::now_monotonic();
global::deadline_monotonic.fixedpoint =
(global::config::timeout_duration_seconds == 0)
? chrono::infinite().fixedpoint
: global::start_motonic.fixedpoint +
: global::start_monotonic.fixedpoint +
chrono::from_seconds(global::config::timeout_duration_seconds)
.fixedpoint;
@@ -557,14 +557,14 @@ int main(int argc, char *const argv[]) {
log_trace("=== polling...");
while (left > 0) {
unsigned timeout_seconds_left = INT_MAX;
chrono::time now_motonic = chrono::now_motonic();
if (now_motonic.fixedpoint >= global::deadline_motonic.fixedpoint)
chrono::time now_monotonic = chrono::now_monotonic();
if (now_monotonic.fixedpoint >= global::deadline_monotonic.fixedpoint)
timeout_seconds_left = 0;
else {
chrono::time left_motonic;
left_motonic.fixedpoint =
global::deadline_motonic.fixedpoint - now_motonic.fixedpoint;
timeout_seconds_left = left_motonic.seconds();
chrono::time left_monotonic;
left_monotonic.fixedpoint =
global::deadline_monotonic.fixedpoint - now_monotonic.fixedpoint;
timeout_seconds_left = left_monotonic.seconds();
}
mdbx_pid_t pid;

View File

@@ -335,7 +335,7 @@ bool osal_progress_push(bool active) {
//-----------------------------------------------------------------------------
static std::unordered_map<pid_t, actor_status> childs;
static std::unordered_map<pid_t, actor_status> children;
static std::atomic<int> sigalarm_head;
static void handler_SIGCHLD(int signum) {
@@ -348,7 +348,7 @@ mdbx_pid_t osal_getpid(void) { return getpid(); }
int osal_delay(unsigned seconds) { return sleep(seconds) ? errno : 0; }
int osal_actor_start(const actor_config &config, mdbx_pid_t &pid) {
if (childs.empty()) {
if (children.empty()) {
struct sigaction act;
memset(&act, 0, sizeof(act));
act.sa_handler = handler_SIGCHLD;
@@ -379,14 +379,14 @@ int osal_actor_start(const actor_config &config, mdbx_pid_t &pid) {
log_trace("osal_actor_start: fork pid %ld for %u", (long)pid,
config.actor_id);
childs[pid] = as_running;
children[pid] = as_running;
return 0;
}
actor_status osal_actor_info(const mdbx_pid_t pid) { return childs.at(pid); }
actor_status osal_actor_info(const mdbx_pid_t pid) { return children.at(pid); }
void osal_killall_actors(void) {
for (auto &pair : childs) {
for (auto &pair : children) {
kill(pair.first, SIGKILL);
pair.second = as_killed;
}
@@ -416,16 +416,16 @@ int osal_actor_poll(mdbx_pid_t &pid, unsigned timeout) {
if (pid > 0) {
if (WIFEXITED(status))
childs[pid] =
children[pid] =
(WEXITSTATUS(status) == EXIT_SUCCESS) ? as_successful : as_failed;
else if (WCOREDUMP(status))
childs[pid] = as_coredump;
children[pid] = as_coredump;
else if (WIFSIGNALED(status))
childs[pid] = as_killed;
children[pid] = as_killed;
else if (WIFSTOPPED(status))
childs[pid] = as_debugging;
children[pid] = as_debugging;
else if (WIFCONTINUED(status))
childs[pid] = as_running;
children[pid] = as_running;
else {
assert(false);
}
@@ -462,7 +462,7 @@ void osal_yield(void) {
}
void osal_udelay(unsigned us) {
chrono::time until, now = chrono::now_motonic();
chrono::time until, now = chrono::now_monotonic();
until.fixedpoint = now.fixedpoint + chrono::from_us(us).fixedpoint;
struct timespec ts;
@@ -505,7 +505,7 @@ void osal_udelay(unsigned us) {
}
cpu_relax();
now = chrono::now_motonic();
now = chrono::now_monotonic();
} while (until.fixedpoint > now.fixedpoint);
}

View File

@@ -186,10 +186,10 @@ bool actor_config::osal_deserialize(const char *str, const char *end,
//-----------------------------------------------------------------------------
typedef std::pair<HANDLE, actor_status> child;
static std::unordered_map<mdbx_pid_t, child> childs;
static std::unordered_map<mdbx_pid_t, child> children;
bool osal_progress_push(bool active) {
if (!childs.empty()) {
if (!children.empty()) {
if (!SetEvent(active ? hProgressActiveEvent : hProgressPassiveEvent))
failure_perror("osal_progress_push: SetEvent(overlord.progress)",
GetLastError());
@@ -284,8 +284,8 @@ Environment:
}
int osal_actor_start(const actor_config &config, mdbx_pid_t &pid) {
if (childs.size() == MAXIMUM_WAIT_OBJECTS)
failure("Could't manage more that %u actors on Windows\n",
if (children.size() == MAXIMUM_WAIT_OBJECTS)
failure("Couldn't manage more that %u actors on Windows\n",
MAXIMUM_WAIT_OBJECTS);
_flushall();
@@ -324,17 +324,17 @@ int osal_actor_start(const actor_config &config, mdbx_pid_t &pid) {
CloseHandle(ProcessInformation.hThread);
pid = ProcessInformation.dwProcessId;
childs[pid] = std::make_pair(ProcessInformation.hProcess, as_running);
children[pid] = std::make_pair(ProcessInformation.hProcess, as_running);
return 0;
}
actor_status osal_actor_info(const mdbx_pid_t pid) {
actor_status status = childs.at(pid).second;
actor_status status = children.at(pid).second;
if (status > as_running)
return status;
DWORD ExitCode;
if (!GetExitCodeProcess(childs.at(pid).first, &ExitCode))
if (!GetExitCodeProcess(children.at(pid).first, &ExitCode))
failure_perror("GetExitCodeProcess()", GetLastError());
switch (ExitCode) {
@@ -364,21 +364,21 @@ actor_status osal_actor_info(const mdbx_pid_t pid) {
break;
}
childs.at(pid).second = status;
children.at(pid).second = status;
return status;
}
void osal_killall_actors(void) {
for (auto &pair : childs)
for (auto &pair : children)
TerminateProcess(pair.second.first, STATUS_CONTROL_C_EXIT);
}
int osal_actor_poll(mdbx_pid_t &pid, unsigned timeout) {
std::vector<HANDLE> handles;
handles.reserve(childs.size() + 2);
handles.reserve(children.size() + 2);
handles.push_back(hProgressActiveEvent);
handles.push_back(hProgressPassiveEvent);
for (const auto &pair : childs)
for (const auto &pair : children)
if (pair.second.second <= as_running)
handles.push_back(pair.second.first);
@@ -399,7 +399,7 @@ int osal_actor_poll(mdbx_pid_t &pid, unsigned timeout) {
if (rc >= WAIT_OBJECT_0 + 2 && rc < WAIT_OBJECT_0 + handles.size()) {
pid = 0;
for (const auto &pair : childs)
for (const auto &pair : children)
if (pair.second.first == handles[rc - WAIT_OBJECT_0]) {
pid = pair.first;
break;
@@ -419,7 +419,7 @@ int osal_actor_poll(mdbx_pid_t &pid, unsigned timeout) {
void osal_yield(void) { SwitchToThread(); }
void osal_udelay(unsigned us) {
chrono::time until, now = chrono::now_motonic();
chrono::time until, now = chrono::now_monotonic();
until.fixedpoint = now.fixedpoint + chrono::from_us(us).fixedpoint;
static unsigned threshold_us;
@@ -440,7 +440,7 @@ void osal_udelay(unsigned us) {
}
YieldProcessor();
now = chrono::now_motonic();
now = chrono::now_monotonic();
} while (now.fixedpoint < until.fixedpoint);
}

View File

@@ -376,7 +376,7 @@ bool testcase::setup() {
if (!wait4start())
return false;
start_timestamp = chrono::now_motonic();
start_timestamp = chrono::now_monotonic();
nops_completed = 0;
return true;
}
@@ -395,7 +395,7 @@ bool testcase::should_continue(bool check_timeout_only) const {
if (config.params.test_duration) {
chrono::time since;
since.fixedpoint =
chrono::now_motonic().fixedpoint - start_timestamp.fixedpoint;
chrono::now_monotonic().fixedpoint - start_timestamp.fixedpoint;
if (since.seconds() >= config.params.test_duration)
result = false;
}

View File

@@ -56,8 +56,8 @@ extern std::unordered_map<unsigned, actor_config *> events;
extern std::unordered_map<mdbx_pid_t, actor_config *> pid2actor;
extern std::set<std::string> databases;
extern unsigned nactors;
extern chrono::time start_motonic;
extern chrono::time deadline_motonic;
extern chrono::time start_monotonic;
extern chrono::time deadline_monotonic;
extern bool singlemode;
namespace config {