Only the five (5) years preceding the date of your application is considered your eligibility period. Within that five-year period:
Every day you spent in Canada as a permanent resident counts as a full day.
Every day you spent in Canada as a temporary resident or protected person before you become a permanent resident counts as a half day up to a maximum of 365 days. Therefore, in order to get the maximum 365 day credit you need to be physically present in Canada as a temporary resident for 730 days during your eligibility period.
Time spent serving a sentence in Canada does not count towards the physical presence requirement (i.e. you cannot count time spent serving a term of imprisonment, probation and/or on parole as physical presence). See Question 11 for exceptions to this rule.