If you’re having trouble sleeping, your doctor may suggest you use a sleep diary to track how long and for what amount of time in bed each night. Mental health exams can help rule out other medical conditions or disorders as potential sources for this lack-of-slumber (such as depression. Polysomnogram testing and actigraphy are also frequently used to test Insomnia.