Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DevTools] show time of event #11338

Closed
MarnixCroes opened this issue May 12, 2023 · 2 comments · Fixed by #12036
Closed

[DevTools] show time of event #11338

MarnixCroes opened this issue May 12, 2023 · 2 comments · Fixed by #12036

Comments

@MarnixCroes
Copy link

Is your feature request related to a problem? Please describe.
I'm trying to figure out what event (/event chain) happens during a certain action in an app, but I'm unable to tell.
image
Which action is related to my recent scroll? IDK

Describe the solution you'd like
Show the time of an event

How to implement
Show it permanently, or with right click, or enable it as a setting?...

Additional context
Trying to repro a bug in Wasabi Wallet and see what the related event/ event chain is, but I'm unable to tell because of no time being displayed.

@yll690
Copy link
Contributor

yll690 commented Jul 1, 2023

I agree with you so I try to implement it. However there are several problems:

  1. I use the time where EventTreeNode.HandleEvent triggered as the event trigger time as it's inappropriate to add time property to RoutedEventArgs. It seems accurate enough however I'm not sure if it's the best way.
  2. Is it nesassary to display time in event chain? I think no as they basiclly have the same trigger time.
  3. Which format should the time be displayed in? The default format has no millisecond. The "O" format is too long. I prefer the "yyyy-MM-dd HH:mm:ss.fff" or simply "HH:mm:ss.fff". However I'm also worry about the localization.
private void HandleEvent(object? sender, RoutedEventArgs e)
{
    // other codes
    var s = sender!;
    var handled = e.Handled;
    var route = e.Route;
    var triggerTime = DateTime.Now;

    void handler()
    {
        if (_currentEvent == null || !_currentEvent.IsPartOfSameEventChain(e))
        {
            _currentEvent = new FiredEvent(e, new EventChainLink(s, handled, route, triggerTime));
            // other codes
        }
        else
        {
            _currentEvent.AddToChain(new EventChainLink(s, handled, route, triggerTime));
        }
    };
    // other codes
}

image
image

@maxkatz6
Copy link
Member

maxkatz6 commented Jul 4, 2023

@yll690 thanks for looking into it!

  1. Yes, it should be sufficient, as it's only a diagnostic tool.
  2. No, no need to duplicate the same time. Order of events is known anyway.
  3. "HH:mm:ss.fff" sounds good. Yes, it won't localize into details, but this format is still has enough information and is part of diagnostic tool

yll690 added a commit to yll690/Avalonia that referenced this issue Jul 4, 2023
github-merge-queue bot pushed a commit that referenced this issue Jul 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants