forked from kjc0066/hhh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhhh1.h
45 lines (34 loc) · 958 Bytes
/
hhh1.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
/*
Implementation of the 1-dimensional Hierarchical Heavy Hitters algorithm (HHH) for IP addresses
-Thomas Steinke ([email protected]) 2010-10-06
*/
#ifndef HHH1_H
#define HHH1_H
#include "lossycount.h"
#ifndef NUM_MASKS
#define NUM_MASKS 5
#endif
#define NUM_COUNTERS NUM_MASKS
//The masks associated with the counters
//Note that we must ensure that they are in increasing order of generality
extern LCLitem_t masks[NUM_COUNTERS];
extern int leveleps[NUM_COUNTERS];
//initialise
void init(double epsilon);
//deinitialise
void deinit();
#ifndef PARALLEL
//update an input
void update(LCLitem_t item, int count);
#else
void update(LCLitem_t * item, int count);
#endif
//struct to store a heavy hitter output
typedef struct heavyhitter {
LCLitem_t item;
int mask; //The item & mask
int upper, lower; //Upper and lower count bounds
} HeavyHitter;
//the one-dimensional output
HeavyHitter * output(int threshold, int * numhitters);
#endif