So I have a slightly different perspective as a software development manager. I have regular one-on-one's with my employees, and I try to make it clear to them that part of that time is to talk about anything they want to. If their personal life is affecting or potentially affecting their performance, I want to know. If needed, I'll suggest resources such as the Employee Assistance Program, getting them flexibility in PTO, etc. to help them as appropriate.
On the other hand if I notice a performance issue, it my responsibility to give the employee feedback and address the issue. Ultimately if they're not able to get to an acceptable level of performance, I need to fire them.
I balance the two of these with the understanding that there needs to be an expectation of performance being at a certain level, but sometimes people go through rough stuff in their personal lives and just need the company to be there to help support them for a period of time. The pain of life doesn't always respect the perceived level of the trauma, but there is a pretty clear pecking order to the amount of leeway that different events typically get. I'm sorry, but breaking up with a girlfriend/boyfriend is not terribly high on that list. Things like terminal illness or death of immediate family member, some legal issues, new child or adoption, divorce, etc. all fall above it.
You'll get more or less time depending on how strong of a contributor you were before the event and how much the performance has degraded. As a boss of a typical performer who was virtually useless now, I'd probably set the expectation that in a couple weeks you need to be performing reasonably well again, and if a month or more goes by without that happening I'd be thinking about a performance improvement plan with termination in a couple months of no improvement. This is all very subjective, which is why I gave my reasoning above.
Edit: To be clear, we've all had managers who are jerks. I think I'm pretty responsive to my employees, but you may not have a manager who is. Be sure to apply your judgement about their disposition and your relationship. If I had a boss who was overtly trying to throw me under the bus, I might not share anything with them or might share with HR or some other more open party to try to get protection.