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


Java ThreadInfo.getBlockedTime方法代码示例

本文整理汇总了Java中java.lang.management.ThreadInfo.getBlockedTime方法的典型用法代码示例。如果您正苦于以下问题:Java ThreadInfo.getBlockedTime方法的具体用法?Java ThreadInfo.getBlockedTime怎么用?Java ThreadInfo.getBlockedTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.lang.management.ThreadInfo的用法示例。


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

示例1: setDelta

import java.lang.management.ThreadInfo; //导入方法依赖的package包/类
void setDelta(long cpuTime, ThreadInfo info) {
    if (deltaDone) throw new IllegalStateException("setDelta already called once");
    blockedCount = info.getBlockedCount() - blockedCount;
    blockedTime = info.getBlockedTime() - blockedTime;
    waitedCount = info.getWaitedCount() - waitedCount;
    waitedTime = info.getWaitedTime() - waitedTime;
    this.cpuTime = cpuTime - this.cpuTime;
    deltaDone = true;
    this.info = info;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:11,代码来源:HotThreads.java

示例2: MyThreadInfo

import java.lang.management.ThreadInfo; //导入方法依赖的package包/类
MyThreadInfo(long cpuTime, ThreadInfo info) {
    blockedCount = info.getBlockedCount();
    blockedTime = info.getBlockedTime();
    waitedCount = info.getWaitedCount();
    waitedTime = info.getWaitedTime();
    this.cpuTime = cpuTime;
    this.info = info;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:9,代码来源:HotThreads.java

示例3: evaluateInternally

import java.lang.management.ThreadInfo; //导入方法依赖的package包/类
protected final SingleResult evaluateInternally(int round) throws Throwable
{
    // We assume no reordering will take place here.
    final long startTime = clock.time();
    cleanupMemory();
    final long afterGC = clock.time();

    if (round == warmupRounds)
    {
        gcSnapshot = new GCSnapshot();
        benchmarkTime = clock.time();
        warmupTime = benchmarkTime - warmupTime;
    }

    base.evaluate();
    final long endTime = clock.time();

    final long roundBlockedTime;
    if (supportsThreadContention) {
        final long threadId = Thread.currentThread().getId();
        final ThreadInfo threadInfo = threadMXBean.getThreadInfo(threadId);
        final long threadBlockedTime = threadInfo.getBlockedTime();
        final long previousValue = previousThreadBlockedTime.get().getAndSet(threadBlockedTime);
        roundBlockedTime = threadBlockedTime - previousValue;
    } else {
        roundBlockedTime = 0;
    }

    return new SingleResult(startTime, afterGC, endTime, roundBlockedTime);
}
 
开发者ID:adnanmitf09,项目名称:Rubus,代码行数:31,代码来源:BenchmarkStatement.java

示例4: checkThreadInfo

import java.lang.management.ThreadInfo; //导入方法依赖的package包/类
static void checkThreadInfo(ThreadInfo info) throws Exception {
    if (info.getThreadId() != ((Long) values[THREAD_ID]).longValue()) {
        throw new RuntimeException("Thread Id = " + info.getThreadId() +
           " expected = " + values[THREAD_ID]);
    }
    if (!info.getThreadName().equals(values[THREAD_NAME])) {
        throw new RuntimeException("Thread Name = " +
           info.getThreadName() + " expected = " + values[THREAD_NAME]);
    }
    if (info.getThreadState() != Thread.State.RUNNABLE) {
        throw new RuntimeException("Thread Name = " +
           info.getThreadName() + " expected = " + Thread.State.RUNNABLE);
    }
    if (info.getBlockedTime() != ((Long) values[BLOCKED_TIME]).longValue()) {
        throw new RuntimeException("blocked time = " +
           info.getBlockedTime() +
           " expected = " + values[BLOCKED_TIME]);
    }
    if (info.getBlockedCount() != ((Long) values[BLOCKED_COUNT]).longValue()) {
        throw new RuntimeException("blocked count = " +
           info.getBlockedCount() +
           " expected = " + values[BLOCKED_COUNT]);
    }
    if (info.getWaitedTime() != ((Long) values[WAITED_TIME]).longValue()) {
        throw new RuntimeException("waited time = " +
           info.getWaitedTime() +
           " expected = " + values[WAITED_TIME]);
    }
    if (info.getWaitedCount() != ((Long) values[WAITED_COUNT]).longValue()) {
        throw new RuntimeException("waited count = " +
           info.getWaitedCount() +
           " expected = " + values[WAITED_COUNT]);
    }
    if (!info.getLockName().equals(values[LOCK_NAME])) {
        throw new RuntimeException("Lock Name = " +
           info.getLockName() + " expected = " + values[LOCK_NAME]);
    }
    if (info.getLockOwnerId() !=
            ((Long) values[LOCK_OWNER_ID]).longValue()) {
        throw new RuntimeException(
           "LockOwner Id = " + info.getLockOwnerId() +
           " expected = " + values[LOCK_OWNER_ID]);
    }
    if (!info.getLockOwnerName().equals(values[LOCK_OWNER_NAME])) {
        throw new RuntimeException("LockOwner Name = " +
           info.getLockOwnerName() + " expected = " +
           values[LOCK_OWNER_NAME]);
    }

    checkStackTrace(info.getStackTrace());

    checkLockInfo(info.getLockInfo());
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:54,代码来源:ThreadInfoCompositeData.java

示例5: checkThreadInfo

import java.lang.management.ThreadInfo; //导入方法依赖的package包/类
static void checkThreadInfo(ThreadInfo info) throws Exception {
    if (info.getThreadId() != ((Long) values[THREAD_ID]).longValue()) {
        throw new RuntimeException("Thread Id = " + info.getThreadId() +
           " expected = " + values[THREAD_ID]);
    }
    if (!info.getThreadName().equals(values[THREAD_NAME])) {
        throw new RuntimeException("Thread Name = " +
           info.getThreadName() + " expected = " + values[THREAD_NAME]);
    }
    if (info.getThreadState() != Thread.State.RUNNABLE) {
        throw new RuntimeException("Thread Name = " +
           info.getThreadName() + " expected = " + Thread.State.RUNNABLE);
    }
    if (info.getBlockedTime() != ((Long) values[BLOCKED_TIME]).longValue()) {
        throw new RuntimeException("blocked time = " +
           info.getBlockedTime() +
           " expected = " + values[BLOCKED_TIME]);
    }
    if (info.getBlockedCount() != ((Long) values[BLOCKED_COUNT]).longValue()) {
        throw new RuntimeException("blocked count = " +
           info.getBlockedCount() +
           " expected = " + values[BLOCKED_COUNT]);
    }
    if (info.getWaitedTime() != ((Long) values[WAITED_TIME]).longValue()) {
        throw new RuntimeException("waited time = " +
           info.getWaitedTime() +
           " expected = " + values[WAITED_TIME]);
    }
    if (info.getWaitedCount() != ((Long) values[WAITED_COUNT]).longValue()) {
        throw new RuntimeException("waited count = " +
           info.getWaitedCount() +
           " expected = " + values[WAITED_COUNT]);
    }
    if (!info.getLockName().equals(values[LOCK_NAME])) {
        throw new RuntimeException("Lock Name = " +
           info.getLockName() + " expected = " + values[LOCK_NAME]);
    }
    if (info.getLockOwnerId() !=
            ((Long) values[LOCK_OWNER_ID]).longValue()) {
        throw new RuntimeException(
           "LockOwner Id = " + info.getLockOwnerId() +
           " expected = " + values[LOCK_OWNER_ID]);
    }
    if (!info.getLockOwnerName().equals(values[LOCK_OWNER_NAME])) {
        throw new RuntimeException("LockOwner Name = " +
           info.getLockOwnerName() + " expected = " +
           values[LOCK_OWNER_NAME]);
    }
    if (!values[DAEMON].equals(info.isDaemon())) {
        throw new RuntimeException("Daemon = " +
           info.isDaemon() + " expected = " +
           values[DAEMON]);
    }

    checkStackTrace(info.getStackTrace());

    checkLockInfo(info.getLockInfo());
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:59,代码来源:ThreadInfoCompositeData.java


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