The cosmic history of dust-obscured star formation