Black hole mass function from gravitational wave measurements