A general formulation of the total square integrals for continuous systems