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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
---
title: performance.mark()
slug: Web/API/Performance/mark
tags:
- API
- Method
- Reference
- Web Performance
translation_of: Web/API/Performance/mark
---
<div>{{APIRef("User Timing API")}}</div>
<p><strong><code>mark()</code></strong> 메소드는 브라우저의 <em>performance entry buffer</em>에 주어진 이름으로 {{domxref("DOMHighResTimeStamp","timestamp")}}를 생성합니다. timestamp가 정의된 응용프로그램은 {{domxref("Performance")}} 인터페이스의 <code>getEntries*()</code> 메소드들을 통해 불러올 수 있습니다. ({{domxref("Performance.getEntries","getEntries()")}}, {{domxref("Performance.getEntriesByName","getEntriesByName()")}}, {{domxref("Performance.getEntriesByType","getEntriesByType()")}}).</p>
<p>{{AvailableInWorkers}}</p>
<p><code>mark</code>의 {{domxref("PerformanceEntry","performance entry")}}는 다음 속성값을 갖습니다:</p>
<ul>
<li>{{domxref("PerformanceEntry.entryType","entryType")}} - "<code>mark</code>"로 설정됩니다.</li>
<li>{{domxref("PerformanceEntry.name","name")}} - mark가 생성될 때 주어진 "<code>name</code>"으로 설정됩니다.</li>
<li>{{domxref("PerformanceEntry.startTime","startTime")}} - <code>mark()</code>가 호출되었을 때의 {{domxref("DOMHighResTimeStamp","timestamp")}}가 설정됩니다.</li>
<li>{{domxref("PerformanceEntry.duration","duration")}} - "<code>0</code>"으로 설정됩니다. (<em>duration</em>이 없는 mark).</li>
</ul>
<p>만약 메서드에 주어진 <code>name</code>이 이미 {{domxref("PerformanceTiming")}} 인터페이스 상에 존재한다면 {{jsxref("SyntaxError")}}를 throw 합니다.</p>
<h2 id="Syntax">Syntax</h2>
<pre class="syntaxbox"><em>performance</em>.mark(name);
</pre>
<h3 id="Arguments">Arguments</h3>
<dl>
<dt>name</dt>
<dd>mark의 이름을 나타내는 {{domxref("DOMString")}}.</dd>
</dl>
<h3 id="Return_value">Return value</h3>
<dl>
<dt>void</dt>
<dd></dd>
</dl>
<h2 id="Example">Example</h2>
<p>다음 예시는 mark()를 사용하여 {{domxref("PerformanceMark")}}를 생성하고 불러오는 방법을 보여줍니다.</p>
<pre class="brush:js">// Create a bunch of marks.
performance.mark("squirrel");
performance.mark("squirrel");
performance.mark("monkey");
performance.mark("monkey");
performance.mark("dog");
performance.mark("dog");
// Get all of the PerformanceMark entries.
const allEntries = performance.getEntriesByType("mark");
console.log(allEntries.length);
// 6
// Get all of the "monkey" PerformanceMark entries.
const monkeyEntries = performance.getEntriesByName("monkey");
console.log(monkeyEntries.length);
// 2
// Clear out all of the marks.
performance.clearMarks();
</pre>
<h2 id="Specifications">Specifications</h2>
<table class="standard-table">
<tbody>
<tr>
<th scope="col">Specification</th>
<th scope="col">Status</th>
<th scope="col">Comment</th>
</tr>
<tr>
<td>{{SpecName('User Timing Level 2', '#dom-performance-mark', 'mark()')}}</td>
<td>{{Spec2('User Timing Level 2')}}</td>
<td>Clarifies <code>mark()</code> processing model.</td>
</tr>
<tr>
<td>{{SpecName('User Timing', '#dom-performance-mark', 'mark()')}}</td>
<td>{{Spec2('User Timing')}}</td>
<td>Basic definition.</td>
</tr>
</tbody>
</table>
<h2 id="Browser_compatibility">Browser compatibility</h2>
<div>
<p>{{Compat("api.Performance.mark")}}</p>
</div>
|