Abdullah bin Nujayy narrates that Sayyiduna Ali (may Allah be pleased with him) said: I had a set time at the pre-dawn hour for coming to the Messenger of Allah (peace and blessings be upon him). When I came to him (peace and blessings be upon him), if he (peace and blessings be upon him) was praying, he would say 'Subhan Allah' (Allah is free of all imperfection), and in that was an indication of his (peace and blessings be upon him) permission; and if he was not praying, he would give me permission.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 3340