Timing Events
Sometimes you want to time an event in your application that spans multiple methods. You can do this by calling StartTimerWithName when the event starts, and then StopTimerWithName when it ends. For example, to track the time a user spends viewing a screen, the instrumentation might look something like the following:
using AppDynamics.Agent;
...
async private void StartCapturePreview_Click(object sender, RoutedEventArgs e) {
capturePreview.Source = captureManager;
Instrumentation.StartTimerWithName("CapturePreview");
await captureManager.StartPreviewAsync();
}
async private void StopCapturePreview_Click(object sender, RoutedEventArgs e) {
await captureManager.StopPreviewAsync();
Instrumentation.StopTimerWithName("CapturePreview");
}