How long should you perform oral sex on a male if you don't want him to ejaculate in your mouth?
If every oral sex performer and recipient gave and received in exactly the same way, your question could be answered lickity-split. Since no two aroused people are alike, communication will be your most reliable orgasm alert. Learning and becoming familiar with your partner's signals, or creating a language of words, sounds, and/or motions that says the ejaculate's on its way, is handy no matter the length and intimacy of your relationship: the same man's train may come at different speeds thanks to stress, fatigue, interest, how recently his last sexual activity was, alcohol or other drugs, and so much more.
Many, but not all, men habitually do and/or say something before ejaculating: "I'm coming," "Ahhh," "Oh, yes," "Oh, god," "Oh, baby," and "Mommy" would probably make it onto a survey. Then there are the moans, groans, growls, grunts, and noticeably shallow breathing that can tip you off to his point of no return without ever having to talk about it. Not that there's anything wrong with taking a language class together before your extracurricular activities. Make the lessons part of your sex-play: "I love to hear you call your shots," or "It's really hot to watch you, so let me know when you're gonna let loose."
Not wanting ejaculate in your mouth is your call. Hopefully you feel comfortable enough with a partner to say you don't want him to come in your mouth for whatever reason. This can be a very effective way of involving him in preventing something that may ruin your enjoyment of oral sex — before, during, and after it takes place. Your partner is half of the oral sex play, and should be able to give you a heads up on his orgasm, if that's what you want him to do. The archived Go Ask Alice! related questions and answers below talk about oral sex stuff, including the taste, smell, texture, and quantity of ejaculated semen; how to talk about these topics with your partner; and, STI-related issues (also search Go Ask Alice's Sexual and Reproductive Health archives for more related info about oral sex).
The best bet here is to communicate (verbally and non-verbally). You and your partner should be able to "come" to an agreement on oral sex.Alice!