Measuring the primordial gravitational waves from cosmic microwave background and stochastic gravitational wave background observations