The best way to treadmill is windsprint-rest-windsprint-rest.

The best thing to look at is not the clock on the wall, but the speed/condition of your dog.

In other words, 40 minutes of half-ass trotting with a mildly-tired dog is not as good for his condition as five 4-minute, all-out bursts of running that makes his tongue hang out to his elbows.