The procedure is called a electroncephalography and the report is called an electroencephalogram. Electro refers to the reading of electrical potential. Enceph refers to the head.
EEG is used to refer to both electroncephalography and electroencephalograms. In the process, electrodes are attached to the scalp. The electrodes measure the electrical potential. By calculating the difference in the potential between the front and the back of the head, and charting how that difference changes over time, the EEG gives an indication of electrical activity inside the brain. Specifically, the activity measured is due to the movement of ions in the cortex.
The process is painless for the patient. Gel or a mild glue is used to attach the electrodes. The length of time depends on the test ordered by the doctor. It might last only a few minutes or it may last all time through sleep. The people running the machinery are typically specially trained sleep technicians, not doctors or nurses.
EEG has been in wide use for decades. It is employed in the diagnosis of brain disorders. Medical investigation of seizures, tumors, strokes, and dementia often involve EEG.
When you hear of “brain waves” these refer to EEG readings. These are not true waves as understood by physicists. They are recordings of voltage differences over time.
Stages of sleep were first discovered by EEG and they are still described that way. You still sometimes see Stage 3 referred to as delta wave sleep because of the EEG readings.
A larger, more comprehensive diagnostic procedure used for sleep problems is the polysomnogram. Polysomnography includes EEG as well as readings of other physiological metrics.