Skip to content

Commit 10e9471

Browse files
cleanup
1 parent 19513b7 commit 10e9471

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

src/jdk.management/aix/native/libmanagement_ext/UnixOperatingSystem.c

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ Java_com_sun_management_internal_OperatingSystemImpl_getCpuLoad0
6262
cpu_total_old = cpu_total;
6363
initialized = 1;
6464
last_sample_time = now;
65-
return -1.0; // Not enough data yet
65+
return -1.0;
6666
}
6767

6868
long long user_diff = cpu_total.user - cpu_total_old.user;
@@ -75,14 +75,7 @@ Java_com_sun_management_internal_OperatingSystemImpl_getCpuLoad0
7575
return -1.0;
7676
}
7777

78-
printf("User diff: %lld\n", user_diff);
79-
printf("Sys diff: %lld\n", sys_diff);
80-
printf("Idle diff: %lld\n", idle_diff);
81-
printf("Wait diff: %lld\n", wait_diff);
82-
83-
8478
double load = (double)(user_diff + sys_diff) / total;
85-
printf("load:%.4f\n",load);
8679
fflush(stdout);
8780
last_cpu_load = load;
8881
last_sample_time = now;
@@ -101,36 +94,27 @@ Java_com_sun_management_internal_OperatingSystemImpl_getProcessCpuLoad0
10194
double user_diff, sys_diff, delta_time;
10295

10396
if (perfstat_process(&id, &curr_stats, sizeof(perfstat_process_t), 1) < 0) {
104-
return -1.0;
97+
return -1.0;
10598
}
10699
if (!initialized) {
107100
prev_stats = curr_stats;
108101
prev_timebase = curr_stats.last_timebase;
109102
initialized = 1;
110103
return -1.0;
111104
}
112-
printf("initialised done");
113105
curr_timebase = curr_stats.last_timebase;
114106
timebase_diff = curr_timebase - prev_timebase;
115-
116107
if ((long long)timebase_diff <= 0 || XINTFRAC == 0) {
117108
return -1.0;
118109
}
119110

120111
delta_time = HTIC2SEC(timebase_diff);
121-
122112
user_diff = (double)(curr_stats.ucpu_time - prev_stats.ucpu_time);
123113
sys_diff = (double)(curr_stats.scpu_time - prev_stats.scpu_time);
124-
125114
prev_stats = curr_stats;
126115
prev_timebase = curr_timebase;
127-
128116
double cpu_load = (user_diff + sys_diff) / delta_time;
129-
130117
return (jdouble)cpu_load;
131-
132-
133-
134118
}
135119

136120
JNIEXPORT jdouble JNICALL

0 commit comments

Comments
 (0)