Through a lot of trial and error. Primarily I look at how much my knees are bent during my back-stroke and also try and make sure I do not have to point my toes on my push stroke (Keep the toes pointed up).
That is when I feel I can make my best power, spin fast, and no knee pain.