e.g. in LTspice hold the ALT key and make a LMB click on the diode, this shows you the dissipated power. Zoom to the area of interest in the plot, hold the control key and click the label of the trace of interest i.e. power loss of your diode. This gives you the RMS and average power loss of your diode.