Measurement of the average local energy spread of electron beam via coherent harmonic generation