Having done this dozens of times as a non-citizen, I'd say anywhere between 10 minutes and 90 minutes from when you get off the plane to getting through immigration. Add an extra 10 minutes to the minimum if you have checked bags. And another 10+ minutes to get to the train and to the rental car center.
SFO is one of the better airports as far as immigration, but as with most airports it can vary wildly depending on who lands before you, and even how quickly you get off the plane.
As others have said, the best option is to give the rental company your flight details, so they will hold your reservation if your flight is delayed. All of the major rental companies at SFO will only start your rental time when you actually pickup the car, not at the time your booking was for.