For all ideal switching devices, the logged simulation data reports the thermal losses as lastTurnOffLoss, lastTurnOnLoss, and lastReverseRecoveryLoss. These variables record losses as a pulse with an amplitude equal to the energy loss. If you use a script to sum the total losses over a defined simulation period, you must sum the pulse values at each pulse rising edge.
For more information, you can refer to the documentation of MOSFET (Ideal,Switching) block, particularly the Thermal Losser section.

