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: 312633Sahl * Can call discard() on a buffer after it has been commited. 322633Sahl * 332633Sahl * SECTION: Speculative Tracing/Discarding a Speculation; 342633Sahl * Options and Tunables/cleanrate 352633Sahl * 362633Sahl */ 372633Sahl #pragma D option quiet 38*4926Sjhaslam #pragma D option cleanrate=3000hz 392633Sahl 402633Sahl BEGIN 412633Sahl { 422633Sahl self->i = 0; 432633Sahl self->commit = 0; 442633Sahl self->discard = 0; 452633Sahl var1 = speculation(); 462633Sahl printf("Speculation ID: %d\n", var1); 472633Sahl } 482633Sahl 492633Sahl BEGIN 502633Sahl /var1/ 512633Sahl { 522633Sahl speculate(var1); 532633Sahl printf("This statement and the following are speculative!!\n"); 542633Sahl printf("Speculating on id: %d\n", var1); 552633Sahl self->i++; 562633Sahl } 572633Sahl 582633Sahl BEGIN 592633Sahl /(self->i)/ 602633Sahl { 612633Sahl commit(var1); 622633Sahl self->commit++; 632633Sahl discard(var1); 642633Sahl self->discard++; 652633Sahl } 662633Sahl 672633Sahl BEGIN 682633Sahl /self->discard/ 692633Sahl { 702633Sahl printf("Discarded a commited buffer\n"); 712633Sahl exit(0); 722633Sahl } 732633Sahl 742633Sahl 752633Sahl BEGIN 762633Sahl /!self->discard/ 772633Sahl { 782633Sahl printf("Couldnt discard a commited buffer\n"); 792633Sahl exit(1); 802633Sahl } 812633Sahl 822633Sahl ERROR 832633Sahl { 842633Sahl exit(1); 852633Sahl } 86