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

Specify console.timeLog() + clean up timing #138

Merged
merged 4 commits into from
Jul 4, 2018

Conversation

domfarolino
Copy link
Member

@domfarolino domfarolino commented May 25, 2018

This PR:

  • Adds timeLog to the Console Standard (and specifies that it should use Printer instead of Logger so we ignore format specifiers appearing in a timer label.
  • Cleans up the way we interact with associated timer tables in the timing methods - this is a little prep work for later when we check (non)existence of timer table entries so we can formally report warnings.
  • Points to an issue Timing and Counting methods should report warnings when necessary #134 to show plans for having the timing methods formally report warnings.
  • Fixes timeEnd to actually remove a timer from the timer table (the reason we went with adding timeLog)
  • Adds an example show how someone might use the extra ...data passed into timeLog to distinguish calls to timeLog from each other throughout the duration of a timer.
  • Fixes countReset's permalink to be all lowercase (that seems to be the trend here)
  • Closes Intermediate values with console.time #84

Interested in getting some opinions from @xirzec, @nchevobbe, and @JosephPecoraro on this to make sure we have consensus and can get this in ASAP! (will file browser bugs soon)

Bugs

@domfarolino domfarolino added the needs tests Moving the issue forward requires someone to write tests label May 25, 2018
index.bs Outdated

<p class="note">See <a href="https://github.com/whatwg/console/issues/134">whatwg/console#134</a>
for plans to make {{console/timeEnd()}} and {{console/timeLog()}} formally report warnings to the
console when a give |label| does not exist in the associated <a>timer table</a>.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A small typo here, the word "given" is misspelled. This looks good otherwise :)

@domfarolino domfarolino added the impacts documentation Used by documentation communities, such as MDN, to track changes that impact documentation label May 27, 2018
index.bs Outdated
associated <a>timer table</a>.
1. Let |timerTable| be the associated <a>timer table</a>.
1. Let |startTime| be |timerTable|[|label|].
1. [=map/set|Remove=] |timerTable|[|label|].
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably map/remove but I have to take a closer look

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should be able to just do [=map/Remove=]

@domfarolino domfarolino requested a review from domenic June 6, 2018 16:56
Copy link
Member

@domenic domenic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with nits, fun stuff

index.bs Outdated
associated <a>timer table</a>.
1. Let |timerTable| be the associated <a>timer table</a>.
1. Let |startTime| be |timerTable|[|label|].
1. [=map/set|Remove=] |timerTable|[|label|].
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should be able to just do [=map/Remove=]

index.bs Outdated
@@ -389,7 +423,7 @@ their output similarly, in four broad categories. This table summarizes these co
<td>log</td>
<td>
{{console/log()}}, {{console/trace()}}, {{console/dir()}}, {{console/dirxml()}},
{{console/group()}}, {{console/groupCollapsed()}}, {{console/debug()}}
{{console/group()}}, {{console/groupCollapsed()}}, {{console/debug()}} {{console/timeLog()}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing comma

index.bs Outdated
1. Perform <a abstract-op>Logger</a>("timeEnd", « |concat| »).
1. Perform <a abstract-op>Printer</a>("timeEnd", « |concat| »).

<h4 id="timelog" method for="console">timeLog(|label|, ...|data|)</h4>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if putting "log" between time ("start") and "end" might make be nicer?

@domfarolino
Copy link
Member Author

Rebased this as well. Will get moving on bugs + tests.

Copy link

@nchevobbe nchevobbe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some small comments, but this looks good to me

index.bs Outdated
1. Let |startTime| be |timerTable|[|label|].
1. Let |duration| be a string representing the difference between the current time and
|startTime|, in an implementation-defined format.
1. Let |concat| be the concatenation of |label|, U+003A (:), U+0020 SPACE, and |duration|.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we indicate what the duration represent (milliseconds, seconds, ...) ?
It seems that there is a bit more information about it in the timeEnd section.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think what I'll do here is move the example in timeEnd up to here since the first instance of time represented in an implementation-defined format should probably do the explaining. Probably don't need to add it again in timeEnd since it's a repeat step and already will have an example here.

index.bs Outdated

<pre><code class="lang-javascript">
console.time("MyTimer");
console.timeLog("MyTimer", "Starting application up...");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Replace ... with the proper ellipsis char

index.bs Outdated
console.timeLog("MyTimer", "UI is setup, making API calls now");
// Perhaps some fetch()'s here filling the app with data
// ...
console.timeLog("MyTimer", "All done!");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this case would make sense since timeEndalready prints the final timer duration.

@domfarolino domfarolino removed the needs tests Moving the issue forward requires someone to write tests label Jun 20, 2018
@xirzec
Copy link

xirzec commented Jun 26, 2018

Also seems reasonable to me. /cc @TheLarkInn

(and apologies for the delay!)

targos added a commit to targos/node that referenced this pull request Jun 30, 2018
@domfarolino domfarolino merged commit 9690f7a into master Jul 4, 2018
@domfarolino domfarolino deleted the add-timelog-clean-up-timing branch July 4, 2018 05:00
targos added a commit to nodejs/node that referenced this pull request Jul 4, 2018
Refs: whatwg/console#138

PR-URL: #21312
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Gus Caplan <[email protected]>
Reviewed-By: Anatoli Papirovski <[email protected]>
Reviewed-By: Weijia Wang <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: James M Snell <[email protected]>
targos added a commit to nodejs/node that referenced this pull request Jul 6, 2018
Refs: whatwg/console#138

PR-URL: #21312
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Gus Caplan <[email protected]>
Reviewed-By: Anatoli Papirovski <[email protected]>
Reviewed-By: Weijia Wang <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impacts documentation Used by documentation communities, such as MDN, to track changes that impact documentation
Development

Successfully merging this pull request may close these issues.

5 participants