Measuring seat post length

When measuring a seat post, where are the measurements taken to determine if the post is a 300mm, 350mm, or 400mm post? From the insertion point, is it measured to the point where the post will no longer slip further into the seat tube, or is it measured to the center of the rail holes?

The reason I ask is because I want to replace the seat post in my son's bike with a longer one, but I have to figure out how long it is first. The post tells me that it is a 30.8 width post, but nothing on the length.