summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2016-07-14 15:51:51 +0200
committerantirez <antirez@gmail.com>2016-07-14 15:51:51 +0200
commitf50dc38bc29373b0f74db043cdb200995a324cf3 (patch)
treeedc41b18a85fe187e81de83aff1ab0b952212e6e
parent09fcb002490815f268c838b5b210aacd8314686e (diff)
downloadredis-f50dc38bc29373b0f74db043cdb200995a324cf3.tar.gz
LRU simulator: fix new entry creation.
-rw-r--r--utils/lru/lfu-simulation.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/utils/lru/lfu-simulation.c b/utils/lru/lfu-simulation.c
index ebfc434ac..fe7a38354 100644
--- a/utils/lru/lfu-simulation.c
+++ b/utils/lru/lfu-simulation.c
@@ -75,7 +75,7 @@ void show_entry(long pos, struct entry *e) {
if (pos >= 15 && pos <= 19) tag = "new accessed ";
if (pos >= keyspace_size -5) tag= "old no access";
- printf("%ld] <%s> frequency:%d decrtime:%d [%lu hits | age:%ld seconds]\n",
+ printf("%ld] <%s> frequency:%d decrtime:%d [%lu hits | age:%ld sec]\n",
pos, tag, e->counter, e->decrtime, (unsigned long)e->hits,
time(NULL) - e->ctime);
}
@@ -134,7 +134,7 @@ int main(void) {
/* Simulate the addition of new entries at positions between
* 10 and 19, a random one every 10 seconds. */
- if (new_entry_time == now) {
+ if (new_entry_time <= now) {
idx = 10+(rand()%10);
entries[idx].counter = COUNTER_INIT_VAL;
entries[idx].decrtime = to_16bit_minutes(start);