The range of scenarios I have seen (mostly in the US) for “postdoctoral length before landing a professorship job” is 0-8 years, with anywhere between 3 and 5 years being fairly typical. This should be understood with the following caveats:
Some people actually enjoy doing several postdocs, or preferred prolonging their postdoc to get a really good professorship (or to achieve some other goal) when they had an option of taking a less good one earlier. You should not assume that someone taking 6 or 8 years means something terrible (but you should also not assume that it means something wonderful; basically you just shouldn’t make assumptions about what it means).
Some people do longer postdocs because they switched fields part way through their postdocs.
Not all jobs fall neatly on the postdoc/professorship spectrum. E.g., there are research labs (both government and industry) or other jobs from which a postdoc might transition to, and from which one might realistically transition to a professorship at some point.
The bottom line is that both statistics and anecdotal data can be very misleading. Each case tells a unique story which may, or quite possibly may not, have any relevance to your own situation.
Another thought about what you wrote:
So, my plan is to fix a deadline time to do my best, and if I don't get a professorship by that time, I should start, without a question, to seek for a job at the industry.
The natural question arises, which is this optimal stopping time? According to my advisor, I should land a professorship in 3 years, but I'm not sure if this is true.
While it’s certainly good to make plans, no offense but I think fixing a deadline in advance is not a good plan. The true “optimal stopping strategy” would include being open to adjusting your plan dynamically to fit circumstances. E.g., if you are doing great work and for random reasons just didn’t manage to get a tenure track position by year X, or if some really cool opportunity came up to go to some prestigious place for a year, it might make sense to do another year as a postdoc even if you hadn’t originally planned to. By contrast, if after 1-2 years you have not produced any research (I’m sure that won’t happen, it’s just a hypothetical scenario), it might be better to leave early rather than wait out the allotted 3-year postdoc period.
Good luck!