This is the mail archive of the 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/5219] printd and printdln broken

------- Additional Comments From hunt at redhat dot com  2007-10-25 20:41 -------
Subject: Re:  printd and printdln broken

On Thu, 2007-10-25 at 19:39 +0000, joshua dot i dot stone at intel dot
com wrote:
> ------- Additional Comments From joshua dot i dot stone at intel dot com  2007-10-25 19:39 -------
> (In reply to comment #0)
> > printd[ln] cannot take a string variable as the first argument.
> > probe begin {
> > 	b = ","
> > 	printd(b,"foo","bar")
> > 	println("")
> > 	exit()
> > }
> Currently a call like printd(",", "foo", 42, "bar") gets synthesized into
> _stp_printf("%s,%d,%s", "foo", 42, "bar").  Using non-literal delimiters, would
> have to be instead:
>   _stp_printf("%s%s%d%s%s", "foo", delim, 42, delim, "bar")

That looks fine to me.

> Perhaps we could still optimize the literal case though.

Why bother? I timed the above examples and measured their speed as
identical within a few percent.

Of course, if everything was a literal, we could do some serious
optimization, but that case will likely never happen in real life.

> Do you really see a need to have non-literal delimiters?

It came up in some code I was writing, the first time I ever used
printd. What about examples where you might want to specify the
delimiter on the command line. I think it is also bad to have hidden
requirements that some strings need be literals.

> > Also printd[ln] cannot handle case where there is only one values to print:
> This is consistent with the documentation, which specifies "two or more values."

OK then.  Forget that part. 



------- 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]