This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: conditional probe semantics


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]