-
Notifications
You must be signed in to change notification settings - Fork 1
/
driver-hh.chpl
51 lines (39 loc) · 1 KB
/
driver-hh.chpl
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
use Time;
use Random;
use heavyhitter;
proc randfill(data, sz) {
//var r = new RandomStream(int, sz);
//r.fill(data);
fillRandom(data);
return data;
}
proc hf(x:int) :int {
return x;
}
proc main() {
var sketch = new HeavyHitter(int,1014, hf);
var dataDom = {0..100000};
var data : [dataDom] int;
fillRandom(data);
var numOps = 0;
var time_constraint = true;
var FIVE_MINUTES = 5.0;
var aggregatetime = 0.0;
while( time_constraint ) {
data = randfill(data, dataDom.high);
var timer = new Timer();
timer.start();
for i in data {
sketch.update(i, 1);
}
timer.stop();
aggregatetime += timer.elapsed(); //(ops_stop - ops_start);
numOps+=1;
var m = (aggregatetime/60.0);
var s = (((aggregatetime-60.0)*(aggregatetime/60.0)));
//writeln( (m,s) );
time_constraint = (m <= FIVE_MINUTES);
//writeln(numOps, (m,s), time_constraint, aggregatetime);
}
writeln((numOps, aggregatetime));
}