An all-optical heterodyne approach based on a room-temperature controlled semiconductor optical amplifier (SOA) for measuring the frequency and linewidth of the terahertz beat-tone signal from a passively mode-locked laser is proposed. Under the injection of two external cavity lasers, the SOA acts as a local oscillator at their detuning frequency and also as an optical frequency mixer whose inputs are the self-modulated spectrum of the device under test and the two laser beams. Frequency and linewidth of the intermediate frequency signal and therefore, the beat-tone signal are resolved by using a photodiode and an electrical spectrum analyzer