1179189Sjb/* 2179189Sjb * CDDL HEADER START 3179189Sjb * 4179189Sjb * The contents of this file are subject to the terms of the 5179189Sjb * Common Development and Distribution License (the "License"). 6179189Sjb * You may not use this file except in compliance with the License. 7179189Sjb * 8179189Sjb * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9179189Sjb * or http://www.opensolaris.org/os/licensing. 10179189Sjb * See the License for the specific language governing permissions 11179189Sjb * and limitations under the License. 12179189Sjb * 13179189Sjb * When distributing Covered Code, include this CDDL HEADER in each 14179189Sjb * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15179189Sjb * If applicable, add the following below this CDDL HEADER, with the 16179189Sjb * fields enclosed by brackets "[]" replaced with your own identifying 17179189Sjb * information: Portions Copyright [yyyy] [name of copyright owner] 18179189Sjb * 19179189Sjb * CDDL HEADER END 20179189Sjb * 21179189Sjb * Portions Copyright 2006-2008 John Birrell jb@freebsd.org 22179189Sjb * 23179189Sjb * $FreeBSD: releng/10.2/cddl/lib/libdtrace/sched.d 179189 2008-05-22 04:26:42Z jb $ 24179189Sjb */ 25179189Sjb/* 26179189Sjb * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 27179189Sjb * Use is subject to license terms. 28179189Sjb */ 29179189Sjb 30179189Sjb#pragma ident "%Z%%M% %I% %E% SMI" 31179189Sjb 32179189Sjb#pragma D depends_on module unix 33179189Sjb#pragma D depends_on provider sched 34179189Sjb 35179189Sjbstruct cpuinfo { 36179189Sjb processorid_t cpu_id; /* CPU identifier */ 37179189Sjb psetid_t cpu_pset; /* processor set identifier */ 38179189Sjb chipid_t cpu_chip; /* chip identifier */ 39179189Sjb lgrp_id_t cpu_lgrp; /* locality group identifer */ 40179189Sjb processor_info_t cpu_info; /* CPU information */ 41179189Sjb}; 42179189Sjb 43179189Sjbtypedef struct cpuinfo cpuinfo_t; 44179189Sjb 45179189Sjbtranslator cpuinfo_t < cpu_t *C > { 46179189Sjb cpu_id = C->cpu_id; 47179189Sjb cpu_pset = C->cpu_part->cp_id; 48179189Sjb cpu_chip = C->cpu_physid->cpu_chipid; 49179189Sjb cpu_lgrp = C->cpu_lpl->lpl_lgrpid; 50179189Sjb cpu_info = (processor_info_t)C->cpu_type_info; 51179189Sjb}; 52179189Sjb 53179189Sjbtranslator cpuinfo_t < disp_t *D > { 54179189Sjb cpu_id = D->disp_cpu == NULL ? -1 : 55179189Sjb xlate <cpuinfo_t> (D->disp_cpu).cpu_id; 56179189Sjb cpu_pset = D->disp_cpu == NULL ? -1 : 57179189Sjb xlate <cpuinfo_t> (D->disp_cpu).cpu_pset; 58179189Sjb cpu_chip = D->disp_cpu == NULL ? -1 : 59179189Sjb xlate <cpuinfo_t> (D->disp_cpu).cpu_chip; 60179189Sjb cpu_lgrp = D->disp_cpu == NULL ? -1 : 61179189Sjb xlate <cpuinfo_t> (D->disp_cpu).cpu_lgrp; 62179189Sjb cpu_info = D->disp_cpu == NULL ? 63179189Sjb *((processor_info_t *)dtrace`dtrace_zero) : 64179189Sjb (processor_info_t)xlate <cpuinfo_t> (D->disp_cpu).cpu_info; 65179189Sjb}; 66179189Sjb 67179189Sjbinline cpuinfo_t *curcpu = xlate <cpuinfo_t *> (curthread->t_cpu); 68179189Sjb#pragma D attributes Stable/Stable/Common curcpu 69179189Sjb#pragma D binding "1.0" curcpu 70179189Sjb 71179189Sjbinline processorid_t cpu = curcpu->cpu_id; 72179189Sjb#pragma D attributes Stable/Stable/Common cpu 73179189Sjb#pragma D binding "1.0" cpu 74179189Sjb 75179189Sjbinline psetid_t pset = curcpu->cpu_pset; 76179189Sjb#pragma D attributes Stable/Stable/Common pset 77179189Sjb#pragma D binding "1.0" pset 78179189Sjb 79179189Sjbinline chipid_t chip = curcpu->cpu_chip; 80179189Sjb#pragma D attributes Stable/Stable/Common chip 81179189Sjb#pragma D binding "1.0" chip 82179189Sjb 83179189Sjbinline lgrp_id_t lgrp = curcpu->cpu_lgrp; 84179189Sjb#pragma D attributes Stable/Stable/Common lgrp 85179189Sjb#pragma D binding "1.0" lgrp 86179189Sjb 87