In my experience, when we were expected to go into 5 min of deco, due to short surface interval and 25m+ consecutive dives, the guide said to the three of us, to flag her when we reached 5 min deco on our dive computers. As soon as someone hit 5 min deco, we would end our dive and proceed to the safety stop.
For the dive computer, it can be set to have Deep Stops or not:
If Deep Stops are set, then the computer will indicate a depth and duration for the mandatory stop(s). Once you're within the depth plus a bit of tolerance, the dive computer will start counting down. You're clear when the computer gets to zero. After completing all the Deep Stops, you would proceed to the normal safety stop and do the typical 3 min at 5m.
If Deep Stops are not set, then you would likely proceed to the normal safety stop depth of 5m and wait out the mandatory stop. The computer would count down until the mandatory stop is complete... then it will start counting down from 3 min for the normal safety stop. Maybe some computers will combine the two counts.
If you're low on air, going progressively more shallow will gain you some time.
As the others have said, know your dive computer. It will tell you your obligations.