Bedside monitoring of lung volume available for gas exchange