Added timer for bests solutions

This commit is contained in:
2021-01-23 19:20:21 +01:00
parent 1b43433420
commit e1c734cb63
6 changed files with 123 additions and 24 deletions

10
lceb.h
View File

@@ -1,3 +1,4 @@
#include <time.h>
#define MAXINPUT 6 /* max numbers as input */
#define ALLOCSIZE 1024 /* # of elements to alloc when needed */
@@ -55,6 +56,7 @@ typedef struct best {
char *oper;
NODE *root;
int *values;
struct timespec timer;
} BEST;
/* tree.c */
@@ -103,6 +105,8 @@ extern char *nth_comb(int n);
//extern int eval_stack(STACK *stack);
/* tree version */
extern int eval_node(NODE *node, int depth, int *pvals, char *pops, int *ncalcs);
extern int get_totnodes();
extern int get_totleaves();
/* best.c */
extern int stopped();
@@ -110,3 +114,9 @@ extern void set_target (int n);
extern int check_best(int res, int nops, NODE *node, int *values, char *ops);
extern void print_best(NODE *node, int *values, char *pops, int depth);
extern void print_bests();
/* timer.c */
extern int sigint_received;
extern void start_timer();
extern void set_timer(struct timespec *timer);
extern double get_timer(struct timespec timer);