How do I know if I have erectile dysfunction?

If your inability to achieve and/or maintain an erection in order to perform sexually is severe and persistent, then you may have erectile dysfunction. Keep in mind that arousal may take longer as you get older. Tell that to your doctor!
The doctor should obtain a detailed description of the problem, including the duration of the symptoms and the original precipitating factors. Other factors that should be identified and recorded are predisposing factors and maintaining factors as determined by standardized questionnaires for erectile dysfunction assessment.
Several tests may be required to determine the cause of erectile dysfunction. It can be effectively treated only after the underlying cause is known. This is important since, as already mentioned, erectile dysfunction can have a number of causes.

Hackett G, et al. British Society for Sexual Medicine guidelines on the management of erectile dysfunction. J Sex Med 2008;5:1841-1865.