当前位置: 首页>>代码示例>>Java>>正文


Java TracerMode.ALL属性代码示例

本文整理汇总了Java中com.google.javascript.jscomp.CompilerOptions.TracerMode.ALL属性的典型用法代码示例。如果您正苦于以下问题:Java TracerMode.ALL属性的具体用法?Java TracerMode.ALL怎么用?Java TracerMode.ALL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.google.javascript.jscomp.CompilerOptions.TracerMode的用法示例。


在下文中一共展示了TracerMode.ALL属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testOutputFormat

public void testOutputFormat() {
  PerformanceTracker tracker =
      new PerformanceTracker(emptyScript, TracerMode.ALL);
  ByteArrayOutputStream output = new ByteArrayOutputStream();
  PrintStream outstream = new PrintStream(output);
  tracker.outputTracerReport(outstream);
  outstream.flush();
  outstream.close();
  Pattern p = Pattern.compile(
      ".*Summary:\npass,runtime,runs,changingRuns,reduction,gzReduction" +
      ".*TOTAL:" +
      "\nRuntime\\(ms\\): [0-9]+" +
      "\n#Runs: [0-9]+" +
      "\n#Changing runs: [0-9]+" +
      "\n#Loopable runs: [0-9]+" +
      "\n#Changing loopable runs: [0-9]+" +
      "\nEstimated Reduction\\(bytes\\): [0-9]+" +
      "\nEstimated GzReduction\\(bytes\\): [0-9]+" +
      "\nEstimated Size\\(bytes\\): -?[0-9]+" +
      "\nEstimated GzSize\\(bytes\\): -?[0-9]+" +
      "\n\nLog:\n" +
      "pass,runtime,runs,changingRuns,reduction,gzReduction,size,gzSize.*",
      Pattern.DOTALL);
  String outputString = output.toString();
  assertTrue("Unexpected output from PerformanceTracker:\n" + outputString,
      p.matcher(outputString).matches());
}
 
开发者ID:nicks,项目名称:closure-compiler-old,代码行数:27,代码来源:PerformanceTrackerTest.java

示例2: tracksSize

public boolean tracksSize() {
  return this.mode == TracerMode.RAW_SIZE || this.mode == TracerMode.ALL;
}
 
开发者ID:google,项目名称:closure-compiler,代码行数:3,代码来源:PerformanceTracker.java

示例3: tracksGzSize

public boolean tracksGzSize() {
  return this.mode == TracerMode.ALL;
}
 
开发者ID:google,项目名称:closure-compiler,代码行数:3,代码来源:PerformanceTracker.java

示例4: testStatsCalculation

public void testStatsCalculation() {
  PerformanceTracker tracker =
      new PerformanceTracker(emptyExternRoot, emptyJsRoot, TracerMode.ALL, null);
  CodeChangeHandler handler = tracker.getCodeChangeHandler();

  // It's sufficient for this test to assume that a single run of any pass
  // takes some fixed amount of time, say 5ms.
  int passRuntime = 5;

  tracker.recordPassStart("noloopA", true);
  handler.reportChange();
  tracker.recordPassStop("noloopA", passRuntime);

  tracker.recordPassStart("noloopB", true);
  handler.reportChange();
  tracker.recordPassStop("noloopB", passRuntime);

  tracker.recordPassStart("loopA", false);
  handler.reportChange();
  tracker.recordPassStop("loopA", passRuntime);

  tracker.recordPassStart("loopA", false);
  tracker.recordPassStop("loopA", passRuntime);

  tracker.recordPassStart("noloopB", true);
  handler.reportChange();
  tracker.recordPassStop("noloopB", passRuntime);

  tracker.recordPassStart("loopB", false);
  tracker.recordPassStop("loopB", passRuntime);

  tracker.recordPassStart("noloopB", true);
  tracker.recordPassStop("noloopB", passRuntime);

  int numRuns = tracker.getRuns();

  assertEquals(7, numRuns);
  assertEquals(tracker.getRuntime(), numRuns * passRuntime);
  assertEquals(3, tracker.getLoopRuns());
  assertEquals(4, tracker.getChanges()); /* reportChange was called 4 times */
  assertEquals(1, tracker.getLoopChanges());

  ImmutableMap<String, Stats> stats = tracker.getStats();
  Stats st = stats.get("noloopA");
  assertEquals(1, st.runs);
  assertEquals(st.runtime, passRuntime);
  assertEquals(1, st.changes);

  st = stats.get("noloopB");
  assertEquals(3, st.runs);
  assertEquals(st.runtime, 3 * passRuntime);
  assertEquals(2, st.changes);

  st = stats.get("loopA");
  assertEquals(2, st.runs);
  assertEquals(st.runtime, 2 * passRuntime);
  assertEquals(1, st.changes);

  st = stats.get("loopB");
  assertEquals(1, st.runs);
  assertEquals(st.runtime, passRuntime);
  assertEquals(0, st.changes);
}
 
