Time-dependent spectrum analysis of high power gyrotrons