@Around aspect and Kotlin suspended function


I try to understand how to create an @Around aspect for a Kotlin’s suspended function (for example, to measure time spent in this function, or for a custom @Transactional aspect):

suspend fun test() {
    delay(50) // invokes ProceedingJoinPoint#proceed() before this line

Since this function has a suspend function call, the @Around aspect’s proceed function will be invoked right before delay() call. But obviously I’d like to measure full time spent in the function.

What is the right way to solve it? Maybe I can somehow subscribe on the last continuation in the method, or smth like that?