aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/console/timestamp/index.html
blob: 626d63b4691cd3db35381cb53ee885a920e9ae22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
---
title: Console.timeStamp()
slug: Web/API/Console/timeStamp
translation_of: Web/API/Console/timeStamp
---
<div>{{APIRef("Console API")}}{{Non-standard_header}}</div>

<p>向浏览器的 <a href="https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference">Performance</a> 或者 <a href="https://developer.mozilla.org/en-US/docs/Tools/Performance/Waterfall">Waterfall</a> 工具添加一个标记。这样可以让你将代码中的一个点和其他在时间轴上已记录的事件相关联,例如布局事件和绘制事件等。</p>

<p>你可以选择用一个参数来作为时间戳标签,然后标记旁边就会显示这个标签。</p>

<p>{{AvailableInWorkers}}</p>

<h2 id="Syntax">Syntax</h2>

<pre class="syntaxbox">console.timeStamp(label);
</pre>

<h2 id="Parameters">Parameters</h2>

<dl>
 <dt><code>label</code></dt>
 <dd>Label for the timestamp. Optional.</dd>
</dl>

<h2 id="Browser_compatibility">Browser compatibility</h2>

{{Compat("api.console.timeStamp")}}

<h2 id="See_also">See also</h2>

<ul>
 <li>{{domxref("Console.time()")}}</li>
 <li>{{domxref("Console.timeEnd()")}}</li>
 <li><a href="/en-US/docs/Tools/Performance/Waterfall#Timestamp_markers">Adding timestamps to the Waterfall</a></li>
</ul>