We demonstrate a thermal profiling technique for wafer-scale testing of the optical power distribution in photonic integrated circuits. Radiative cooling of the lattice of a semiconductor optical amplifier is observed in response to an optical signal; likewise, lattice heating occurs in an optically injected absorber. We develop a total energy balance model that can be used to quantify modal gain or absorption within these devices, along with longitudinal and vertical thermal impedances and heat transfer coefficients. Spatially resolved thermal profiling in conjunction with our energy balance model accurately describes the optical power distribution inside optoelectronic devices, without recourse to direct optical measurement.