Maybe I'm missing the OP's point, but it seems to me the answer is:
We are measuring what we presume to be mass, based on gravitational effects we see.
i.e. we see visible objects (galaxies) behaving in a way that could be explained if there were invisible mass out there of the given proportions.
...or am I underthinking it?