[dtrace-discuss] What am I missing in the dtrace script?
michael schuster
Michael.Schuster at Sun.COM
Tue Jul 10 15:35:03 PDT 2007
Brian D. Horn wrote:
> I've asked around, I tried searching on-line, but no go.
>
> I would think what I am seeing is impossible or that there must
> be a bug in dtrace on MP systems (at least on 64-bit amd systems)
> as this was run on a Sun Fire x4500 (4-way Opteron - aka "Thumper")
>
> Here is the script:
>
>
> #! /usr/sbin/dtrace -s
>
> BEGIN
> {
> total_queued = 0;
> queuing_failed = 0;
> queuing_succeeded = 0;
> }
[...]
> And below is the output:
>
> ^C
> CPU ID FUNCTION:NAME
> 3 2 :END
> Total 970818 succeeded 485824 failed 485584
>
> Note that:
>
> # bc
> 485824+485584
> 971408
>
> So the sum of the two cases with qualifiers do not sum
> to the the total. I've seen this before and running the script
> with all but one CPU off line seems to "fix" the problem.
[...]
> Is it a known issue that probes might be double counted or
> missed on MP systems? Am I crazy? Am I trying to do
> something that dtrace doesn't really support?
you're using global variables. I don't think DTrace does any
synchronisation about its own globals, ie you may be missing some
updates. running with only once CPU eliminates any possible race
condition, so you see this go away.
use thread - local variables (self-> ...), that should help.
HTH
Michael
--
Michael Schuster Sun Microsystems, Inc.
recursion, n: see 'recursion'
More information about the dtrace-discuss
mailing list