Well, no, mammals are not a very efficient power convertor. They lose a lot of energy in the form of heat. Not to mention the fact that only part of the energy is actually directed to the muscles driving the treadmill, oh and those muscles also produce a lot of excess heat. You would be better off directly burning the hamster food in a powerplant.
However... it WOULD be a great idea to have all the gyms in the world produce power. Think about it, there are millions of humans working out somewhere every day. They use all kinds of contraptions with built in resistance. So why not use dynamos for resistance? I mean the humans need to work out anyway to improve their physical health (or so that they (think they) look attractive). It would be a waste to discard all that power as heat
