We discuss a method to constrain the fraction density f of the relativistic gas in the radiation-dominant stage , by their impacts on a relic gravitational waves and the cosmic microwave background ( CMB ) B -polarization power spectrum . We find that the uncertainty of f strongly depends on the noise power spectra of the CMB experiments and the amplitude of the gravitational waves . Taking into account of the CMBPol instrumental noises , an uncertainty \Delta f = 0.046 is obtained for the model with tensor-to-scalar ratio r = 0.1 . For an ideal experiment with only the reduced cosmic lensing as the contamination of B -polarization , \Delta f = 0.008 is obtained for the model with r = 0.1 . So the precise observation of the CMB B -polarization provides a great opportunity to study the relativistic components in the early Universe .