/*
* Copyright (c) 2020 YuQing <384681@qq.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the Lesser GNU General Public License, version 3
* or later ("LGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the Lesser GNU General Public License
* along with this program. If not, see .
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include "fastcommon/skiplist_set.h"
#include "fastcommon/logger.h"
#include "fastcommon/shared_func.h"
#define COUNT 1000000
#define LEVEL_COUNT 16
#define MIN_ALLOC_ONCE 32
#define LAST_INDEX (COUNT - 1)
static int *numbers;
static SkiplistSet sl;
static SkiplistSetIterator iterator;
static int instance_count = 0;
static void free_test_func(void *ptr)
{
instance_count--;
}
static int compare_func(const void *p1, const void *p2)
{
return *((int *)p1) - *((int *)p2);
}
void set_rand_numbers(const int multiple)
{
int i;
int tmp;
int index1;
int index2;
for (i=0; i