You can use the "dt" (delta time) expression to get the amount of time elapsed since last tick. Add "dt" to a variable on tick, and when the button is pressed, get the value in the variable and put it in a list of recorded times, and then set the time keeping variable back to 0. At the end, you take the average by adding all the times in the list together, then dividing by the number of times in the list. So you would be dividing by 10 after adding all the times together.
Alternatively you can also use Timers to record how much time has passed. Instead of adding delta time every tick, you could set a timer to execute every 0.1 seconds, and add 0.1 to the time keeping variable. This would be more optimal as you're not doing something every tick, only every 0.1 seconds, however this would be accurate only to a tenth of a second. You could decrease the timer interval to increase accuracy.