Only your eligibility period of 5 years is considered.
Everyday you spent in Canada during these 5 years before the day you got your PR counts as half a day for your day count (with a few exceptions, like the time spent waiting for a refugee status, or having legal issues like going to prison).
The maximum you can accumulate with these half days is 365 days, if you spent 2 years or more in Canada during these 5 years before your PR. That way, you only need 2 years after your PR to be eligible.
For most people, it would be just the last 5 years. It's simply min(365, 0.5 * (day of PR - first day of your 5 years)) + (last day of your 5 years - day of PR) if you always stay in Canada.