[DTrace-devel] [PATCH 2/5] cmd: report lowered/raised buffer sizes correctly

Eugene Loh eugene.loh at oracle.com
Tue May 2 02:19:39 UTC 2023


Actually, this change also is related to pebs buffer sizing. That is, 
dt_pebs_init() does a bunch of resizing but it does not report back what 
it's done.  The code below needs that information.  So, dt_pebs_init() 
needs to modify its optval to reflect what it's doing and its resize 
reporting should be eliminated in favor of the code below.

On 5/1/23 15:48, Kris Van Hees via DTrace-devel wrote:
> Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
> ---
>   cmd/dtrace.c | 11 +++++++----
>   1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/cmd/dtrace.c b/cmd/dtrace.c
> index e7ca9e4c..fe771740 100644
> --- a/cmd/dtrace.c
> +++ b/cmd/dtrace.c
> @@ -833,8 +833,9 @@ go(void)
>   		return;
>   
>   	for (i = 0; bufs[i].name != NULL; i++) {
> -		dtrace_optval_t j = 0, mul = 10;
> -		dtrace_optval_t nsize;
> +		dtrace_optval_t	j = 0, mul = 10;
> +		dtrace_optval_t	nsize;
> +		char		*dir;
>   
>   		if (bufs[i].val == DTRACEOPT_UNSET)
>   			continue;
> @@ -844,14 +845,16 @@ go(void)
>   		if (nsize == DTRACEOPT_UNSET || nsize == 0)
>   			continue;
>   
> -		if (nsize >= bufs[i].val - sizeof(uint64_t))
> +		if (nsize == bufs[i].val)
>   			continue;
>   
> +		dir = nsize > bufs[i].val ? "raised" : "lowered";
> +
>   		for (; (INT64_C(1) << mul) <= nsize; j++, mul += 10)
>   			continue;
>   
>   		if (!(nsize & ((INT64_C(1) << (mul - 10)) - 1))) {
> -			error("%s lowered to %lld%c\n", bufs[i].name,
> +			error("%s %s to %lld%c\n", bufs[i].name, dir,
>   			    (long long)nsize >> (mul - 10), " kmgtpe"[j]);
>   		} else {
>   			error("%s lowered to %lld bytes\n", bufs[i].name,



More information about the DTrace-devel mailing list