To end this thread, here is a final program, that prints the value of core_id,
that is unique for each core:
/* Compile with cc -lkstat */
#include <kstat.h>
#include <string>
main(){
kstat_ctl_t *kc;
kstat_t *kp;
kstat_named_t* kn;
kc = kstat_open();
for (kp = kc->kc_chain; kp != 0; kp = kp->ks_next) {
if (strncmp(kp->ks_name, "cpu_info", 8) == 0) {
kstat_read(kc, kp, NULL);
kn = (kstat_named_t*)kstat_data_lookup(kp, "core_id");
printf("%d \n",kn->value.l);
}
}
kstat_close(kc);
}
This message posted from opensolaris.org
_______________________________________________
opensolaris-discuss mailing list
opensolaris-discuss@opensolaris.org