• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java TracerMode类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: PerformanceTracker

import com.google.javascript.jscomp.CompilerOptions.TracerMode; //导入依赖的package包/类
PerformanceTracker(Node jsRoot, TracerMode mode) {
  this.jsRoot = jsRoot;
  switch (mode) {
    case TIMING_ONLY:
      this.trackSize = false;
      this.trackGzippedSize = false;
      break;

    case RAW_SIZE:
      this.trackSize = true;
      this.trackGzippedSize = false;
      break;

    case ALL:
      this.trackSize = true;
      this.trackGzippedSize = true;
      break;

    case OFF:
    default:
      throw new UnsupportedOperationException();
  }
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:24,代码来源:PerformanceTracker.java


示例2: PerformanceTracker

import com.google.javascript.jscomp.CompilerOptions.TracerMode; //导入依赖的package包/类
PerformanceTracker(Node jsRoot, TracerMode mode) {
  this.jsRoot = jsRoot;
  switch (mode) {
    case TIMING_ONLY:
      this.trackSize = false;
      this.trackGzSize = false;
      break;

    case RAW_SIZE:
      this.trackSize = true;
      this.trackGzSize = false;
      break;

    case ALL:
      this.trackSize = true;
      this.trackGzSize = true;
      break;

    case OFF:
    default:
      throw new IllegalArgumentException(
          "PerformanceTracker can't work without tracer data.");
  }
}
 
开发者ID:nicks,项目名称:closure-compiler-old,代码行数:25,代码来源:PerformanceTracker.java


示例3: setUp

import com.google.javascript.jscomp.CompilerOptions.TracerMode; //导入依赖的package包/类
@Override
public void setUp() {
  passesRun.clear();
  compiler = new Compiler();
  compiler.initCompilerOptionsIfTesting();
  tracker = new PerformanceTracker(
      new Node(Token.BLOCK), TracerMode.TIMING_ONLY);
  optimizer = new PhaseOptimizer(compiler, tracker, null);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:10,代码来源:PhaseOptimizerTest.java


示例4: PerformanceTracker

import com.google.javascript.jscomp.CompilerOptions.TracerMode; //导入依赖的package包/类
PerformanceTracker(Node externsRoot, Node jsRoot, TracerMode mode, PrintStream printStream) {
  checkArgument(mode != TracerMode.OFF, "PerformanceTracker can't work without tracer data.");
  this.startTime = System.currentTimeMillis();
  this.externsRoot = externsRoot;
  this.jsRoot = jsRoot;
  this.output = printStream == null ? System.out : printStream;
  this.mode = mode;
}
 
开发者ID:google,项目名称:closure-compiler,代码行数:9,代码来源:PerformanceTracker.java


示例5: setUp

import com.google.javascript.jscomp.CompilerOptions.TracerMode; //导入依赖的package包/类
@Override
public void setUp() {
  passesRun.clear();
  dummyExternsRoot = new Node(Token.ROOT);
  dummyScript = IR.script();
  dummyRoot = IR.root(dummyScript);
  compiler = new Compiler();
  compiler.initCompilerOptionsIfTesting();
  tracker = new PerformanceTracker(dummyExternsRoot, dummyRoot, TracerMode.TIMING_ONLY, null);
  optimizer = new PhaseOptimizer(compiler, tracker);
  compiler.setPhaseOptimizer(optimizer);
}
 
开发者ID:google,项目名称:closure-compiler,代码行数:13,代码来源:PhaseOptimizerTest.java


示例6: testOutputFormat

import com.google.javascript.jscomp.CompilerOptions.TracerMode; //导入依赖的package包/类
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,代码行数:28,代码来源:PerformanceTrackerTest.java


示例7: setUp

import com.google.javascript.jscomp.CompilerOptions.TracerMode; //导入依赖的package包/类
@Override
public void setUp() {
  passesRun.clear();
  compiler = new Compiler();
  compiler.initCompilerOptionsIfTesting();
  tracker = new PerformanceTracker(dummyRoot, TracerMode.TIMING_ONLY);
  optimizer = new PhaseOptimizer(compiler, tracker, null);
}
 
开发者ID:nicks,项目名称:closure-compiler-old,代码行数:9,代码来源:PhaseOptimizerTest.java


示例8: setTracerMode

import com.google.javascript.jscomp.CompilerOptions.TracerMode; //导入依赖的package包/类
public void setTracerMode(TracerMode mode) {
    compilerOptions.setTracerMode(mode);
}
 
开发者ID:GeoDienstenCentrum,项目名称:closure-compiler-maven-plugin,代码行数:4,代码来源:CompilerOptionsMojo.java


示例9: tracksSize

import com.google.javascript.jscomp.CompilerOptions.TracerMode; //导入依赖的package包/类
public boolean tracksSize() {
  return this.mode == TracerMode.RAW_SIZE || this.mode == TracerMode.ALL;
}
 
开发者ID:google,项目名称:closure-compiler,代码行数:4,代码来源:PerformanceTracker.java


示例10: tracksGzSize

import com.google.javascript.jscomp.CompilerOptions.TracerMode; //导入依赖的package包/类
public boolean tracksGzSize() {
  return this.mode == TracerMode.ALL;
}
 
开发者ID:google,项目名称:closure-compiler,代码行数:4,代码来源:PerformanceTracker.java


示例11: tracksAstSize

import com.google.javascript.jscomp.CompilerOptions.TracerMode; //导入依赖的package包/类
public boolean tracksAstSize() {
  return this.mode != TracerMode.TIMING_ONLY;
}
 
开发者ID:google,项目名称:closure-compiler,代码行数:4,代码来源:PerformanceTracker.java


示例12: testStatsCalculation

import com.google.javascript.jscomp.CompilerOptions.TracerMode; //导入依赖的package包/类
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,代码行数:64,代码来源:PerformanceTrackerTest.java


示例13: testOutputFormat

import com.google.javascript.jscomp.CompilerOptions.TracerMode; //导入依赖的package包/类
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,代码行数:43,代码来源:PerformanceTrackerTest.java


示例14: testStatsCalculation

import com.google.javascript.jscomp.CompilerOptions.TracerMode; //导入依赖的package包/类
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,代码行数:64,代码来源:PerformanceTrackerTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AdErrorEvent类代码示例发布时间:2022-05-23
下一篇:
Java PersistentLibraryKind类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap