Real-time measurement of transverse-mode-mixing effects in a Q-switched Nd:YAG laser