0

I wish to measure the time it takes for some of my Actor methods to execute. I plan to use OnPreActorMethodAsync and OnPostActorMethodAsync to log when these methods have begun and finished execution.

However I also wish to measure the time it takes for these methods to execute. My original plan was to use an instance of StopWatch to begin timing in the OnPreActorMethodAsync class and stop in the OnPostActorMethodAsync class. However I'm unsure how I can accessthe same StopWatch instance in the second method. If there is a better way of doing this I would be very interested.

If anyone could point me in the right direction on this matter that would be great.

Many Thanks

Brian Delaney
  • 181
  • 1
  • 16

1 Answers1

0

By using some dirty reflection tricks you can access the Actors' call context. More about it here: https://stackoverflow.com/a/39526751/5946937

(Disclaimer: Actor internals may have changed since then)

LoekD
  • 11,402
  • 17
  • 27