After my last foray into speculations while diagnosing a hang, I decided to write up some things I learned. While checking these things some more, I did a couple of test programs and discovered some really weird things. I wanted to ask if what I am seeing is normal or not.
Here are some things I discovered: 1. Speculation variables are just integers, nothing special about them. Zeroing the variable as in the common commit or discard idiom just resets it to zero so that you can test whether a speculation is available in the boolean to a probe. 2. Speculation buffers are "per cpu". This is documented in the user's guide but is easy to miss. A commit will copy each cpu's speculation buffer to the output, but this is done over a short period of time, not instantly, starting with the speculation buffer that the commit is running on. If you do a commit in an END clause, you will only get the speculation buffer from that cpu and none of the others, since DTrace exits before doing the others (CR 6714341). 3. As you might expect, you cannot speculate on a buffer before it has done a speculation call on that buffer, nor can you speculate on one after a commit or discard until a new speculation call. 4. Calling speculate with a number that is not a currently valid speculation buffer number seems to have no ill effects, except for one odd thing: 5. Did I say that speculation variables are not special? Well, they are not, except in a clause after a speculation, if the variable does not designate a valid speculation buffer. In that case the variable cannot be changed. If you increment it, or reassign it, it has no effect. You exit the clause with the variable having the same value as when speculate was called. This seems really weird to me, since this is not the case if the variable specifies a valid buffer. Any comments? -- blu There are two rules in life: Rule 1- Don't tell people everything you know ---------------------------------------------------------------------- Brian Utterback - Solaris RPE, Sun Microsystems, Inc. Ph:877-259-7345, Em:brian.utterback-at-ess-you-enn-dot-kom _______________________________________________ dtrace-discuss mailing list [email protected]
