How to calculate this energy for a given signal?
If your question really is how to calculate the energy of a given signal $x(t)$ then the answer is

$$E_x=\int_{-\infty}^{\infty}|x(t)|^2dt\tag{1}$$

but I wonder if that is actually what you're asking, because it would have been very easy to find that formula.