Rename prn to prng.
Rename prn to prng so that Windows doesn't choke when trying to create a file named prn.h.
This commit is contained in:
parent
62320b8551
commit
84f7cdb0c5
@ -42,7 +42,7 @@ struct ckh_s {
|
|||||||
/* Used for pseudo-random number generation. */
|
/* Used for pseudo-random number generation. */
|
||||||
#define CKH_A 1103515241
|
#define CKH_A 1103515241
|
||||||
#define CKH_C 12347
|
#define CKH_C 12347
|
||||||
uint32_t prn_state;
|
uint32_t prng_state;
|
||||||
|
|
||||||
/* Total number of items. */
|
/* Total number of items. */
|
||||||
size_t count;
|
size_t count;
|
||||||
|
@ -316,7 +316,7 @@ extern void (*je_malloc_message)(void *wcbopaque, const char *s);
|
|||||||
(((s) + PAGE_MASK) & ~PAGE_MASK)
|
(((s) + PAGE_MASK) & ~PAGE_MASK)
|
||||||
|
|
||||||
#include "jemalloc/internal/atomic.h"
|
#include "jemalloc/internal/atomic.h"
|
||||||
#include "jemalloc/internal/prn.h"
|
#include "jemalloc/internal/prng.h"
|
||||||
#include "jemalloc/internal/ckh.h"
|
#include "jemalloc/internal/ckh.h"
|
||||||
#include "jemalloc/internal/size_classes.h"
|
#include "jemalloc/internal/size_classes.h"
|
||||||
#include "jemalloc/internal/stats.h"
|
#include "jemalloc/internal/stats.h"
|
||||||
@ -342,7 +342,7 @@ extern void (*je_malloc_message)(void *wcbopaque, const char *s);
|
|||||||
#define JEMALLOC_H_STRUCTS
|
#define JEMALLOC_H_STRUCTS
|
||||||
|
|
||||||
#include "jemalloc/internal/atomic.h"
|
#include "jemalloc/internal/atomic.h"
|
||||||
#include "jemalloc/internal/prn.h"
|
#include "jemalloc/internal/prng.h"
|
||||||
#include "jemalloc/internal/ckh.h"
|
#include "jemalloc/internal/ckh.h"
|
||||||
#include "jemalloc/internal/size_classes.h"
|
#include "jemalloc/internal/size_classes.h"
|
||||||
#include "jemalloc/internal/stats.h"
|
#include "jemalloc/internal/stats.h"
|
||||||
@ -445,7 +445,7 @@ void jemalloc_prefork(void);
|
|||||||
void jemalloc_postfork(void);
|
void jemalloc_postfork(void);
|
||||||
|
|
||||||
#include "jemalloc/internal/atomic.h"
|
#include "jemalloc/internal/atomic.h"
|
||||||
#include "jemalloc/internal/prn.h"
|
#include "jemalloc/internal/prng.h"
|
||||||
#include "jemalloc/internal/ckh.h"
|
#include "jemalloc/internal/ckh.h"
|
||||||
#include "jemalloc/internal/size_classes.h"
|
#include "jemalloc/internal/size_classes.h"
|
||||||
#include "jemalloc/internal/stats.h"
|
#include "jemalloc/internal/stats.h"
|
||||||
@ -471,7 +471,7 @@ void jemalloc_postfork(void);
|
|||||||
#define JEMALLOC_H_INLINES
|
#define JEMALLOC_H_INLINES
|
||||||
|
|
||||||
#include "jemalloc/internal/atomic.h"
|
#include "jemalloc/internal/atomic.h"
|
||||||
#include "jemalloc/internal/prn.h"
|
#include "jemalloc/internal/prng.h"
|
||||||
#include "jemalloc/internal/ckh.h"
|
#include "jemalloc/internal/ckh.h"
|
||||||
#include "jemalloc/internal/size_classes.h"
|
#include "jemalloc/internal/size_classes.h"
|
||||||
#include "jemalloc/internal/stats.h"
|
#include "jemalloc/internal/stats.h"
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
/*
|
/*
|
||||||
* Simple linear congruential pseudo-random number generator:
|
* Simple linear congruential pseudo-random number generator:
|
||||||
*
|
*
|
||||||
* prn(y) = (a*x + c) % m
|
* prng(y) = (a*x + c) % m
|
||||||
*
|
*
|
||||||
* where the following constants ensure maximal period:
|
* where the following constants ensure maximal period:
|
||||||
*
|
*
|
||||||
@ -25,7 +25,7 @@
|
|||||||
* uint32_t state : Seed value.
|
* uint32_t state : Seed value.
|
||||||
* const uint32_t a, c : See above discussion.
|
* const uint32_t a, c : See above discussion.
|
||||||
*/
|
*/
|
||||||
#define prn32(r, lg_range, state, a, c) do { \
|
#define prng32(r, lg_range, state, a, c) do { \
|
||||||
assert(lg_range > 0); \
|
assert(lg_range > 0); \
|
||||||
assert(lg_range <= 32); \
|
assert(lg_range <= 32); \
|
||||||
\
|
\
|
||||||
@ -34,8 +34,8 @@
|
|||||||
r >>= (32 - lg_range); \
|
r >>= (32 - lg_range); \
|
||||||
} while (false)
|
} while (false)
|
||||||
|
|
||||||
/* Same as prn32(), but 64 bits of pseudo-randomness, using uint64_t. */
|
/* Same as prng32(), but 64 bits of pseudo-randomness, using uint64_t. */
|
||||||
#define prn64(r, lg_range, state, a, c) do { \
|
#define prng64(r, lg_range, state, a, c) do { \
|
||||||
assert(lg_range > 0); \
|
assert(lg_range > 0); \
|
||||||
assert(lg_range <= 64); \
|
assert(lg_range <= 64); \
|
||||||
\
|
\
|
@ -140,7 +140,7 @@ struct prof_tdata_s {
|
|||||||
void **vec;
|
void **vec;
|
||||||
|
|
||||||
/* Sampling state. */
|
/* Sampling state. */
|
||||||
uint64_t prn_state;
|
uint64_t prng_state;
|
||||||
uint64_t threshold;
|
uint64_t threshold;
|
||||||
uint64_t accum;
|
uint64_t accum;
|
||||||
};
|
};
|
||||||
@ -245,7 +245,7 @@ bool prof_boot2(void);
|
|||||||
if (prof_tdata->threshold == 0) { \
|
if (prof_tdata->threshold == 0) { \
|
||||||
/* Initialize. Seed the prng differently for */\
|
/* Initialize. Seed the prng differently for */\
|
||||||
/* each thread. */\
|
/* each thread. */\
|
||||||
prof_tdata->prn_state = \
|
prof_tdata->prng_state = \
|
||||||
(uint64_t)(uintptr_t)&size; \
|
(uint64_t)(uintptr_t)&size; \
|
||||||
prof_sample_threshold_update(prof_tdata); \
|
prof_sample_threshold_update(prof_tdata); \
|
||||||
} \
|
} \
|
||||||
@ -307,7 +307,7 @@ prof_sample_threshold_update(prof_tdata_t *prof_tdata)
|
|||||||
* pp 500
|
* pp 500
|
||||||
* (http://cg.scs.carleton.ca/~luc/rnbookindex.html)
|
* (http://cg.scs.carleton.ca/~luc/rnbookindex.html)
|
||||||
*/
|
*/
|
||||||
prn64(r, 53, prof_tdata->prn_state,
|
prng64(r, 53, prof_tdata->prng_state,
|
||||||
(uint64_t)6364136223846793005LLU, (uint64_t)1442695040888963407LLU);
|
(uint64_t)6364136223846793005LLU, (uint64_t)1442695040888963407LLU);
|
||||||
u = (double)r * (1.0/9007199254740992.0L);
|
u = (double)r * (1.0/9007199254740992.0L);
|
||||||
prof_tdata->threshold = (uint64_t)(log(u) /
|
prof_tdata->threshold = (uint64_t)(log(u) /
|
||||||
|
@ -99,7 +99,7 @@ ckh_try_bucket_insert(ckh_t *ckh, size_t bucket, const void *key,
|
|||||||
* Cycle through the cells in the bucket, starting at a random position.
|
* Cycle through the cells in the bucket, starting at a random position.
|
||||||
* The randomness avoids worst-case search overhead as buckets fill up.
|
* The randomness avoids worst-case search overhead as buckets fill up.
|
||||||
*/
|
*/
|
||||||
prn32(offset, LG_CKH_BUCKET_CELLS, ckh->prn_state, CKH_A, CKH_C);
|
prng32(offset, LG_CKH_BUCKET_CELLS, ckh->prng_state, CKH_A, CKH_C);
|
||||||
for (i = 0; i < (ZU(1) << LG_CKH_BUCKET_CELLS); i++) {
|
for (i = 0; i < (ZU(1) << LG_CKH_BUCKET_CELLS); i++) {
|
||||||
cell = &ckh->tab[(bucket << LG_CKH_BUCKET_CELLS) +
|
cell = &ckh->tab[(bucket << LG_CKH_BUCKET_CELLS) +
|
||||||
((i + offset) & ((ZU(1) << LG_CKH_BUCKET_CELLS) - 1))];
|
((i + offset) & ((ZU(1) << LG_CKH_BUCKET_CELLS) - 1))];
|
||||||
@ -141,7 +141,7 @@ ckh_evict_reloc_insert(ckh_t *ckh, size_t argbucket, void const **argkey,
|
|||||||
* were an item for which both hashes indicated the same
|
* were an item for which both hashes indicated the same
|
||||||
* bucket.
|
* bucket.
|
||||||
*/
|
*/
|
||||||
prn32(i, LG_CKH_BUCKET_CELLS, ckh->prn_state, CKH_A, CKH_C);
|
prng32(i, LG_CKH_BUCKET_CELLS, ckh->prng_state, CKH_A, CKH_C);
|
||||||
cell = &ckh->tab[(bucket << LG_CKH_BUCKET_CELLS) + i];
|
cell = &ckh->tab[(bucket << LG_CKH_BUCKET_CELLS) + i];
|
||||||
assert(cell->key != NULL);
|
assert(cell->key != NULL);
|
||||||
|
|
||||||
@ -361,7 +361,7 @@ ckh_new(ckh_t *ckh, size_t minitems, ckh_hash_t *hash, ckh_keycomp_t *keycomp)
|
|||||||
ckh->ninserts = 0;
|
ckh->ninserts = 0;
|
||||||
ckh->nrelocs = 0;
|
ckh->nrelocs = 0;
|
||||||
#endif
|
#endif
|
||||||
ckh->prn_state = 42; /* Value doesn't really matter. */
|
ckh->prng_state = 42; /* Value doesn't really matter. */
|
||||||
ckh->count = 0;
|
ckh->count = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1170,7 +1170,7 @@ prof_tdata_init(void)
|
|||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
prof_tdata->prn_state = 0;
|
prof_tdata->prng_state = 0;
|
||||||
prof_tdata->threshold = 0;
|
prof_tdata->threshold = 0;
|
||||||
prof_tdata->accum = 0;
|
prof_tdata->accum = 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user