This is mainly a performance issue. It is to help get the current average of the past N (30?) values. The context here would be to monitor the average execution time for the past N data requests in a server. While the obvious solution, is to log the all past N requests, in which all N request is read, and tabulated. Creating a performance hit relative to the data request in question.
As this is mainly use as a means of measure and not a perfect running estimate, the question? To solve this problem in the most effective manner.
While the solution may be language neutral, I would be implementing in php :)