Kinda similar to how Kobe Bryant knew it's time to retire from the game of basketball. He said in an interview (https://youtu.be/Ya8hY0S-8t0?t=54) that he knew it's time when during his morning meditations, his mind will not drift to basketball anymore.