I do it using htable. I maintain a rolling 3-second sample of number of calls in 'htable', the tail of which is auto-expired. The need to implement CPS limits was the basis for the 'updateexpires' option I added to the htable code in Dec 2011--I wanted updates not to cause entries' expiration time to be reset.
Divide by 3, get CPS. It's crude, but effective. One can, of course, have a longer sampling window.