who It is generally done using a Fourier Transform (often quoted as a FFT which is a Fast Fourier Transform) so that is what you need to look up.
You will need to digitally sample the offending waveform and then apply the FFT to it which will then reveal all the harmonics associated with you waveform.
It sounds as though you are looking at mains voltage. If you are be very very careful. Industry best practice is to have another person, preferably competent in first aid, in the same room that you are conducting your investigation in who is aware of what you are doing and can come to your aid if you grab hold of something that you shouldn't.
There is of course the option of using the audio input of your computer and use an app that has been designed to recover the information you seek.
Another option is to use a twin T filter tuned to the voltage frequency on test. The idea is that the filter rejects the fundamental leaving just the harmonics form which you can calculate the overall distortion.