We propose and demonstrate a nonintrusive diagnostic technique for measuring longitudinal bunch profiles of an operational high-power hydrogen ion (${\mathrm{H}}^{\ensuremath{-}}$) beam in the Spallation Neutron Source (SNS) linear accelerator at Oak Ridge National Laboratory (ORNL). The technique consists of a laser wire formed by a picosecond pulsed laser beam and a virtual slit created by controlling the magnetic field of the electron detector. The virtual slit eliminates the influence of the transverse beam profile and size on the longitudinal bunch profile measurement. The effectiveness of the diagnostics is investigated first in numerical simulations followed by experimental demonstrations performed on the neutron production (1.4 MW on target) ${\mathrm{H}}^{\ensuremath{-}}$ beam at the SNS superconducting linac. The results from the present measurement method are verified by an independent measurement approach.