Well, you need some code to execute your function and analyze your attribute
so it will know that it needs to execute something (e.g. execution time measurement, in your case) before and after your function - it could be using the Decorator design pattern, Reflection, Proxy object and so on.
As you tagged, it is an aspect-programming issue and you can take advantage of PostSharp third-party, for example, in order to achieve it.
Take a look at this specific page about Performance Counters using PostSharp, it is indeed uses Attributes: http://www.postsharp.net/aspects/examples/performance
To elaborate a little on @pasty's comment, you can intercept your methods invocations with Interception using Unity DI Container, it is indeed requires more code to write, here is a simple sample flow chart of the Unity interception feature:
Note to step 3, where a proxy object is actually returned to the client and thanks to that, the interception behavior is achieved.