1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 /* 22 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 */ 25 26 #pragma D depends_on module unix 27 #pragma D depends_on provider sched 28 29 struct cpuinfo { 30 processorid_t cpu_id; /* CPU identifier */ 31 psetid_t cpu_pset; /* processor set identifier */ 32 chipid_t cpu_chip; /* chip identifier */ 33 lgrp_id_t cpu_lgrp; /* locality group identifer */ 34 processor_info_t cpu_info; /* CPU information */ 35 }; 36 37 typedef struct cpuinfo cpuinfo_t; 38 39 translator cpuinfo_t < cpu_t *C > { 40 cpu_id = C->cpu_id; 41 cpu_pset = C->cpu_part->cp_id; 42 cpu_chip = C->cpu_physid->cpu_chipid; 43 cpu_lgrp = C->cpu_lpl->lpl_lgrpid; 44 cpu_info = (processor_info_t)C->cpu_type_info; 45 }; 46 47 translator cpuinfo_t < disp_t *D > { 48 cpu_id = D->disp_cpu == NULL ? -1 : 49 xlate <cpuinfo_t> (D->disp_cpu).cpu_id; 50 cpu_pset = D->disp_cpu == NULL ? -1 : 51 xlate <cpuinfo_t> (D->disp_cpu).cpu_pset; 52 cpu_chip = D->disp_cpu == NULL ? -1 : 53 xlate <cpuinfo_t> (D->disp_cpu).cpu_chip; 54 cpu_lgrp = D->disp_cpu == NULL ? -1 : 55 xlate <cpuinfo_t> (D->disp_cpu).cpu_lgrp; 56 cpu_info = D->disp_cpu == NULL ? 57 *((processor_info_t *)dtrace`dtrace_zero) : 58 (processor_info_t)xlate <cpuinfo_t> (D->disp_cpu).cpu_info; 59 }; 60 61 inline cpuinfo_t *curcpu = xlate <cpuinfo_t *> (curthread->t_cpu); 62 #pragma D attributes Stable/Stable/Common curcpu 63 #pragma D binding "1.0" curcpu 64 65 inline processorid_t cpu = curcpu->cpu_id; 66 #pragma D attributes Stable/Stable/Common cpu 67 #pragma D binding "1.0" cpu 68 69 inline psetid_t pset = curcpu->cpu_pset; 70 #pragma D attributes Stable/Stable/Common pset 71 #pragma D binding "1.0" pset 72 73 inline chipid_t chip = curcpu->cpu_chip; 74 #pragma D attributes Stable/Stable/Common chip 75 #pragma D binding "1.0" chip 76 77 inline lgrp_id_t lgrp = curcpu->cpu_lgrp; 78 #pragma D attributes Stable/Stable/Common lgrp 79 #pragma D binding "1.0" lgrp 80 81