Changeset View
Changeset View
Standalone View
Standalone View
lib/libkvm/kvm_cptime.c
Show First 20 Lines • Show All 90 Lines • ▼ Show 20 Lines | if (kd == NULL) { | ||||
kvm_cp_time_cached = 0; | kvm_cp_time_cached = 0; | ||||
return (0); | return (0); | ||||
} | } | ||||
if (ISALIVE(kd)) | if (ISALIVE(kd)) | ||||
return (getsysctl(kd, "kern.cp_time", cp_time, sizeof(long) * | return (getsysctl(kd, "kern.cp_time", cp_time, sizeof(long) * | ||||
CPUSTATES)); | CPUSTATES)); | ||||
if (!kd->arch->ka_native(kd)) { | |||||
_kvm_err(kd, kd->program, | |||||
"cannot read cp_time from non-native core"); | |||||
return (-1); | |||||
} | |||||
if (kvm_cp_time_cached == 0) { | if (kvm_cp_time_cached == 0) { | ||||
if (_kvm_cp_time_init(kd) < 0) | if (_kvm_cp_time_init(kd) < 0) | ||||
return (-1); | return (-1); | ||||
} | } | ||||
/* If this kernel has a "cp_time[]" symbol, then just read that. */ | /* If this kernel has a "cp_time[]" symbol, then just read that. */ | ||||
if (kvm_cp_time_nl[NL_CP_TIME].n_value != 0) { | if (kvm_cp_time_nl[NL_CP_TIME].n_value != 0) { | ||||
if (kvm_read(kd, kvm_cp_time_nl[NL_CP_TIME].n_value, cp_time, | if (kvm_read(kd, kvm_cp_time_nl[NL_CP_TIME].n_value, cp_time, | ||||
Show All 28 Lines |