Count recorded events instead of hard-coding a guess.

#1139