err.D_ACT_SPEC.SpeculateWithChill.d revision 2633:71bab08d24b2
1193323Sed#!/usr/sbin/dtrace -ws
2193323Sed/*
3193323Sed * CDDL HEADER START
4193323Sed *
5193323Sed * The contents of this file are subject to the terms of the
6193323Sed * Common Development and Distribution License (the "License").
7193323Sed * You may not use this file except in compliance with the License.
8193323Sed *
9193323Sed * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10193323Sed * or http://www.opensolaris.org/os/licensing.
11193323Sed * See the License for the specific language governing permissions
12193323Sed * and limitations under the License.
13193323Sed *
14193323Sed * When distributing Covered Code, include this CDDL HEADER in each
15193323Sed * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16193323Sed * If applicable, add the following below this CDDL HEADER, with the
17193323Sed * fields enclosed by brackets "[]" replaced with your own identifying
18193323Sed * information: Portions Copyright [yyyy] [name of copyright owner]
19193323Sed *
20198090Srdivacky * CDDL HEADER END
21198090Srdivacky */
22193323Sed
23193323Sed/*
24193323Sed * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
25193323Sed * Use is subject to license terms.
26193323Sed */
27193323Sed
28193323Sed#pragma ident	"%Z%%M%	%I%	%E% SMI"
29218893Sdim
30193323Sed/*
31193323Sed * ASSERTION:
32193323Sed * Destructive actions may never be speculative.
33193323Sed *
34193323Sed * SECTION: Speculative Tracing/Using a Speculation
35193323Sed * SECTION: dtrace (1M) Utility/ -w option
36193323Sed *
37193323Sed */
38193323Sed#pragma D option quiet
39193323Sed
40193323SedBEGIN
41193323Sed{
42193323Sed	i = 0;
43193323Sed}
44193323Sed
45193323Sedprofile:::tick-1sec
46193323Sed/i < 1/
47193323Sed{
48193323Sed	var = speculation();
49193323Sed	speculate(var);
50193323Sed	printf("Speculation ID: %d", var);
51193323Sed	chill(10);
52193323Sed	i++;
53193323Sed}
54193323Sed
55193323Sedprofile:::tick-1sec
56198090Srdivacky/1 == 1/
57193323Sed{
58218893Sdim	exit(0);
59193323Sed}
60193323Sed
61193323SedERROR
62193323Sed{
63193323Sed	exit(0);
64193323Sed}
65218893Sdim
66193323SedEND
67193323Sed{
68193323Sed	exit(0);
69193323Sed}
70193323Sed