- printf("%s%p:0x%llx (%d", is_marked ? "*" : "", item, item->key, item->top_level);
- for (int i = 1; i <= item->top_level; ++i) {
- node_t *next = (node_t *)STRIP_TAG(item->next[i]);
- printf(" %p:0x%llx", item->next[i], next ? next->key : 0);
- }
- printf(")\n");
- fflush(stdout);
- item = (node_t *)STRIP_TAG(item->next[0]);
- }
-}
-
-#ifdef MAKE_skiplist_test
-#include <errno.h>
-#include <pthread.h>
-#include <sys/time.h>
-
-#include "runtime.h"
-
-#define NUM_ITERATIONS 10000000
-
-static volatile int wait_;
-static long num_threads_;
-static skiplist_t *skiplist_;
-
-void *worker (void *arg) {
- int id = (int)(size_t)arg;
-
- unsigned int rand_seed = id+1;//rdtsc_l();
-
- // Wait for all the worker threads to be ready.
- SYNC_ADD(&wait_, -1);
- do {} while (wait_);
-
- for (int i = 0; i < NUM_ITERATIONS/num_threads_; ++i) {
- int n = rand_r(&rand_seed);
- int key = (n & 0xF) + 1;
- if (n & (1 << 8)) {
- skiplist_add_i(n, skiplist_, key, 1);
+ printf("%s%p:0x%llx ", is_marked ? "*" : "", item, item->key);
+ if (item != sl->head) {
+ printf("[%d]", item->top_level);