zos: correctly get cpu model in uv_cpu_info() (#4136)
The previous implementation using si11v1cpcmodel did not return a valid cpu model on z/OS. So use PCCA instead to correctly get the cpu model. Co-authored-by: Wayne Zhang <shuowang.zhang@ibm.com> Co-authored-by: Gaby Baghdadi <baghdadi@ca.ibm.com> Co-authored-by: Jonathan Lai <jonathan.lai@ibm.com> Fixes: https://github.com/libuv/libuv/issues/4102
This commit is contained in:
parent
011a1ac1a3
commit
fc4840ebc9
@ -19,6 +19,7 @@
|
|||||||
* IN THE SOFTWARE.
|
* IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "uv.h"
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <net/if.h>
|
#include <net/if.h>
|
||||||
@ -30,6 +31,7 @@
|
|||||||
#include <sys/msg.h>
|
#include <sys/msg.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
#include "zos-base.h"
|
#include "zos-base.h"
|
||||||
|
#include "zos-sys-info.h"
|
||||||
#if defined(__clang__)
|
#if defined(__clang__)
|
||||||
#include "csrsic.h"
|
#include "csrsic.h"
|
||||||
#else
|
#else
|
||||||
@ -66,9 +68,6 @@
|
|||||||
/* Total number of frames currently on all available frame queues. */
|
/* Total number of frames currently on all available frame queues. */
|
||||||
#define RCEAFC_OFFSET 0x088
|
#define RCEAFC_OFFSET 0x088
|
||||||
|
|
||||||
/* CPC model length from the CSRSI Service. */
|
|
||||||
#define CPCMODEL_LENGTH 16
|
|
||||||
|
|
||||||
/* Pointer to the home (current) ASCB. */
|
/* Pointer to the home (current) ASCB. */
|
||||||
#define PSAAOLD 0x224
|
#define PSAAOLD 0x224
|
||||||
|
|
||||||
@ -258,9 +257,12 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
|
|||||||
idx = 0;
|
idx = 0;
|
||||||
while (idx < *count) {
|
while (idx < *count) {
|
||||||
cpu_info->speed = *(int*)(info.siv1v2si22v1.si22v1cpucapability);
|
cpu_info->speed = *(int*)(info.siv1v2si22v1.si22v1cpucapability);
|
||||||
cpu_info->model = uv__malloc(CPCMODEL_LENGTH + 1);
|
cpu_info->model = uv__malloc(ZOSCPU_MODEL_LENGTH + 1);
|
||||||
memset(cpu_info->model, '\0', CPCMODEL_LENGTH + 1);
|
if (cpu_info->model == NULL) {
|
||||||
memcpy(cpu_info->model, info.siv1v2si11v1.si11v1cpcmodel, CPCMODEL_LENGTH);
|
uv_free_cpu_info(*cpu_infos, idx);
|
||||||
|
return UV_ENOMEM;
|
||||||
|
}
|
||||||
|
__get_cpu_model(cpu_info->model, ZOSCPU_MODEL_LENGTH + 1);
|
||||||
cpu_info->cpu_times.user = cpu_usage_avg;
|
cpu_info->cpu_times.user = cpu_usage_avg;
|
||||||
/* TODO: implement the following */
|
/* TODO: implement the following */
|
||||||
cpu_info->cpu_times.sys = 0;
|
cpu_info->cpu_times.sys = 0;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user