Recognizing, quantifying and managing patient-ventilator asynchrony in invasive and noninvasive ventilation