开发者ID:google,项目名称:closure-compiler,代码行数:63,代码来源:PerformanceTrackerTest.java

示例5: testOutputFormat

public void testOutputFormat() {
  ByteArrayOutputStream output = new ByteArrayOutputStream();
  try (PrintStream outstream = new PrintStream(output)) {
    PerformanceTracker tracker =
        new PerformanceTracker(emptyExternRoot, emptyJsRoot, TracerMode.ALL, outstream);
    tracker.outputTracerReport();
  }
  Pattern p = Pattern.compile(Joiner.on("\n").join(
      ".*TOTAL:",
      "Start time\\(ms\\): [0-9]+",
      "End time\\(ms\\): [0-9]+",
      "Wall time\\(ms\\): [0-9]+",
      "Passes runtime\\(ms\\): [0-9]+",
      "Max mem usage \\(measured after each pass\\)\\(MB\\): -?[0-9]+",
      "#Runs: [0-9]+",
      "#Changing runs: [0-9]+",
      "#Loopable runs: [0-9]+",
      "#Changing loopable runs: [0-9]+",
      "Estimated AST reduction\\(#nodes\\): [0-9]+",
      "Estimated Reduction\\(bytes\\): [0-9]+",
      "Estimated GzReduction\\(bytes\\): [0-9]+",
      "Estimated AST size\\(#nodes\\): -?[0-9]+",
      "Estimated Size\\(bytes\\): -?[0-9]+",
      "Estimated GzSize\\(bytes\\): -?[0-9]+",
      "",
      "Inputs:",
      "JS lines:   [0-9]+",
      "JS sources: [0-9]+",
      "Extern lines:   [0-9]+",
      "Extern sources: [0-9]+",
      "",
      "Summary:",
      "pass,runtime,allocMem,runs,changingRuns,astReduction,reduction,gzReduction",
      "",
      "Log:",
      "pass,runtime,allocMem,codeChanged,astReduction,reduction,gzReduction,astSize,size,gzSize",
      "",
      ".*"),
      Pattern.DOTALL);
  String outputString = output.toString();
  assertThat(outputString).matches(p);
}
 
开发者ID:google,项目名称:closure-compiler,代码行数:42,代码来源:PerformanceTrackerTest.java

示例6: testStatsCalculation

public void testStatsCalculation() {
  PerformanceTracker tracker =
      new PerformanceTracker(emptyScript, TracerMode.ALL);
  CodeChangeHandler handler = tracker.getCodeChangeHandler();

  // It's sufficient for this test to assume that a single run of any pass
  // takes some fixed amount of time, say 5ms.
  int passRuntime = 5;

  tracker.recordPassStart("noloopA", true);
  handler.reportChange();
  tracker.recordPassStop("noloopA", passRuntime);

  tracker.recordPassStart("noloopB", true);
  handler.reportChange();
  tracker.recordPassStop("noloopB", passRuntime);

  tracker.recordPassStart("loopA", false);
  handler.reportChange();
  tracker.recordPassStop("loopA", passRuntime);

  tracker.recordPassStart("loopA", false);
  tracker.recordPassStop("loopA", passRuntime);

  tracker.recordPassStart("noloopB", true);
  handler.reportChange();
  tracker.recordPassStop("noloopB", passRuntime);

  tracker.recordPassStart("loopB", false);
  tracker.recordPassStop("loopB", passRuntime);

  tracker.recordPassStart("noloopB", true);
  tracker.recordPassStop("noloopB", passRuntime);

  int numRuns = tracker.getRuns();

  assertEquals(numRuns, 7);
  assertEquals(tracker.getRuntime(), numRuns * passRuntime);
  assertEquals(tracker.getLoopRuns(), 3);
  assertEquals(tracker.getChanges(), 4); /* reportChange was called 4 times */
  assertEquals(tracker.getLoopChanges(), 1);

  ImmutableMap<String, Stats> stats = tracker.getStats();
  Stats st = stats.get("noloopA");
  assertEquals(st.runs, 1);
  assertEquals(st.runtime, passRuntime);
  assertEquals(st.changes, 1);

  st = stats.get("noloopB");
  assertEquals(st.runs, 3);
  assertEquals(st.runtime, 3 * passRuntime);
  assertEquals(st.changes, 2);

  st = stats.get("loopA");
  assertEquals(st.runs, 2);
  assertEquals(st.runtime, 2 * passRuntime);
  assertEquals(st.changes, 1);

  st = stats.get("loopB");
  assertEquals(st.runs, 1);
  assertEquals(st.runtime, passRuntime);
  assertEquals(st.changes, 0);
}
 
开发者ID:nicks,项目名称:closure-compiler-old,代码行数:63,代码来源:PerformanceTrackerTest.java


注:本文中的com.google.javascript.jscomp.CompilerOptions.TracerMode.ALL属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。