Module utrace-probe

Lua API for a utrace-probe

utrace stands for uC-tracer and is a light-weight tracer for C which works on everything from bare-silicon deeply embedded systems, to high-end OS:es like Linux.

Central part of utrace are it's probes which this module controls.

See also

See also:

Info:

  • Copyright: © Michael Ambrus 2018-
  • License: MIT
  • Author: Michael Ambrus michael@ambrus.se

Functions

version () version string
isinit () is module initialized
listall () print all the probes unconditionally
all () Get all probes into a table

Same as "listall" but instead of dumping to stdout, "all" returns a table and the number of elements in it.

total () total number of probes
meta () Probe meta info
setbase (base) setbase

set base directory.

getbase (base) getbase
setdata (probe_id, status, cnt) setdata
setdprobe (probe_id, diff_p) setdprobe

Set another dependent "diff-probe" to calculate deltas from.

getdata (probe_id) getdata


Functions

version ()
version string

Returns:

    string version
isinit ()
is module initialized

Returns:

    integer Balance, 0 if un-initialized.
listall ()
print all the probes unconditionally
all ()
Get all probes into a table

Same as "listall" but instead of dumping to stdout, "all" returns a table and the number of elements in it. This makes furter processing in Lua possible.

Each element in uprobe-table: 1. (intp) ID i.e. address of probe 2. (char) kind T=trace-probe, L=log-entry etc 3. (char) file-name 4. (char) function-name 5. (size_t) line-number

Returns:

  1. integer number of probes
  2. table uprobe-table

Usage:

     -- Print a list similar to probe.listall()
    n,up = probe.all()
    for i=1,n do
        print(up[i][1], up[i][2], up[i][3], up[i][4], up[i][5])
    end
total ()
total number of probes

Returns:

    integer number of probes
meta ()
Probe meta info

Returns:

  1. int start_adress
  2. int stop_adress
  3. int size of section in pytes
  4. int size of a probe: sizeof(struct probe_meta)
setbase (base)
setbase

set base directory. Setting affects all print-outs

Parameters:

getbase (base)
getbase get base directory

Parameters:

setdata (probe_id, status, cnt)
setdata set probe data

Parameters:

  • probe_id long
  • status int (bitmask)
  • cnt int hits

Returns:

    boolean success
setdprobe (probe_id, diff_p)
setdprobe

Set another dependent "diff-probe" to calculate deltas from. This one is event trigger for delta-calculation. To reset/inhibit calculation, set to NULL. Using this function resets deltas, but current ones are returned.

Time-wise the latter probe should be set up to drive calculation. Since deltas and linked probe-ID's are owned, the argument order is reversed. I.e. argument order implies ownership, not the event-order.

Parameters:

  • probe_id long To drive delta-event
  • diff_p long Calculate delta against this probe-ID (link-to)

Returns:

  1. uint64_t curr_dtime
  2. uint64_t curr_dcnt
getdata (probe_id)
getdata get probe data

Parameters:

  • probe_id long

Returns:

  1. Integer status
  2. Integer cnt Number of times probe has been passed
  3. unit64_t time-stamp last seen as active
  4. Integer Probe-ID for self-propelled time delta (if any)
  5. unit64_t Diff-time (if any)
generated by LDoc 1.5.0 Last updated 2025-03-19 12:42:52