aboutsummaryrefslogtreecommitdiff
path: root/files/pt-br/web/api/performance
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:42:52 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:42:52 -0500
commit074785cea106179cb3305637055ab0a009ca74f2 (patch)
treee6ae371cccd642aa2b67f39752a2cdf1fd4eb040 /files/pt-br/web/api/performance
parentda78a9e329e272dedb2400b79a3bdeebff387d47 (diff)
downloadtranslated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.gz
translated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.bz2
translated-content-074785cea106179cb3305637055ab0a009ca74f2.zip
initial commit
Diffstat (limited to 'files/pt-br/web/api/performance')
-rw-r--r--files/pt-br/web/api/performance/index.html138
-rw-r--r--files/pt-br/web/api/performance/now/index.html160
-rw-r--r--files/pt-br/web/api/performance/tojson/index.html61
3 files changed, 359 insertions, 0 deletions
diff --git a/files/pt-br/web/api/performance/index.html b/files/pt-br/web/api/performance/index.html
new file mode 100644
index 0000000000..28e3a63c06
--- /dev/null
+++ b/files/pt-br/web/api/performance/index.html
@@ -0,0 +1,138 @@
+---
+title: Performance
+slug: Web/API/Performance
+tags:
+ - API
+ - Interface
+ - Navigation Timing
+ - NeedsTranslation
+ - Performance
+ - Reference
+ - TopicStub
+ - Web Performance
+translation_of: Web/API/Performance
+---
+<div>{{APIRef("High Resolution Time")}}</div>
+
+<p>The <strong><code>Performance</code></strong> interface represents timing-related performance information for the given page.</p>
+
+<p>An object of this type can be obtained by calling the {{domxref("Window.performance")}} read-only attribute.</p>
+
+<div class="note">
+<p><strong><em>Note</em>: </strong>This interface and its members are available in <a href="/en-US/docs/Web/API/Web_Workers_API">Web Workers</a>, except where indicated below. Note that some available parts of the interface are not yet documented (see the <a href="http://www.w3.org/TR/performance-timeline/#sec-window.performance-attribute">Performance Timeline</a> and <a href="http://www.w3.org/TR/user-timing/#extensions-performance-interface">User Timing</a> specs for more details.) Also note that performance markers and measures are per context. If you create a mark on the main thread (or other worker), you cannot see it in a worker thread, and vice versa.</p>
+</div>
+
+<h2 id="Properties">Properties</h2>
+
+<p><em>The <code>Performance</code> interface doesn't inherit any properties.</em></p>
+
+<dl>
+ <dt>{{domxref("Performance.navigation")}} {{readonlyInline}}</dt>
+ <dd>Is a {{domxref("PerformanceNavigation")}} object representing the type of navigation that occurs in the given browsing context, like the amount of redirections needed to fetch the resource. Not available in workers.</dd>
+ <dt>{{domxref("Performance.onframetimingbufferfull")}}</dt>
+ <dd>TBD</dd>
+ <dt>{{domxref("Performance.onresourcetimingbufferfull")}}</dt>
+ <dd>Is an {{domxref("EventTarget")}} which is a callback that will be called when the {{event("resourcetimingbufferfull")}} event is fired.</dd>
+ <dt>{{domxref("Performance.timing")}} {{readonlyInline}}</dt>
+ <dd>Is a {{domxref("PerformanceTiming")}} object containing latency-related performance information. Not available in workers.</dd>
+</dl>
+
+<h2 id="Methods">Methods</h2>
+
+<p><em><em>The <code>Performance</code> interface doesn't inherit any </em>method</em>.</p>
+
+<dl>
+ <dt>{{domxref("Performance.clearFrameTimings()")}}</dt>
+ <dd>TBD</dd>
+ <dt>{{domxref("Performance.clearMarks()")}}</dt>
+ <dd>Removes the given <em>mark</em> from the browser's performance entry buffer.</dd>
+ <dt>{{domxref("Performance.clearMeasures()")}}</dt>
+ <dd>Removes the given <em>measure</em> from the browser's performance entry buffer.</dd>
+ <dt>{{domxref("Performance.clearResourceTimings()")}}</dt>
+ <dd>Removes all {{domxref("PerformanceEntry","performance entries")}} with a {{domxref("PerformanceEntry.entryType","entryType")}} of "<code>resource</code>" from the browser's performance data buffer.</dd>
+ <dt>{{domxref("Performance.getEntries()")}}</dt>
+ <dd>Returns a list of {{domxref("PerformanceEntry")}} objects based on the given <em>filter</em>.</dd>
+ <dt>{{domxref("Performance.getEntriesByName()")}}</dt>
+ <dd>Returns a list of {{domxref("PerformanceEntry")}} objects based on the given <em>name</em> and <em>entry type</em>.</dd>
+ <dt>{{domxref("Performance.getEntriesByType()")}}</dt>
+ <dd>Returns a list of {{domxref("PerformanceEntry")}} objects of the given <em>entry type</em>.</dd>
+ <dt>{{domxref("Performance.mark()")}}</dt>
+ <dd>Creates a {{domxref("DOMHighResTimeStamp","timestamp")}} in the browser's <em>performance entry buffer</em> with the given name.</dd>
+ <dt>{{domxref("Performance.measure()")}}</dt>
+ <dd>Creates a named {{domxref("DOMHighResTimeStamp","timestamp")}} in the browser's performance entry buffer between two specified marks (known as the <em>start mark</em> and <em>end mark</em>, respectively).</dd>
+ <dt>{{domxref("Performance.now()")}}</dt>
+ <dd>Returns a {{domxref("DOMHighResTimeStamp")}} representing the amount of milliseconds elapsed since a reference instant.</dd>
+ <dt>{{domxref("Performance.setFrameTimingBufferSize()")}}</dt>
+ <dd>TBD</dd>
+ <dt>{{domxref("Performance.setResourceTimingBufferSize()")}}</dt>
+ <dd>Sets the browser's resource timing buffer size to the specified number of "<code>resource</code>" {{domxref("PerformanceEntry.entryType","type")}} {{domxref("PerformanceEntry","performance entry")}} objects.</dd>
+ <dt>{{domxref("Performance.toJSON()")}}</dt>
+ <dd>Is a jsonizer returning a json object representing the <code>Performance</code> object.</dd>
+</dl>
+
+<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('Highres Time Level 2', '#the-performance-interface', 'toJSON()')}}</td>
+ <td>{{Spec2('Highres Time Level 2')}}</td>
+ <td>Defines <code>toJson()</code> method.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('Highres Time', '#the-performance-interface', 'Performance')}}</td>
+ <td>{{Spec2('Highres Time')}}</td>
+ <td>Defines <code>now()</code> method.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('Navigation Timing', '#sec-window.performance-attribute', 'Performance')}}</td>
+ <td>{{Spec2('Navigation Timing')}}</td>
+ <td>Defines <code>timing</code> and <code>navigation</code> properties.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('Performance Timeline Level 2', '#extensions-to-the-performance-interface', 'Performance extensions')}}</td>
+ <td>{{Spec2('Performance Timeline Level 2')}}</td>
+ <td>Changes <code>getEntries()</code> interface.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('Performance Timeline', '#sec-window.performance-attribute', 'Performance extensions')}}</td>
+ <td>{{Spec2('Performance Timeline')}}</td>
+ <td>Defines <code>getEntries()</code>, <code>getEntriesByType()</code> and <code>getEntriesByName()</code> methods.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('Resource Timing', '#extensions-performance-interface', 'Performance extensions')}}</td>
+ <td>{{Spec2('Resource Timing')}}</td>
+ <td>Defines <code>clearResourceTimings()</code> and <code>setResourceTimingBufferSize()</code> methods and the <code>onresourcetimingbufferfull</code> property.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('User Timing Level 2', '#extensions-performance-interface', 'Performance extensions')}}</td>
+ <td>{{Spec2('User Timing Level 2')}}</td>
+ <td>Clarifies <code>mark()</code>, <code>clearMark()</code>, <code>measure()</code> and <code>clearMeasure()</code> methods.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('User Timing', '#extensions-performance-interface', 'Performance extensions')}}</td>
+ <td>{{Spec2('User Timing')}}</td>
+ <td>Defines <code>mark()</code>, <code>clearMark()</code>, <code>measure()</code> and <code>clearMeasure()</code> methods.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('<span style="line-height: 1.5;">Frame Timing', '#extensions-performance-interface','Performance extensions')}}</span></td>
+ <td>{{Spec2('User Timing')}}</td>
+ <td>Defines <code>clearFrameTimings()</code>, <code>setFrameTimingBufferSize()</code>, and <code>onframetimingbufferfull</code> methods.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+<div>
+<div>
+
+
+<p>{{Compat("api.Performance")}}</p>
+</div>
+</div>
diff --git a/files/pt-br/web/api/performance/now/index.html b/files/pt-br/web/api/performance/now/index.html
new file mode 100644
index 0000000000..b6539ebebe
--- /dev/null
+++ b/files/pt-br/web/api/performance/now/index.html
@@ -0,0 +1,160 @@
+---
+title: performance.now()
+slug: Web/API/Performance/now
+translation_of: Web/API/Performance/now
+---
+<div>{{APIRef("High Resolution Timing")}}</div>
+
+<p>O método <code><strong>performance.now()</strong></code> retorna {{domxref("DOMHighResTimeStamp")}}, medido em milisegundos, com precisão de cinco milésimos de milissegundo (5 microsegundos).</p>
+
+<p>O valor retornado representa o tempo decorrido desde o <strong>time origin </strong>(the {{domxref("PerformanceTiming.navigationStart")}} property). Em um web worker, o tempo inicial é o momento em que o contexto da execução(e.g. thread ou processo) é criado. Em uma janela, é o tempo em que o usuário iniciou a navegação neste documento. Tenha em mente que:</p>
+
+<ul>
+ <li>Em workers dedicados criados do {{domxref("Window")}}, o valor neste worker será inferior a <code>performance.now()</code> na window que gerou este worker. Normalmente é o mesmo que <code>t0</code> no contexto principal, mas esse valor foi alterado.</li>
+ <li>Em shared workers ou service workers, o valor do worker pode ser maior em relação ao contexto principal poir estas janelas podem ser criadas depois destes workers.</li>
+</ul>
+
+<h2 id="Sintaxe">Sintaxe</h2>
+
+<pre class="syntaxbox"><em>t</em> = performance.now();</pre>
+
+<h2 id="Exemplo">Exemplo</h2>
+
+<pre class="brush: js">var t0 = performance.now();
+doSomething();
+var t1 = performance.now();
+console.log("Call to doSomething took " + (t1 - t0) + " milliseconds.");
+</pre>
+
+<p>Unlike other timing data available to JavaScript (for example <a href="/en-US/docs/JavaScript/Reference/Global_Objects/Date/now"><code>Date.now</code></a>), the timestamps returned by <code>Performance.now()</code> are not limited to one-millisecond resolution. Instead, they represent times as floating-point numbers with up to microsecond precision.</p>
+
+<p>Also unlike <code>Date.now()</code>, the values returned by <code>Performance.now() </code>always increase at a constant rate, independent of the system clock (which might be adjusted manually or skewed by software like NTP). Otherwise, <code>performance.timing.navigationStart + performance.now() </code>will be approximately equal to<code> Date.now()</code>.</p>
+
+<h2 id="Especificações">Especificações</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('Highres Time Level 2', '#dom-performance-now', 'performance.now()')}}</td>
+ <td>{{Spec2('Highres Time Level 2')}}</td>
+ <td>Stricter definitions of interfaces and types.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('Highres Time', '#dom-performance-now', 'performance.now()')}}</td>
+ <td>{{Spec2('Highres Time')}}</td>
+ <td>Initial definition</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Compatibilidade_de_Navegadores">Compatibilidade de Navegadores</h2>
+
+<p>{{CompatibilityTable}}</p>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Edge</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatChrome("20.0")}} {{property_prefix("webkit")}}<br>
+ {{CompatChrome("24.0")}} [1]</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatGeckoDesktop("15.0")}}</td>
+ <td>10.0</td>
+ <td>{{CompatOpera("15.0")}}</td>
+ <td>{{CompatSafari("8.0")}}</td>
+ </tr>
+ <tr>
+ <td>on Web workers</td>
+ <td>{{CompatChrome("33")}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatGeckoDesktop("34.0")}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ <tr>
+ <td><code>now()</code> in a dedicated worker is now separate from the main context's <code>now()</code>.</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatGeckoDesktop("45.0")}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Android Webview</th>
+ <th>Edge</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ <th>Chrome for Android</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatAndroid("4.0")}}</td>
+ <td>{{CompatChrome("25.0")}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatGeckoMobile("15.0")}}</td>
+ <td>10.0</td>
+ <td>{{CompatNo}}</td>
+ <td>9</td>
+ <td>{{CompatChrome("25.0")}}</td>
+ </tr>
+ <tr>
+ <td>on Web workers</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatGeckoMobile("34.0")}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ <tr>
+ <td><code>now()</code> in a dedicated worker is now separate from the main context's <code>now()</code>.</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatGeckoMobile("45.0")}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<p>[1] Windows versions of Chrome 20 through 33 return <code>performance.now()</code> only to millisecond precision.</p>
+
+<h2 id="Veja_também">Veja também</h2>
+
+<ul>
+ <li><a href="http://updates.html5rocks.com/2012/08/When-milliseconds-are-not-enough-performance-now">When milliseconds are not enough: performance.now() </a>from HTML5 Rocks.</li>
+</ul>
diff --git a/files/pt-br/web/api/performance/tojson/index.html b/files/pt-br/web/api/performance/tojson/index.html
new file mode 100644
index 0000000000..2dac99f0f5
--- /dev/null
+++ b/files/pt-br/web/api/performance/tojson/index.html
@@ -0,0 +1,61 @@
+---
+title: Performance.toJSON()
+slug: Web/API/Performance/toJSON
+translation_of: Web/API/Performance/toJSON
+---
+<div>{{APIRef("High Resolution Timing")}}</div>
+
+<p>O método <strong><code>toJSON()</code></strong> da interface {{domxref("Performance")}} é um serializador padrão: Ele retorna uma representação em JSON das propriedades do objeto performance.</p>
+
+<h2 id="Sintaxe">Sintaxe</h2>
+
+<pre class="syntaxbox">minhaPerf = performance.toJSON()
+</pre>
+
+<h3 id="Argumentos">Argumentos</h3>
+
+<dl>
+ <dt>Nenhum</dt>
+ <dd> </dd>
+</dl>
+
+<h3 id="Valor_de_retorno">Valor de retorno</h3>
+
+<dl>
+ <dt>minhaPerf</dt>
+ <dd>Um objeto JSON que é a serialização do objeto {{domxref("Performance")}}.</dd>
+</dl>
+
+<h2 id="Exemplo">Exemplo</h2>
+
+<pre class="brush: js">var js;
+js = window.performance.toJSON();
+console.log("json = " + JSON.stringify(js));
+</pre>
+
+<h2 id="Especificações">Especificações</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('Highres Time Level 2', '#the-performance-interface', 'toJSON() serializer')}}</td>
+ <td>{{Spec2('Highres Time Level 2')}}</td>
+ <td>Define <code>toJson()</code>.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Compatibilidade_de_navegadores">Compatibilidade de navegadores</h2>
+
+<div>
+<div>
+
+
+<p>{{Compat("api.Performance.toJSON")}}</p>
+</div>
+</div>