mirror of
https://github.com/openjdk/jdk.git
synced 2026-05-11 14:11:36 +00:00
8235681: Remove unnecessary workarounds in UnixOperatingSystem.c
Reviewed-by: cjplummer, amenkov
This commit is contained in:
parent
3884792cda
commit
5ac7dfa2bf
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -38,6 +38,8 @@
|
||||
#include <inttypes.h>
|
||||
#include "com_sun_management_internal_OperatingSystemImpl.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
struct ticks {
|
||||
uint64_t used;
|
||||
uint64_t usedKernel;
|
||||
@ -250,7 +252,7 @@ static double get_cpuload_internal(int which, double *pkernelLoad, CpuLoadTarget
|
||||
|
||||
pthread_mutex_lock(&lock);
|
||||
|
||||
if(perfInit() == 0) {
|
||||
if (perfInit() == 0) {
|
||||
|
||||
if (target == CPU_LOAD_VM_ONLY) {
|
||||
pticks = &counters.jvmTicks;
|
||||
@ -270,14 +272,10 @@ static double get_cpuload_internal(int which, double *pkernelLoad, CpuLoadTarget
|
||||
failed = 1;
|
||||
}
|
||||
|
||||
if(!failed) {
|
||||
// seems like we sometimes end up with less kernel ticks when
|
||||
// reading /proc/self/stat a second time, timing issue between cpus?
|
||||
if (pticks->usedKernel < tmp.usedKernel) {
|
||||
kdiff = 0;
|
||||
} else {
|
||||
kdiff = pticks->usedKernel - tmp.usedKernel;
|
||||
}
|
||||
if (!failed) {
|
||||
|
||||
assert(pticks->usedKernel >= tmp.usedKernel);
|
||||
kdiff = pticks->usedKernel - tmp.usedKernel;
|
||||
tdiff = pticks->total - tmp.total;
|
||||
udiff = pticks->used - tmp.used;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user