Update bench code to latest version of the library.
This commit is contained in:
1 parent
006d0d16a5
commit
defc58f6a3
2 files changed
+6
-13
No files matched your search
@@ -7,6 +7,9 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
// Needed due to compilation error in pool.h
|
||||||
|
#include <pthread.h>
|
||||||
|
|
||||||
#include "dynamic.h"
|
#include "dynamic.h"
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|||||||
+3
-13
@@ -14,8 +14,8 @@
|
|||||||
|
|
||||||
static void test_array(size_t n)
|
static void test_array(size_t n)
|
||||||
{
|
{
|
||||||
sv_t *a1 = sv_alloc ( sizeof (unsigned int), 16, NULL);
|
srt_vector *a1 = sv_alloc ( sizeof (unsigned int), 16, NULL);
|
||||||
sv_t *a2 = sv_alloc ( sizeof (unsigned int), 16, NULL);
|
srt_vector *a2 = sv_alloc ( sizeof (unsigned int), 16, NULL);
|
||||||
|
|
||||||
for(size_t i = 0; i < n; i++) {
|
for(size_t i = 0; i < n; i++) {
|
||||||
unsigned int value = rand_get();
|
unsigned int value = rand_get();
|
||||||
@@ -48,7 +48,7 @@ static int cmp_float (const void *a, const void *b)
|
|||||||
|
|
||||||
static void test_sort(size_t n)
|
static void test_sort(size_t n)
|
||||||
{
|
{
|
||||||
sv_t *a1 = sv_alloc(sizeof(float), 16, cmp_float);
|
srt_vector *a1 = sv_alloc(sizeof(float), 16, cmp_float);
|
||||||
for(size_t i = 0; i < n; i++) {
|
for(size_t i = 0; i < n; i++) {
|
||||||
unsigned int value = rand_get();
|
unsigned int value = rand_get();
|
||||||
sv_push(&a1, &value );
|
sv_push(&a1, &value );
|
||||||
@@ -72,13 +72,3 @@ int main(int argc, const char *argv[])
|
|||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, const char *argv[])
|
|
||||||
{
|
|
||||||
int n = (argc > 1) ? atoi(argv[1]) : 0;
|
|
||||||
if (n == 20)
|
|
||||||
test_function("Array", 100000000, test_array);
|
|
||||||
if (n == 50)
|
|
||||||
test_function("Sort", 10000000, test_sort);
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
Reference in new issue
Block a user