Exemplo n.º 1
0
Event count(const events_t & events) {

  if (events.empty()) {
    return {};
  }

  return events.front().copy().set_metric(events.size())
         .set_time(max_time(events));
}
Exemplo n.º 2
0
Event mean(const events_t & events) {

  if (events.empty()) {
    return {};
  }

  Event e(events.front());
  e.set_metric_d(reduce(sum_fn, events) / events.size());
  e.set_time(max_time(events));

  return e;
}
Exemplo n.º 3
0
Event maximum(const events_t & events) {

  if (events.empty()) {
    return {};
  }

  double max = events[0].metric();

  for (const auto & e: events) {

    auto tmp = e.metric();
    if (tmp > max) {
      max = tmp;
    }
  }

  Event e(events.front());
  e.set_metric_d(max);
  e.set_time(max_time(events));

  return e;
}
Exemplo n.º 4
0
Event minimum(const events_t & events) {

  if (events.empty()) {
    return {};
  }

  double min = metric_to_double(events[0]);

  for (const auto & e: events) {

    auto tmp = metric_to_double(e);
    if (tmp < min) {
      min = tmp;
    }

  }

  Event e(events.front());
  e.set_metric_d(min);
  e.set_time(max_time(events));

  return e;
}