err.D_COMM_COMM.DisjointCommit.d revision 178476
1227569Sphilip/*
2227569Sphilip * CDDL HEADER START
3227569Sphilip *
4227569Sphilip * The contents of this file are subject to the terms of the
5227569Sphilip * Common Development and Distribution License (the "License").
6227569Sphilip * You may not use this file except in compliance with the License.
7227569Sphilip *
8227569Sphilip * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9227569Sphilip * or http://www.opensolaris.org/os/licensing.
10227569Sphilip * See the License for the specific language governing permissions
11227569Sphilip * and limitations under the License.
12227569Sphilip *
13227569Sphilip * When distributing Covered Code, include this CDDL HEADER in each
14227569Sphilip * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15227569Sphilip * If applicable, add the following below this CDDL HEADER, with the
16227569Sphilip * fields enclosed by brackets "[]" replaced with your own identifying
17227569Sphilip * information: Portions Copyright [yyyy] [name of copyright owner]
18227569Sphilip *
19227569Sphilip * CDDL HEADER END
20227569Sphilip */
21227569Sphilip
22227569Sphilip/*
23227569Sphilip * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
24227569Sphilip * Use is subject to license terms.
25227569Sphilip */
26227569Sphilip
27227569Sphilip#pragma ident	"%Z%%M%	%I%	%E% SMI"
28227569Sphilip
29227569Sphilip/*
30227569Sphilip * ASSERTION:
31227569Sphilip * A clause cannot contain multiple commit() calls to disjoint buffers.
32227569Sphilip *
33227569Sphilip * SECTION: Speculative Tracing/Committing a Speculation;
34227699Sphilip *	Options and Tunables/cleanrate
35227569Sphilip */
36227569Sphilip#pragma D option quiet
37227569Sphilip#pragma D option cleanrate=3000hz
38227569Sphilip
39227569SphilipBEGIN
40227569Sphilip{
41227569Sphilip	self->i = 0;
42227569Sphilip	self->j = 0;
43227569Sphilip	self->commit = 0;
44227569Sphilip	var1 = 0;
45227569Sphilip	var2 = 0;
46227569Sphilip}
47227569Sphilip
48227569SphilipBEGIN
49227569Sphilip{
50227569Sphilip	var1 = speculation();
51278248Sarybchik	printf("Speculation ID: %d\n", var1);
52227569Sphilip}
53227569Sphilip
54227569SphilipBEGIN
55227569Sphilip{
56227569Sphilip	var2 = speculation();
57227569Sphilip	printf("Speculation ID: %d\n", var2);
58227569Sphilip}
59227569Sphilip
60227569SphilipBEGIN
61227569Sphilip/var1/
62227569Sphilip{
63227569Sphilip	speculate(var1);
64227569Sphilip	printf("Speculating on id: %d\n", var1);
65227569Sphilip	self->i++;
66227569Sphilip}
67227569Sphilip
68227569SphilipBEGIN
69227569Sphilip/var2/
70227569Sphilip{
71227569Sphilip	speculate(var2);
72227569Sphilip	printf("Speculating on id: %d", var2);
73227569Sphilip	self->j++;
74227569Sphilip
75227569Sphilip}
76227569Sphilip
77272325SgnnBEGIN
78227569Sphilip/(self->i) && (self->j)/
79227569Sphilip{
80227569Sphilip	commit(var1);
81227569Sphilip	commit(var2);
82227569Sphilip	self->commit++;
83227569Sphilip}
84227569Sphilip
85272325SgnnBEGIN
86227569Sphilip/self->commit/
87227569Sphilip{
88227569Sphilip	printf("Succesfully commited both buffers");
89227569Sphilip	exit(0);
90227569Sphilip}
91227569Sphilip
92227569SphilipBEGIN
93227569Sphilip/!self->commit/
94278838Sarybchik{
95227569Sphilip	printf("Couldnt commit both buffers");
96278248Sarybchik	exit(1);
97278838Sarybchik}
98278838Sarybchik
99278838SarybchikERROR
100227569Sphilip{
101278838Sarybchik	exit(1);
102278838Sarybchik}
103278248Sarybchik