Permalink
Browse files

fix uv_cpu_info on solaris

  • Loading branch information...
1 parent b34cfb4 commit 2702b685469ecce9c81d55343eeeb65a5448ba58 @ry ry committed Dec 15, 2011
Showing with 9 additions and 8 deletions.
  1. +8 −8 src/unix/sunos.c
  2. +1 −0 test/test-platform-output.c
View
@@ -352,20 +352,20 @@ uv_err_t uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
cpu_info->cpu_times.irq = 0;
} else {
knp = (kstat_named_t *) kstat_data_lookup(ksp, (char *)"cpu_ticks_user");
- assert(knp->data_type == KSTAT_DATA_INT32);
- cpu_info->cpu_times.user = knp->value.i32;
+ assert(knp->data_type == KSTAT_DATA_UINT64);
+ cpu_info->cpu_times.user = knp->value.ui64;
knp = (kstat_named_t *) kstat_data_lookup(ksp, (char *)"cpu_ticks_kernel");
- assert(knp->data_type == KSTAT_DATA_INT32);
- cpu_info->cpu_times.sys = knp->value.i32;
+ assert(knp->data_type == KSTAT_DATA_UINT64);
+ cpu_info->cpu_times.sys = knp->value.ui64;
knp = (kstat_named_t *) kstat_data_lookup(ksp, (char *)"cpu_ticks_idle");
- assert(knp->data_type == KSTAT_DATA_INT32);
- cpu_info->cpu_times.idle = knp->value.i32;
+ assert(knp->data_type == KSTAT_DATA_UINT64);
+ cpu_info->cpu_times.idle = knp->value.ui64;
knp = (kstat_named_t *) kstat_data_lookup(ksp, (char *)"intr");
- assert(knp->data_type == KSTAT_DATA_INT32);
- cpu_info->cpu_times.irq = knp->value.i32;
+ assert(knp->data_type == KSTAT_DATA_UINT64);
+ cpu_info->cpu_times.irq = knp->value.ui64;
cpu_info->cpu_times.nice = 0;
}
@@ -62,6 +62,7 @@ TEST_IMPL(platform_output) {
uv_free_cpu_info(cpus, count);
err = uv_interface_addresses(&interfaces, &count);
+ ASSERT(UV_OK == err.code);
fprintf(stderr, "uv_interface_addresses:\n");
for (i = 0; i < count; i++) {

0 comments on commit 2702b68

Please sign in to comment.