Not super scientific, but I go by tooth profile and overall performance. Compare what the teeth look like vs what they're supposed to look like. If there's a major difference, it might be time to change. Or if indexing is getting nearly impossible, its probably time to change it as well.
Note that chains and cassette will wear together, so sometimes its necessary to change both at the same time.