It's measured in inches up the seat tube, usually from the center of the bottom bracket to the top of the seat tube (although sometimes the center of the top tube, although that can vary alot due to sloped designs and is more common on road frames).
You'll want to ensure you have adequate standover clearance, but standover height can't be directly correlated to top tube length due to differences in bottom bracket drop, seat tube angle, and even tire size. Two to three inches are thought to be the minimum acceptable crotch clearance for off-road use, but more is preferred and fairly common (again due to sloping tubes and strange frame geometry).
But almost more important than standover height is reach ('ETT', or Effective Top Tube length, plus the length of the stem), which is more difficult to decide "what is right." Based on your level of fitness and limberness, your riding style and your comfort and skill on a bike, people of similar dimensions are going to prefer different reaches. This is somewhat adjustable with varying stem lengths, but longer stems handle differently from shorter stems, so you'll want to pick a frame with an ETT that lets you use the length of stem you prefer.
Moral: Demo as many bikes as possible. Make note of top tube, head tube angle and stem lengths of the various sized frames you try. Try to figure out why a particular bike handles the way it does. The more bikes you demo, the more easy it is to know when you've found the right one.