It is very hard to do that accurately. Fitness watches use accelerometers to detect body movement, pulse measurement etc. and still aren’t great. Real monitoring uses a lot more instruments including EEG. If you think you might need that, ask your Dr about a sleep study.