public inbox for dtrace@lists.linux.dev
 help / color / mirror / Atom feed
From: Eugene Loh <eugene.loh@oracle.com>
To: Nick Alcock <nick.alcock@oracle.com>
Cc: dtrace@lists.linux.dev, dtrace-devel@oss.oracle.com
Subject: Re: [PATCH 2/3] Defer stripping out "__data_loc" until we know that is useful
Date: Mon, 15 Sep 2025 00:50:22 -0400	[thread overview]
Message-ID: <c895a7a5-009a-7ea7-cdb4-4c22a3257de3@oracle.com> (raw)
In-Reply-To: <87jz21w4uu.fsf@esperi.org.uk>

On 9/14/25 09:17, Nick Alcock wrote:

> On 13 Sep 2025, eugene loh uttered the following:
>
>> From: Eugene Loh <eugene.loh@oracle.com>
>>
>> Signed-off-by: Eugene Loh <eugene.loh@oracle.com>
> Reviewed-by: Nick Alcock <nick.alcock@oracle.com>

Great, thanks.

> with the tiny caveat below.
>
>> ---
>>   libdtrace/dt_provider_tp.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/libdtrace/dt_provider_tp.c b/libdtrace/dt_provider_tp.c
>> index 33821f2c7..a6f978e3f 100644
>> --- a/libdtrace/dt_provider_tp.c
>> +++ b/libdtrace/dt_provider_tp.c
>> @@ -208,12 +208,13 @@ dt_tp_event_info(dtrace_hdl_t *dtp, FILE *f, int skip, tp_probe_t *tpp,
>>   		p = buf;
>>   		if (sscanf(buf, " field:%[^;]", p) <= 0)
>>   			continue;
>> -		sscanf(p, "__data_loc %[^;]", p);
>>   
>>   		/* We found a field: description - see if we should skip it. */
>>   		if (argc < 0)
>>   			goto skip;
>>   
>> +		sscanf(p, "__data_loc %[^;]", p);
>> +
> ... why not defer the sscanf above it too?

Because it's watching for "field:" lines.  We're not counting lines;  
we're counting lines with "field:" in them.

> The manipulation of argc at
> this point looks like this:
>
>          argc = -skip;
>
> (in getline loop)
>
>                  /* We found a field: description - see if we should skip it. */
>                  if (argc < 0)
>                          goto skip;
> (at loop end)
> 	skip:
>                  argc++;
>          }
>
>
> So if argc is < 0, it's going to *stay* like that until a given number
> of getlines have happened. Doing more work than just skipping and
> getlining is pointless.

Again, we're counting lines that have "field:" in them.

Now, I suppose we could count lines, period, whether they have "field:" 
in them or not (e.g., the ID: line), but I'm okay with forgoing that 
change until some future patch.  I get that this "__data_loc" change is 
no more relevant than what you propose.  But, if folks are okay with it, 
I wouldn't mind just pushing ahead with the patch as it is.

But, yeah, you make a reasonable suggestion.  Thanks.

> (This affects the next patch as much as this
> one. More generally, it might be clearer to move skipping to a separate
> getline loop entirely, above this one that also does all the other work.)

  reply	other threads:[~2025-09-15  4:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-13 15:56 [PATCH 1/3] Clean up unused argsz eugene.loh
2025-09-13 15:56 ` [PATCH 2/3] Defer stripping out "__data_loc" until we know that is useful eugene.loh
2025-09-14 13:17   ` Nick Alcock
2025-09-15  4:50     ` Eugene Loh [this message]
2025-09-13 15:56 ` [PATCH v2 3/3] Add more robust mechanism to skip tracepoint common fields eugene.loh
2025-09-14 13:26   ` [DTrace-devel] " Nick Alcock
2025-09-15  4:56     ` Eugene Loh
2025-09-14 13:11 ` [DTrace-devel] [PATCH 1/3] Clean up unused argsz Nick Alcock

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c895a7a5-009a-7ea7-cdb4-4c22a3257de3@oracle.com \
    --to=eugene.loh@oracle.com \
    --cc=dtrace-devel@oss.oracle.com \
    --cc=dtrace@lists.linux.dev \
    --cc=nick.alcock@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox