Sha256: f7596a54d615830efb72cd2eda0637335b7dd8c7039c5aaec5863cabe8ce17b3

Contents?: true

Size: 1.55 KB

Versions: 8

Compression:

Stored size: 1.55 KB

Contents

<!DOCTYPE html>
<html>
<!--
Copyright 2006 The Closure Library Authors. All Rights Reserved.

Use of this source code is governed by the Apache License, Version 2.0.
See the COPYING file for details.
-->
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Closure Unit Tests - goog.util.Tracer</title>
<script src="../base.js"></script>
<script>
  goog.require('goog.debug.Trace');
  goog.require('goog.testing.jsunit');
</script>
</head>
<body>
<script>

  function testTracer() {
    goog.debug.Trace.initCurrentTrace();
    var t = goog.debug.Trace.startTracer('foo');
    var sum = 0;
    for (var i = 0; i < 100000; i++) {
      sum += i;
    }
    goog.debug.Trace.stopTracer(t);
    var trace = goog.debug.Trace.getFormattedTrace();
    var lines = trace.split('\n');
    assertEquals(8, lines.length);
    assertNotNull(lines[0].match(/^\s*\d+\.\d+\s+Start\s+foo$/));
    assertNotNull(lines[1].match(/^\s*\d+\s+\d+\.\d+\s+Done\s+\d+ ms\s+foo$/));
  }

  function testPerf() {
    goog.debug.Trace.initCurrentTrace();
    var count = 1000;
    var start = goog.now();
    for (var i = 0; i < count; i++) {
      var t = goog.debug.Trace.startTracer('foo');
      var t2 = goog.debug.Trace.startTracer('foo.bar');
      var t3 = goog.debug.Trace.startTracer('foo.bar.baz');
      goog.debug.Trace.stopTracer(t3);
      var t4 = goog.debug.Trace.startTracer('foo.bar.bim');
      goog.debug.Trace.stopTracer(t4);
      goog.debug.Trace.stopTracer(t2);
      goog.debug.Trace.stopTracer(t);
    }
    count *= 4;
    var end = goog.now();
  }


</script>
</body>
</html>

Version data entries

8 entries across 8 versions & 3 rubygems

Version Path
k4compiler-0.0.1 third_party/closure-library/closure/goog/debug/tracer_test.html
middleman-wizard-template-1.0.4 lib/middleman-wizard-template/template/closure/library/closure/goog/debug/tracer_test.html
middleman-wizard-template-1.0.3 lib/middleman-wizard-template/template/closure/library/closure/goog/debug/tracer_test.html
middleman-wizard-template-1.0.2 lib/middleman-wizard-template/template/closure/library/closure/goog/debug/tracer_test.html
middleman-wizard-template-1.0.1 lib/middleman-wizard-template/template/closure/library/closure/goog/debug/tracer_test.html
middleman-wizard-template-1.0.0.pre.1 lib/middleman-wizard-template/template/closure/library/closure/goog/debug/tracer_test.html
closure-1.2.701 closure-library/closure/goog/debug/tracer_test.html
closure-1.1.692 closure-library/closure/goog/debug/tracer_test.html