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

Java Timing类代码示例

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

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



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

示例1: parse

import jdk.nashorn.internal.runtime.Timing; //导入依赖的package包/类
/**
 * Execute parse and return the resulting function node.
 * Errors will be thrown and the error manager will contain information
 * if parsing should fail
 *
 * This should be used to create one and only one function node
 *
 * @param scriptName name for the script, given to the parsed FunctionNode
 * @param startPos start position in source
 * @param len length of parse
 * @param allowPropertyFunction if true, "get" and "set" are allowed as first tokens of the program, followed by
 * a property getter or setter function. This is used when reparsing a function that can potentially be defined as a
 * property getter or setter in an object literal.
 *
 * @return function node resulting from successful parse
 */
public FunctionNode parse(final String scriptName, final int startPos, final int len, final boolean allowPropertyFunction) {
    final boolean isTimingEnabled = env.isTimingEnabled();
    final long t0 = isTimingEnabled ? System.nanoTime() : 0L;
    log.info(this, " begin for '", scriptName, "'");

    try {
        stream = new TokenStream();
        lexer  = new Lexer(source, startPos, len, stream, scripting && !env._no_syntax_extensions, reparsedFunction != null);
        lexer.line = lexer.pendingLine = lineOffset + 1;
        line = lineOffset;

        // Set up first token (skips opening EOL.)
        k = -1;
        next();
        // Begin parse.
        return program(scriptName, allowPropertyFunction);
    } catch (final Exception e) {
        handleParseException(e);

        return null;
    } finally {
        final String end = this + " end '" + scriptName + "'";
        if (isTimingEnabled) {
            env._timing.accumulateTime(toString(), System.nanoTime() - t0);
            log.info(end, "' in ", Timing.toMillisPrint(System.nanoTime() - t0), " ms");
        } else {
            log.info(end);
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:47,代码来源:Parser.java


示例2: parse

import jdk.nashorn.internal.runtime.Timing; //导入依赖的package包/类
/**
 * Execute parse and return the resulting function node.
 * Errors will be thrown and the error manager will contain information
 * if parsing should fail
 *
 * This should be used to create one and only one function node
 *
 * @param scriptName name for the script, given to the parsed FunctionNode
 * @param startPos start position in source
 * @param len length of parse
 * @param reparseFlags flags provided by {@link RecompilableScriptFunctionData} as context for
 * the code being reparsed. This allows us to recognize special forms of functions such
 * as property getters and setters or instances of ES6 method shorthand in object literals.
 *
 * @return function node resulting from successful parse
 */
public FunctionNode parse(final String scriptName, final int startPos, final int len, final int reparseFlags) {
    final boolean isTimingEnabled = env.isTimingEnabled();
    final long t0 = isTimingEnabled ? System.nanoTime() : 0L;
    log.info(this, " begin for '", scriptName, "'");

    try {
        stream = new TokenStream();
        lexer  = new Lexer(source, startPos, len, stream, scripting && !env._no_syntax_extensions, env._es6, reparsedFunction != null);
        lexer.line = lexer.pendingLine = lineOffset + 1;
        line = lineOffset;

        scanFirstToken();
        // Begin parse.
        return program(scriptName, reparseFlags);
    } catch (final Exception e) {
        handleParseException(e);

        return null;
    } finally {
        final String end = this + " end '" + scriptName + "'";
        if (isTimingEnabled) {
            env._timing.accumulateTime(toString(), System.nanoTime() - t0);
            log.info(end, "' in ", Timing.toMillisPrint(System.nanoTime() - t0), " ms");
        } else {
            log.info(end);
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:45,代码来源:Parser.java


示例3: parse

import jdk.nashorn.internal.runtime.Timing; //导入依赖的package包/类
/**
 * Execute parse and return the resulting function node.
 * Errors will be thrown and the error manager will contain information
 * if parsing should fail
 *
 * This should be used to create one and only one function node
 *
 * @param scriptName name for the script, given to the parsed FunctionNode
 * @param startPos start position in source
 * @param len length of parse
 * @param allowPropertyFunction if true, "get" and "set" are allowed as first tokens of the program, followed by
 * a property getter or setter function. This is used when reparsing a function that can potentially be defined as a
 * property getter or setter in an object literal.
 *
 * @return function node resulting from successful parse
 */
public FunctionNode parse(final String scriptName, final int startPos, final int len, final boolean allowPropertyFunction) {
    final boolean isTimingEnabled = env.isTimingEnabled();
    final long t0 = isTimingEnabled ? System.nanoTime() : 0L;
    log.info(this, " begin for '", scriptName, "'");

    try {
        stream = new TokenStream();
        lexer  = new Lexer(source, startPos, len, stream, scripting && !env._no_syntax_extensions, env._es6, reparsedFunction != null);
        lexer.line = lexer.pendingLine = lineOffset + 1;
        line = lineOffset;

        scanFirstToken();
        // Begin parse.
        return program(scriptName, allowPropertyFunction);
    } catch (final Exception e) {
        handleParseException(e);

        return null;
    } finally {
        final String end = this + " end '" + scriptName + "'";
        if (isTimingEnabled) {
            env._timing.accumulateTime(toString(), System.nanoTime() - t0);
            log.info(end, "' in ", Timing.toMillisPrint(System.nanoTime() - t0), " ms");
        } else {
            log.info(end);
        }
    }
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:45,代码来源:Parser.java


示例4: parse

import jdk.nashorn.internal.runtime.Timing; //导入依赖的package包/类
/**
 * Execute parse and return the resulting function node.
 * Errors will be thrown and the error manager will contain information
 * if parsing should fail
 *
 * @param scriptName name for the script, given to the parsed FunctionNode
 *
 * @return function node resulting from successful parse
 */
public FunctionNode parse(final String scriptName) {
    final long t0 = Timing.isEnabled() ? System.currentTimeMillis() : 0L;
    LOG.info(this, " begin for '", scriptName, "'");

    try {
        stream = new TokenStream();
        lexer  = new Lexer(source, stream, scripting && !env._no_syntax_extensions);

        // Set up first token (skips opening EOL.)
        k = -1;
        next();

        // Begin parse.
        return program(scriptName);
    } catch (final Exception e) {
        handleParseException(e);

        return null;
    } finally {
        final String end = this + " end '" + scriptName + "'";
        if (Timing.isEnabled()) {
            Timing.accumulateTime(toString(), System.currentTimeMillis() - t0);
            LOG.info(end, "' in ", (System.currentTimeMillis() - t0), " ms");
        } else {
            LOG.info(end);
        }
    }
}
 
开发者ID:RedlineResearch,项目名称:OLD-OpenJDK8,代码行数:38,代码来源:Parser.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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