let check ec param =
    if ec.assertion param ~threshold:ec.initial_threshold then (* assertion succeeded *)
      if ec.threshold = ec.initial_threshold then
        (* and it succeeded before -- do nothing *)
        None
      else
        (* but it did not succeed before *)
        begin
          ec.threshold <- ec.initial_threshold;
          Some (ec.success_alert param)
        end
    else (* assertion failed *)
      if ec.assertion param ~threshold:ec.threshold then
        (* but it's not enough worse than before *)
        None
      else
        (* and it's worse than before *)
        begin
          let loosened = ec.loosen param ~threshold:ec.threshold in
          assert (loosened <> ec.initial_threshold);
          ec.threshold <- loosened;
          Some (ec.fail_alert param)
        end