12633Sahl /*
22633Sahl  * CDDL HEADER START
32633Sahl  *
42633Sahl  * The contents of this file are subject to the terms of the
52633Sahl  * Common Development and Distribution License (the "License").
62633Sahl  * You may not use this file except in compliance with the License.
72633Sahl  *
82633Sahl  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
92633Sahl  * or http://www.opensolaris.org/os/licensing.
102633Sahl  * See the License for the specific language governing permissions
112633Sahl  * and limitations under the License.
122633Sahl  *
132633Sahl  * When distributing Covered Code, include this CDDL HEADER in each
142633Sahl  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
152633Sahl  * If applicable, add the following below this CDDL HEADER, with the
162633Sahl  * fields enclosed by brackets "[]" replaced with your own identifying
172633Sahl  * information: Portions Copyright [yyyy] [name of copyright owner]
182633Sahl  *
192633Sahl  * CDDL HEADER END
202633Sahl  */
212633Sahl 
222633Sahl /*
23*4926Sjhaslam  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
242633Sahl  * Use is subject to license terms.
252633Sahl  */
262633Sahl 
272633Sahl #pragma ident	"%Z%%M%	%I%	%E% SMI"
282633Sahl 
292633Sahl /*
302633Sahl  * ASSERTION: An Id of zero though invalid may be passed to speculate(),
312633Sahl  * commit() and discard() without any ill effects.
322633Sahl  *
332633Sahl  * SECTION: Speculative Tracing/Creating a Speculation;
342633Sahl  *	Options and Tunables/cleanrate
352633Sahl  */
362633Sahl #pragma D option quiet
37*4926Sjhaslam #pragma D option cleanrate=4000hz
382633Sahl 
392633Sahl BEGIN
402633Sahl {
412633Sahl 	self->commitFlag = 0;
422633Sahl 	self->var1 = speculation();
432633Sahl 	printf("Speculative buffer ID: %d\n", self->var1);
442633Sahl 	self->spec = speculation();
452633Sahl 	printf("Speculative buffer ID: %d\n", self->spec);
462633Sahl }
472633Sahl 
482633Sahl BEGIN
492633Sahl {
502633Sahl 	commit(self->spec);
512633Sahl 	self->commitFlag++;
522633Sahl }
532633Sahl 
542633Sahl BEGIN
552633Sahl /0 < self->commitFlag/
562633Sahl {
572633Sahl 	printf("commit(), self->commitFlag = %d\n", self->commitFlag);
582633Sahl 	exit(0);
592633Sahl }
602633Sahl 
612633Sahl BEGIN
622633Sahl /0 == self->commitFlag/
632633Sahl {
642633Sahl 	printf("commit(), self->commitFlag = %d\n", self->commitFlag);
652633Sahl 	exit(1);
662633Sahl }
67