conditional probe semantics
Masami Hiramatsu
mhiramat@redhat.com
Mon Jun 16 09:57:00 GMT 2008
Hi,
Dave Nomura wrote:
> what is the semantic difference between:
> probe process(...)..... if (condition) { ... }
> and
> probe process(...).... { if (condition) { ... } }
>
Currently, the difference appears when using it with aliases.
ex.)
probe probe1 = process(...) ... if (condition) {...}
probe probe2 = process(...) ... {if (condition) {...}}
'probe probe1 {A}' is expanded as
probe process(...) ... {
if (condition) {
...
A
}
}
On the other hand, 'probe probe2 {B}' is expanded as
probe process(...) ... {
if (condition) {...}
B /* always executed */
}
This means, a condition statement following a probe point
or an alias effects all expanded probe points.
So,
probe probe3 = process(...) ... {...}
'probe probe3 if (condition) {A}' is expanded as
probe process(...) ... {
if (condition) {
...
A
}
}
And, 'probe probe3 { if (condition) {B}}' is expanded as
probe process(...) ... {
... /* always executed */
if (condition) {
B
}
}
So, I recommend you to use 'probe ... if (condition) {...}'
for on-the-fly switching.
Thank you,
--
Masami Hiramatsu
Software Engineer
Hitachi Computer Products (America) Inc.
Software Solutions Division
e-mail: mhiramat@redhat.com
More information about the Systemtap
mailing list