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.
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.
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]
21 * Portions Copyright 2006-2008 John Birrell jb@freebsd.org
26 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
27 * Use is subject to license terms.
30 #pragma ident "%Z%%M% %I% %E% SMI"
32 #pragma D depends_on module unix
33 #pragma D depends_on provider sched
36 processorid_t cpu_id; /* CPU identifier */
37 psetid_t cpu_pset; /* processor set identifier */
38 chipid_t cpu_chip; /* chip identifier */
39 lgrp_id_t cpu_lgrp; /* locality group identifer */
40 processor_info_t cpu_info; /* CPU information */
43 typedef struct cpuinfo cpuinfo_t;
45 translator cpuinfo_t < cpu_t *C > {
47 cpu_pset = C->cpu_part->cp_id;
48 cpu_chip = C->cpu_physid->cpu_chipid;
49 cpu_lgrp = C->cpu_lpl->lpl_lgrpid;
50 cpu_info = (processor_info_t)C->cpu_type_info;
53 translator cpuinfo_t < disp_t *D > {
54 cpu_id = D->disp_cpu == NULL ? -1 :
55 xlate <cpuinfo_t> (D->disp_cpu).cpu_id;
56 cpu_pset = D->disp_cpu == NULL ? -1 :
57 xlate <cpuinfo_t> (D->disp_cpu).cpu_pset;
58 cpu_chip = D->disp_cpu == NULL ? -1 :
59 xlate <cpuinfo_t> (D->disp_cpu).cpu_chip;
60 cpu_lgrp = D->disp_cpu == NULL ? -1 :
61 xlate <cpuinfo_t> (D->disp_cpu).cpu_lgrp;
62 cpu_info = D->disp_cpu == NULL ?
63 *((processor_info_t *)dtrace`dtrace_zero) :
64 (processor_info_t)xlate <cpuinfo_t> (D->disp_cpu).cpu_info;
67 inline cpuinfo_t *curcpu = xlate <cpuinfo_t *> (curthread->t_cpu);
68 #pragma D attributes Stable/Stable/Common curcpu
69 #pragma D binding "1.0" curcpu
71 inline processorid_t cpu = curcpu->cpu_id;
72 #pragma D attributes Stable/Stable/Common cpu
73 #pragma D binding "1.0" cpu
75 inline psetid_t pset = curcpu->cpu_pset;
76 #pragma D attributes Stable/Stable/Common pset
77 #pragma D binding "1.0" pset
79 inline chipid_t chip = curcpu->cpu_chip;
80 #pragma D attributes Stable/Stable/Common chip
81 #pragma D binding "1.0" chip
83 inline lgrp_id_t lgrp = curcpu->cpu_lgrp;
84 #pragma D attributes Stable/Stable/Common lgrp
85 #pragma D binding "1.0" lgrp