of course there are ways to see that - for example by checking what exactly is happening at the moment it lags and at the moment it doesn't lag.
But there are too many possible causes to even start looking without more info.
Lag can be caused by too large files (especially parallaxed maps or large audio files), by a single badly designed parallel process, by too many events, by a wrong event, by not having sufficient computing power and other causes...