Sleep study, also known as polysomnography, is a painless test that measures a person's body's activity while they sleep. It helps the doctor diagnose and treat a variety of sleep disorders, and evaluate certain causes of excessive sleepiness, as per Johns Hopkins Medicine. Polysomnography records brain waves, oxygen level in blood, heart rate and breathing during sleep.