-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtable.h
52 lines (39 loc) · 1005 Bytes
/
table.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef _TABLE_H
#define _TABLE_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>
#include <sys/resource.h> // For getrusage()
#include <sys/time.h> // For getrusage()
#define HASHSIZE (1013)
#define NUMTHREADS (2)
// Node structure
typedef struct _node_l {
char *value;
struct _node_l *next;
} node_l;
// Linked list structure
typedef struct _list_l {
node_l *head;
int count;
pthread_mutex_t lock;
} list_l;
// Thread data structure --> **UNUSED**
typedef struct _thread_data {
int counter;
char* value;
} thread_data;
// Resource usage
struct rusage before, after;
// Table function definitions
int insert(char *value);
char* find(const char *check);
int remove(const char *value);
void *worker(void *value);
// Time difference
double calculate(const struct rusage *b, const struct rusage *a);
// Plot distribution
int plot_distribution();
#endif /* _TABLE_H */