Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b042ba608c |
No files matched your search
+4
-2
@@ -16,7 +16,9 @@ static void dublicateRandomEntry (unsigned int *numbers, unsigned int len)
|
|||||||
if (numbers && len > 2)
|
if (numbers && len > 2)
|
||||||
{
|
{
|
||||||
unsigned int dubIndx = rand() % (len - 1);
|
unsigned int dubIndx = rand() % (len - 1);
|
||||||
unsigned int copyIndx = rand() % len;
|
unsigned int copyIndx;
|
||||||
|
|
||||||
|
copyIndx = rand() % len;
|
||||||
|
|
||||||
numbers[len - 1] = numbers[dubIndx];
|
numbers[len - 1] = numbers[dubIndx];
|
||||||
|
|
||||||
@@ -67,7 +69,7 @@ unsigned int *createNumbers(unsigned int len)
|
|||||||
// Duplicate one random entry
|
// Duplicate one random entry
|
||||||
dublicateRandomEntry(numbers, len);
|
dublicateRandomEntry(numbers, len);
|
||||||
|
|
||||||
clearTree(root);
|
clearTree(root); //Notwendigkeit muss noch restlichem Code entnommen werden
|
||||||
return numbers;
|
return numbers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+10
-3
@@ -1,6 +1,12 @@
|
|||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
|
|
||||||
#if __APPLE__
|
#ifdef __linux__
|
||||||
|
// Defines strict posix compliance for CLOCK_MONOTONIC
|
||||||
|
#define _POSIX_C_SOURCE 199309L
|
||||||
|
#include <time.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if __APPLE__ || __linux__
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
static struct timespec start = {0, 0};
|
static struct timespec start = {0, 0};
|
||||||
|
|
||||||
@@ -21,7 +27,8 @@ double stopTimer()
|
|||||||
|
|
||||||
double measuredSeconds = (double)delta_us / 1000000.;
|
double measuredSeconds = (double)delta_us / 1000000.;
|
||||||
|
|
||||||
if(start.tv_nsec > 0) {
|
if (start.tv_nsec > 0)
|
||||||
|
{
|
||||||
start.tv_nsec = 0;
|
start.tv_nsec = 0;
|
||||||
start.tv_sec = 0;
|
start.tv_sec = 0;
|
||||||
}
|
}
|
||||||
@@ -45,7 +52,7 @@ double stopTimer()
|
|||||||
{
|
{
|
||||||
double measuredSeconds = (clock() - (double)startClocks) / CLOCKS_PER_SEC;
|
double measuredSeconds = (clock() - (double)startClocks) / CLOCKS_PER_SEC;
|
||||||
|
|
||||||
if(startClocks > 0)
|
if (startClocks > 0)
|
||||||
startClocks = 0;
|
startClocks = 0;
|
||||||
else
|
else
|
||||||
measuredSeconds = -1;
|
measuredSeconds = -1;
|
||||||
|
|||||||
Reference in new issue
Block a user