On Mon, Jun 26, 2023 at 08:58:47PM +0000, Klemens Nanni wrote:
> On Mon, Jun 26, 2023 at 10:52:20PM +0200, Claudio Jeker wrote:
> > count() is strange since it only works on maps (at least from what I
> > figured out). I need to double check how min() and max() work. Since the
> > usage also seems non-intuitive.
> > 
> > I find the documentation of bt(5) rather weak. So more is needed for sure.
> 
> Agreed, I'm fine with your diff as-is and improving docs later.
 
Was this an OK for all of the diff?

Btw. I think this is a better version of the bt.5 change. I moved the map
specific functions into their own section.

-- 
:wq Claudio

Index: bt.5
===================================================================
RCS file: /cvs/src/usr.sbin/btrace/bt.5,v
retrieving revision 1.14
diff -u -p -r1.14 bt.5
--- bt.5        31 Mar 2022 17:27:29 -0000      1.14
+++ bt.5        27 Jun 2023 13:25:54 -0000
@@ -111,8 +111,8 @@ Full name of the probe.
 Return value of the traced syscall.
 .It Va tid
 Thread ID of the current thread.
-.\".It Va ustack
-.\"Userland stack of the current thread.
+.It Va ustack
+Userland stack of the current thread.
 .El
 .Pp
 Functions:
@@ -141,10 +141,6 @@ and
 with buckets of
 .Va step
 size.
-.It Fn max
-Returns the maximum recorded value.
-.It Fn min
-Returns the minimum recorded value.
 .It Fn print "@map"
 Print all pairs from
 .Va @map .
@@ -162,8 +158,6 @@ Return the string from argument
 truncated to
 .Va index
 characters (up to 64, the default) including a guaranteed NUL-terminator.
-.It Fn sum
-Returns the sum of all recorded values.
 .It Fn time timefmt
 Print timestamps using
 .Xr strftime 3 .
@@ -171,6 +165,25 @@ Print timestamps using
 Set all values from
 .Va @map
 to 0.
+.El
+.Pp
+Operation on maps:
+.Pp
+The following functions only work on a sepcific map entry.
+.Bl -tag -width "count"
+.It "@map[key]" = Fn count
+Increase the stored value for
+.Va key
+by one.
+.It "@map[key]" = Fn max "value"
+Store the maximum recorded value for
+.Va key .
+.It "@map[key]" = Fn min "value"
+Store the minimum recorded value for
+.Va key .
+.It "@map[key]" = Fn sum "value"
+Store the sum of all recorded values for
+.Va key .
 .El
 .Sh SEE ALSO
 .Xr awk 1 ,

Reply via email to