A measurement of the history of cosmic star formation is central to understand the origin and evolution of galaxies. The measurement is extremely challenging using electromagnetic radiation: significant modeling is required to convert luminosity to mass, and to properly account for dust attenuation, for example. Here we show how detections of gravitational waves from inspiraling binary black holes made by proposed third-generation detectors can be used to measure the star formation rate (SFR) of massive stars with high precision up to redshifts of ~10. Depending on the time-delay model, the predicted detection rates ranges from ~2310 to ~56,740 per month with the current measurement of local merger rate density. With 30,000 detections, parameters describing the volumetric SFR can be constrained at the few percent level, and the volumetric merger rate can be directly measured to 3% at z ~ 2. Given a parameterized SFR, the characteristic delay time between binary formation and merger can be measured to ~60%.