As cosmic structures form, matter density fluctuations collapse gravitationally and baryonic matter is shock-heated and thermalized. We therefore expect a connection between the mean gravitational potential energy density of collapsed halos, Ω halo W , and the mean thermal energy density of baryons, Ω th . These quantities can be obtained using two fundamentally different estimates: we compute Ω halo W using the theoretical framework of the halo model which is driven by dark matter statistics, and measure Ω th using the Sunyaev-Zeldovich (SZ) effect which probes the mean thermal pressure of baryons. First, we derive that, at the present time, about 90% of Ω halo W originates from massive halos with M > 10 13 M . Then, using our measurements of the SZ background, we find that Ω th accounts for about 80% of the kinetic energy of the baryons available for pressure in halos at z 0.5. This constrains the amount of non-thermal pressure, e.g., due to bulk and turbulent gas motion sourced by mass accretion, to be about Ω non−th 0.4 × 10 −8 at z = 0.