projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add start of mount check
[fio.git]
/
lib
/
zipf.c
diff --git
a/lib/zipf.c
b/lib/zipf.c
index 41e20554b3d019885ed76c9fbe9b66183c4100cf..c691bc51a5a57f6e84ef2450d47fb0ad12f02bcc 100644
(file)
--- a/
lib/zipf.c
+++ b/
lib/zipf.c
@@
-11,7
+11,7
@@
#include "../minmax.h"
#include "../hash.h"
#include "../minmax.h"
#include "../hash.h"
-#define ZIPF_MAX_GEN 10000000
+#define ZIPF_MAX_GEN 10000000
UL
static void zipf_update(struct zipf_state *zs)
{
static void zipf_update(struct zipf_state *zs)
{
@@
-23,7
+23,7
@@
static void zipf_update(struct zipf_state *zs)
* 10M max, that should be doable in 1-2s on even slow machines.
* Precision will take a slight hit, but nothing major.
*/
* 10M max, that should be doable in 1-2s on even slow machines.
* Precision will take a slight hit, but nothing major.
*/
- to_gen = min(zs->nranges, ZIPF_MAX_GEN);
+ to_gen = min(zs->nranges,
(uint64_t)
ZIPF_MAX_GEN);
for (i = 0; i < to_gen; i++)
zs->zetan += pow(1.0 / (double) (i + 1), zs->theta);
for (i = 0; i < to_gen; i++)
zs->zetan += pow(1.0 / (double) (i + 1), zs->theta);
@@
-69,7
+69,7
@@
unsigned long long zipf_next(struct zipf_state *zs)
else
val = 1 + (unsigned long long)(n * pow(eta*rand_uni - eta + 1.0, alpha));
else
val = 1 + (unsigned long long)(n * pow(eta*rand_uni - eta + 1.0, alpha));
- return (__hash_
long
(val - 1) + zs->rand_off) % zs->nranges;
+ return (__hash_
u64
(val - 1) + zs->rand_off) % zs->nranges;
}
void pareto_init(struct zipf_state *zs, unsigned long nranges, double h,
}
void pareto_init(struct zipf_state *zs, unsigned long nranges, double h,
@@
-84,5
+84,5
@@
unsigned long long pareto_next(struct zipf_state *zs)
double rand = (double) __rand(&zs->rand) / (double) FRAND_MAX;
unsigned long long n = zs->nranges - 1;
double rand = (double) __rand(&zs->rand) / (double) FRAND_MAX;
unsigned long long n = zs->nranges - 1;
- return (__hash_
long
(n * pow(rand, zs->pareto_pow)) + zs->rand_off) % zs->nranges;
+ return (__hash_
u64
(n * pow(rand, zs->pareto_pow)) + zs->rand_off) % zs->nranges;
}
}