1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-10 01:18:15 +03:00

locking: Update locking bucket intervals

0   < 1 ms
 1   < 10 ms
 2   < 100 ms
 3   < 1 s
 4   < 2 s
 5   < 4 s
 6   < 8 s
 7   < 16 s
 8   < 32 s
 9   < 64 s
10   >= 64 s

Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 6fc36a7036933237d09151a0baf4d8ccd2bc2c99)
This commit is contained in:
Amitay Isaacs 2013-07-03 11:01:21 +10:00
parent 1afb7fccb2
commit 9ae379c91a

View File

@ -386,27 +386,31 @@ static void process_callbacks(struct lock_context *lock_ctx, bool locked)
static int lock_bucket_id(double t)
{
double us = 1.e-6, ms = 1.e-3, s = 1;
double ms = 1.e-3, s = 1;
int id;
if (t < 1*us) {
if (t < 1*ms) {
id = 0;
} else if (t < 10*us) {
id = 1;
} else if (t < 100*us) {
id = 2;
} else if (t < 1*ms) {
id = 3;
} else if (t < 10*ms) {
id = 4;
id = 1;
} else if (t < 100*ms) {
id = 5;
id = 2;
} else if (t < 1*s) {
id = 3;
} else if (t < 2*s) {
id = 4;
} else if (t < 4*s) {
id = 5;
} else if (t < 8*s) {
id = 6;
} else if (t < 10*s) {
} else if (t < 16*s) {
id = 7;
} else {
} else if (t < 32*s) {
id = 8;
} else if (t < 64*s) {
id = 9;
} else {
id = 10;
}
return id;