static _always_inline_ unsigned int hashfunc(const char *key, unsigned int len)
{
- unsigned long t;
- unsigned int ret;
- t = get_cycles(0);
- ret = MurmurHash3_x86_32(key, len);
- t = get_cycles(t);
-
- printf("%u %lu\n", len, t);
-
- return ret;
+ return hash_crc32c_hw(key, len);
}
/*
return strcmp(a->key, b->key);
}
-void *hash_find(const struct hash *hash, const char *key)
+static _always_inline_ void *_hash_find(const struct hash *hash, const char *key)
{
unsigned int keylen = strlen(key);
unsigned int hashval = hashfunc(key, keylen);
return (void *)entry->value;
}
+void *hash_find(const struct hash *hash, const char *key)
+{
+ unsigned long t;
+ void *ret;
+
+ t = get_cycles(0);
+ ret = _hash_find(hash, key);
+ t = get_cycles(t);
+
+ printf("%lu %lu\n", strlen(key), t);
+ return ret;
+}
+
int hash_del(struct hash *hash, const char *key)
{
unsigned int keylen = strlen(key);
--- /dev/null
+#!/bin/bash
+
+log="$1"
+
+for ((i=0; i < 10;))
+do
+ err=${log}.${i}.stderr
+ echo "running #$i"
+ sudo chrt -f 99 /usr/bin/time -f \
+ "\n***\ntime: %E\ncontext switches: %c\nwaits: %w" \
+ tools/depmod -a > ${log}.$i 2>$err
+ [[ ! -z "$(grep 'context switches: 0' $err)" ]] && ((i++))
+done
+
+echo "consolidating in $log"
+rm ${log}.0*
+cat "$log".[1-9] | scripts/parse-timing > $log
+rm ${log}.*