use of java.util.concurrent.atomic.LongAdder in project XRTB by benmfaul.
the class CreativeProbe method getMap.
public List getMap() {
Map x = new HashMap();
List list = new ArrayList();
for (Map.Entry<String, LongAdder> entry : probes.entrySet()) {
String key = entry.getKey();
x = new HashMap();
x.put("name", key);
x.put("count", entry.getValue().sum());
list.add(x);
}
return list;
}
use of java.util.concurrent.atomic.LongAdder in project XRTB by benmfaul.
the class CreativeProbe method reset.
public void reset() {
probes = new HashMap();
total = new LongAdder();
bid = new LongAdder();
}
use of java.util.concurrent.atomic.LongAdder in project XRTB by benmfaul.
the class CreativeProbe method process.
public void process(StringBuilder br) {
String key = br.toString();
LongAdder ad = probes.get(key);
if (ad == null) {
ad = new LongAdder();
probes.put(key, ad);
}
ad.increment();
total.increment();
}
use of java.util.concurrent.atomic.LongAdder in project XRTB by benmfaul.
the class CreativeProbe method reportCsv.
public void reportCsv(StringBuilder sb, String pre) {
pre = pre + creative + "," + total.sum() + ", " + bid.sum();
for (Map.Entry<String, LongAdder> entry : probes.entrySet()) {
String key = "\"" + entry.getKey().trim() + "\"";
LongAdder ad = entry.getValue();
sb.append(pre + "," + key + "," + total.sum() + "," + ad.sum() + "\n");
}
}
use of java.util.concurrent.atomic.LongAdder in project XRTB by benmfaul.
the class ExchangeProbe method reset.
/**
* Reset the probe for the exchange. Sets total and bids to 0 and then resets the campaign probes.
*/
public void reset() {
for (Map.Entry<String, CampaignProbe> entry : probes.entrySet()) {
entry.getValue().reset();
}
total = new LongAdder();
bids = new LongAdder();
}
Aggregations