Tests such as the bulbocavernosus reflex test are used to determine if there is sufficient nerve sensation in the penis. The physician squeezes the glans (head) of the penis, which immediately causes the anus to contract if nerve function is normal. A physician measures the latency between squeeze and contraction by observing the anal sphincter or by feeling it with a gloved finger inserted past the anus.
In terms of practical solutions, this is a common problem so there are some common aids. Drugs like Viagra or Cialis or Levitra work for many, many men. If his doctor recommends it, there’s no shame in popping a pill if it solves the problem — particularly if it helps alleviate the anxiety. Sometimes, a guy just needs to get his groove back for a while so he can relax and start having fun again. Also don’t forget the noble, oft-ignored cock ring, which constricts blood flow and helps men keep it up. They’re cheap and easy.
The more you puff, the more you put your penis at risk, according to a study from the Tulane University School of Public Health and Tropical Medicine. The researchers examined 7,684 men between the ages of 35-74 and concluded about 23 percent of erectile dysfunction cases can be chalked up to cigarette smoking. This is probably the best motivator If you've been struggling to quit.
Stress is another factor that can be a cause or effect of ED. If you're stressed at work, at home, and in your relationships, it's going to take a toll on your sexual function. Your mind is elsewhere, and relaxing when you finally make it between the sheets is a long shot. Now you’re stressed because you can’t get it up (talk about the ultimate catch-22), so you're stuck in this sad, frustrating cycle. “ED really affects the psyche of a guy, regardless of the etiology, Gittens says. “If you have a problem getting an erection one night, you’re probably going to be anxious and worried your partner might see you as less of a man the next time you try to get an erection.” There's a pill that will help with this, and it's not promoted on television with middle-aged men in sports cars. It's a damn chill pill.
The trouble is, most people don't know that sexual dysfunction can be a warning sign of something more serious. Dr Graham Jackson, a cardiologist and the chairman of the Sexual Advice Association, would like to change that. "People aren't aware of the underlying causes of their problems because they feel well otherwise," he says. "They'll say, 'It's my age' or 'I'm nervous because I'm in a new relationship.' But every man with erectile dysfunction should have their heart and blood pressure checked."
The Cancer of the Prostate Strategic Urologic Research Endeavor (CaPSURE) study, designed to determine whether an individual man’s sexual outcomes after most common treatments for early-stage prostate cancer could be accurately predicted on the basis of baseline characteristics and treatment plans, found that 2 years after treatment, 177 (35%) of 511 men who underwent prostatectomy reported the ability to attain functional erections suitable for intercourse. 
Lifestyle choices that impair blood circulation can contribute to ED. Smoking, excessive drinking, and drug abuse may damage the blood vessels and reduce blood flow to the penis. Smoking makes men with atherosclerosis particularly vulnerable to ED. Being overweight and getting too little exercise also contribute to ED. Studies indicate that men who exercise regularly have a lower risk of ED.