I think it should be possible to get the information from the Arduino timer registers directly.
I'm not exactly sure about the details when using analog write, but if you generated your own PWM signal using timer1 for example, with ICR1 or OCRnA for duty cycle, you should be able to query the value of OCRnA or ICRn at any time to find the duty cycle.
My assumption is that analogwrite uses similar timing functions, so you should be able to grab the details from the Arduino registers. Of course, I could be completely wrong...