I found this
awesome app that analyses your motion while you're asleep with the iPhone's accelerometer to determine how deep of sleep you are in. Basically it's an alarm that wakes you up within 30 minutes of the time you set your alarm where you are in the lightest sleep of that period. This allows you to wake up feeling refreshed and, well... awake. Basically, every other alarm clock wakes you up at the exact time you tell it to. It doesn't know how deep of a sleep you're in, it just wakes you up. Most likely you will be pretty deep in sleep when it wakes you up.
I woke up in the middle of the night for some reason and went on my iPhone and started looking at apps, I found this, and so there's only 3 hours of sleep analysis: