I thought it was from the chamber to the gas port and now finally realize its from the gas port to the muzzle.
It's both, and is not a set number. It's going to depend on cartridge pressure and gun design, and to some extent, bullet weight. M1 Garands have the port nearly to the end of the muzzle, while on a Desert Eagle it is directly in front of the chamber.
On most guns, however, you will find the port about 2/3 of the way down the barrel.
A few guns have an adjustable gas system that requires the settings be changed for different types of ammunition, or to adjust for use with a supressor (dwell time increases significantly)
Basically, what matters is:
1)That the bullet is far enough down to barrel that chamber pressures are safe and the bolt won't open until the round exits the muzzle
2) pressure when the bullet passes the port is sufficient to work the action
3) pressure is not excessive
These things are determined by port location versus barrel length, and by the size of the port. Most fixed gas systems are over ported a little so that they'll function with low powered ammo, at the cost of somewhat violent cycling with more powerful loads. This is akin to using a lighter recoil spring in a recoil-operated gun to ensure cycling with a wider range of loads.
The problem with the M-4gery is that the gas system was designed with the dwell time of a 14.5" barrel, not a 16 incher, while the mid-length system is specifically suited to the 16" barrel.