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]

[Bug translator/3849] New: Delay assigning command-line parameters until runtime


Currently all command-line parameters to scripts are substituted at parse-time.
 This prevents us from using the cached code when the parameter value changes. 
In many cases we could easily do a "lazy" assignment that doesn't happen until
runtime.  Consider the following simple script that watches for creation of a
particular process name:

  probe process.exec_complete {
    if (execname() == @1)
      printf("start %d\n", pid())
  }

The "@1" parameter might change between invocations, but it should be possible
to the same cached version of the script.  But since the parser substitutes the
value in right away, the hash for the script is different for each parameter.

One suggestion is to synthesize global variables for the command-line arguments,
and initialize them at runtime through module parameters.  These can be
read-only globals, since parameters aren't valid lvalues, so no locks are needed.

Some analysis will be needed to determine when this optimization is possible, as
some cases need to be resolved at translation time -- e.g.,
module(@1).function(@2), kernel.statement($3), timer.sec($4).  (Actually, some
like timers might still be able to get delayed values, but we can consider that
a future enhancement.)

-- 
           Summary: Delay assigning command-line parameters until runtime
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: translator
        AssignedTo: systemtap at sources dot redhat dot com
        ReportedBy: joshua dot i dot stone at intel dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=3849

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.


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