Jet-mass spectra in perturbative quantum chromodynamics