At the tip of the heart, a glow illumines. That is the symbol of the Jiva wanting exit from the body. This can be known only by judging the extent of desire that was sustaining the body. Desires also are of various kinds. Intolerable longings are one kind of desire.
Normal longings are anther kind.
The agony that is felt depends upon the intensity of the desire that is entertained through the personality during lifetime. Those who have been doing prayer, worship, meditation etc., throughout their lives and leading a holy life of goodness, compassion and servicefulness will not feel the agony of death as many others may feel. Those who are utterly corrupt, those who have swindled, smuggled, destroyed other peoples' peace and worked like dacoits and done the worst of things in the world will feel a terrible stroke on their head when they die. If you lead a really religious life of prayer, meditation, service, goodness and compassion and love of God primarily, that will act as a palliating influence at that time of passing. If you have served your Guru, Guru's Grace will work at that time.