In the videogame series, Silent Hunter, which simulates being a submarine captain in WW2, after a patrol you are told how much tonnage you sank. I always thought that was just a reward mechanism to keep you playing. But in this List of U-boat Aces, it lists the tonnages each ace sank. It does note the caveat that this may be inaccurate due to multiple U-boats claiming the same kills, but it doesn't imply any inaccuracy in the size of the ships.
So how do we know how much tonnage they sank? Are these numbers gathered post-war or is there some method for measuring a ship's tonnage through a periscope?