The time-integrated intensity transmitted by a laser driven resonator obeys
L\'evy's arcsine laws [Ramesh \textit{et al.}, Phys. Rev. Lett. \textit{in
press} (2024)]. Here we demonstrate the implications of these laws for optical
sensing. We consider the standard goal of resonant optical sensors, namely to
report a perturbation to their resonance frequency. In this context, we
quantify the sensing precision attained using a finite energy budget combined
with time or ensemble averaging of the time-integrated intensity. We find that
ensemble averaging outperforms time averaging for short measurement times, but
the advantage disappears as the measurement time increases. We explain this
behavior in terms of weak ergodicity breaking, arising when the time for the
time-integrated intensity to explore the entire phase space diverges but the
measurement time remains finite. Evidence that the former time diverges is
presented in first passage and return time distributions. Our results are
relevant to all types of sensors, in optics and beyond, where stochastic
time-integrated fields or intensities are measured to detect an event. In
particular, choosing the right averaging strategy can improve sensing precision
by orders of magnitude with zero energy cost