tst.schedargs.ksh revision 6670:1961a43f2335
133965Sjdp# 233965Sjdp# CDDL HEADER START 333965Sjdp# 433965Sjdp# The contents of this file are subject to the terms of the 533965Sjdp# Common Development and Distribution License (the "License"). 633965Sjdp# You may not use this file except in compliance with the License. 733965Sjdp# 833965Sjdp# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 933965Sjdp# or http://www.opensolaris.org/os/licensing. 1033965Sjdp# See the License for the specific language governing permissions 1133965Sjdp# and limitations under the License. 1233965Sjdp# 1333965Sjdp# When distributing Covered Code, include this CDDL HEADER in each 1433965Sjdp# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 1533965Sjdp# If applicable, add the following below this CDDL HEADER, with the 1633965Sjdp# fields enclosed by brackets "[]" replaced with your own identifying 1733965Sjdp# information: Portions Copyright [yyyy] [name of copyright owner] 1833965Sjdp# 1933965Sjdp# CDDL HEADER END 2033965Sjdp# 2133965Sjdp 2233965Sjdp# 2333965Sjdp# Copyright 2008 Sun Microsystems, Inc. All rights reserved. 2433965Sjdp# Use is subject to license terms. 2533965Sjdp# 2633965Sjdp# ident "%Z%%M% %I% %E% SMI" 2733965Sjdp# 2833965Sjdp 2933965Sjdp# 3033965Sjdp# ASSERTION: Sched probe arguments should be valid. 3133965Sjdp# 3233965Sjdp 3333965Sjdpif [ $# != 1 ]; then 3433965Sjdp echo expected one argument: '<'dtrace-path'>' 3533965Sjdp exit 2 3633965Sjdpfi 3733965Sjdp 3833965Sjdp# 3933965Sjdp# do not fail test in a domU 4033965Sjdp# 4133965Sjdpif [ ! -c /dev/xen/privcmd ]; then 4233965Sjdp exit 0 4333965Sjdpfi 4433965Sjdp 4533965Sjdpdtrace=$1 4633965Sjdpoutf=/tmp/sched.args.$$ 4733965Sjdp 4833965Sjdpscript() 4933965Sjdp{ 5033965Sjdp $dtrace -c '/usr/bin/sleep 10' -o $outf -qs /dev/stdin <<EOF 5133965Sjdp xdt:sched::off-cpu, 5233965Sjdp xdt:sched::on-cpu, 5333965Sjdp xdt:sched::block, 5433965Sjdp xdt:sched::sleep, 5533965Sjdp xdt:sched::wake, 5633965Sjdp xdt:sched::yield 5733965Sjdp { 5833965Sjdp /* print domid vcpu pcpu probename */ 5933965Sjdp printf("%d %d %d %s\n", arg1, arg2, arg0, probename); 6033965Sjdp } 6133965SjdpEOF 6233965Sjdp} 6333965Sjdp 6433965Sjdpvalidate() 6533965Sjdp{ 6633965Sjdp /usr/bin/nawk ' 6733965Sjdp BEGIN { 6833965Sjdp while (("/usr/sbin/xm vcpu-list" | getline)) { 6933965Sjdp if ($1 != "Name") { 7033965Sjdp domid = $2 7133965Sjdp vcpu = $3 7233965Sjdp 7333965Sjdp vcpumap[domid, vcpu] = 1 7433965Sjdp 7533965Sjdp split($7, affinity, ",") 7633965Sjdp for (i in affinity) { 7733965Sjdp if (split(affinity[i], p, "-") > 1) { 7833965Sjdp for (pcpu = p[1]; pcpu <= p[2];\ 7933965Sjdp pcpu++) { 8033965Sjdp cpumap[domid, vcpu, 8133965Sjdp pcpu] = 1 8233965Sjdp } 8333965Sjdp } else { 8433965Sjdp cpumap[domid, vcpu, 8533965Sjdp affinity[i]] = 1 8633965Sjdp } 8733965Sjdp } 8833965Sjdp } 8933965Sjdp } 9033965Sjdp } 9133965Sjdp 9233965Sjdp /^$/ { next } 9333965Sjdp 9433965Sjdp /wake/ { 9533965Sjdp if (vcpumap[$1, $2]) { 9633965Sjdp next 9733965Sjdp } else { 9833965Sjdp print "error: " $0 9933965Sjdp exit 1 10033965Sjdp } 10133965Sjdp } 10233965Sjdp 10333965Sjdp { 10433965Sjdp if (cpumap[$1, $2, "any"] || cpumap[$1, $2, $3]) { 10533965Sjdp next 10633965Sjdp } else { 10733965Sjdp print "error: " $0 10833965Sjdp exit 1 10933965Sjdp } 11033965Sjdp } 11133965Sjdp ' $outf 11233965Sjdp} 11333965Sjdp 11433965Sjdpscript 11533965Sjdpstatus=$? 11633965Sjdp 11733965Sjdpif [ $status == 0 ]; then 11833965Sjdp validate 11933965Sjdp status=$? 12033965Sjdpfi 12133965Sjdp 12233965Sjdprm $outf 12333965Sjdpexit $status 12460484Sobrien