The pulse width is the length of time between the rising edge of a signal, and the corresponding falling edge (or vice versa):
__________
____| |______
^ ^
Rising Falling
<--------->
Pulse width
You need to use an interrupt to detect the rising edge change, start a timer of some kind, and stop it on the falling edge detect interrupt.