Discussion:
add inverse option to ministat
John-Mark Gurney
2015-07-15 00:20:13 UTC
Permalink
I have created a patch to invert the data passed into ministat. It
is often easier to measure data in time (seconds) using /usr/bin/time
or another method, but often you like to think in per second, or
throughput which is the inverse.

Instead of having to massage the data, or know that below a certain
percentage you can just flip the sign, provide this, and you'll now
convert to x per second, giving you an easier comparision for talking.

Review: https://reviews.freebsd.org/D3084

Thanks.
--
John-Mark Gurney Voice: +1 415 225 5579

"All that I will do, has been done, All that I have, has not."
Poul-Henning Kamp
2015-07-15 06:49:24 UTC
Permalink
--------
Post by John-Mark Gurney
Instead of having to massage the data, or know that below a certain
percentage you can just flip the sign, provide this, and you'll now
convert to x per second, giving you an easier comparision for talking.
Why isn't this fundamentally against the UNIX and Software Tools Philosphy
and the first step on a long road to turn ministat into R ?
--
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
***@FreeBSD.ORG | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
John-Mark Gurney
2015-07-15 07:15:34 UTC
Permalink
Post by Poul-Henning Kamp
--------
Post by John-Mark Gurney
Instead of having to massage the data, or know that below a certain
percentage you can just flip the sign, provide this, and you'll now
convert to x per second, giving you an easier comparision for talking.
Why isn't this fundamentally against the UNIX and Software Tools Philosphy
and the first step on a long road to turn ministat into R ?
Didn't that get violated when options -C and -d were added in r161692?
--
John-Mark Gurney Voice: +1 415 225 5579

"All that I will do, has been done, All that I have, has not."
Poul-Henning Kamp
2015-07-15 08:06:30 UTC
Permalink
--------
Post by John-Mark Gurney
Post by Poul-Henning Kamp
--------
Post by John-Mark Gurney
Instead of having to massage the data, or know that below a certain
percentage you can just flip the sign, provide this, and you'll now
convert to x per second, giving you an easier comparision for talking.
Why isn't this fundamentally against the UNIX and Software Tools Philosphy
and the first step on a long road to turn ministat into R ?
Didn't that get violated when options -C and -d were added in r161692?
Those have pretty solid precedents in cut(1), sort(1) etc.

I protest primarily because I called it *mini*stat for a reason,
and secondarily because I think it is a slippery slope doing it
operator by operator the way this patch invites to, next thing you
know we will have -a(dd) -s(ubtract) -m(ultiply) and -d(ivide).

*Iff* we want to allow transformations of input values, we should be
general about it, and allow people to enter a full expression:

ministat -e '(x - 645134) / 1203.5 + 7.5'

But that means adding another full expression evaluator to the tree
because none of the many we already have offer a library interface,
and once you've implemented +,-,/,* people will ask for log(), exp()
and...

The shortcut to just hack it so ministat does a popen(awk) to do
the math, doesn't offer anything over running awk by hand in my
view.

There are of course ways we could do this "right":

If we had an official "little-language" in the base-system (Tcl,
Lua, Intercal - pick your poison) we could use that, but apart from
the religions fundamentalism, little languages always suffer from
latent chronic obesity.

A more feasible way might be to adopt plan9's pipe-trick, where
fopen(3) does popen(3) if the first char is '|':

ministat "|awk '{print 1/$1}' file1" "|awk '{print 1/$1}' file2"

(I never understood why that got shouted down in 199x, and I still
think it would be a damn nice feature to have...)

But for ministat specificall, I'd rather stop before we even get
started, point at the 'mini' and tell people to run awk(1) or learn
R if they need non-mini functionality.

PS: I also agree with Michael that claiming copyright for adding a
single division operation comes across as a bit expansionist.
--
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
***@FreeBSD.ORG | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
John-Mark Gurney
2015-07-15 17:41:39 UTC
Permalink
Post by Poul-Henning Kamp
--------
Post by John-Mark Gurney
Post by Poul-Henning Kamp
--------
Post by John-Mark Gurney
Instead of having to massage the data, or know that below a certain
percentage you can just flip the sign, provide this, and you'll now
convert to x per second, giving you an easier comparision for talking.
Why isn't this fundamentally against the UNIX and Software Tools Philosphy
and the first step on a long road to turn ministat into R ?
Didn't that get violated when options -C and -d were added in r161692?
Those have pretty solid precedents in cut(1), sort(1) etc.
There are lots of tools the repeat functionality... and it's only
getting worse... And the amount of code that this adds is strikingly
small...

Size before the change:
text data bss dec hex filename
17617 804 4448 22869 0x5955 /usr/bin/ministat

Size after the change:
text data bss dec hex filename
17953 804 4448 23205 0x5aa5 /usr/bin/ministat

So, we're talking 336 bytes larger... I am surprised it's that much
larger, though I guess I did add usage and a new error message..
Post by Poul-Henning Kamp
I protest primarily because I called it *mini*stat for a reason,
and secondarily because I think it is a slippery slope doing it
operator by operator the way this patch invites to, next thing you
know we will have -a(dd) -s(ubtract) -m(ultiply) and -d(ivide).
Which is partly why I only added this one function... It lets it
still be mini, but give you meaningful numbers w/o having to do
complicated math afterward (if the differences are large enough to
justify the math)..
Post by Poul-Henning Kamp
*Iff* we want to allow transformations of input values, we should be
ministat -e '(x - 645134) / 1203.5 + 7.5'
I see less value in this, though that's because I'm more interested
in differences of numbers, not the absolute numbers... As you said,
R...
Post by Poul-Henning Kamp
But that means adding another full expression evaluator to the tree
because none of the many we already have offer a library interface,
and once you've implemented +,-,/,* people will ask for log(), exp()
and...
Agreed...
Post by Poul-Henning Kamp
The shortcut to just hack it so ministat does a popen(awk) to do
the math, doesn't offer anything over running awk by hand in my
view.
IMO, it does have a benefit... It allows you to not use temporary
files... Though now that I think of it, I guess I could just use
awk before writing the files... Though I would loose data, or my awk
program would become more complicated...
Post by Poul-Henning Kamp
If we had an official "little-language" in the base-system (Tcl,
Lua, Intercal - pick your poison) we could use that, but apart from
the religions fundamentalism, little languages always suffer from
latent chronic obesity.
A more feasible way might be to adopt plan9's pipe-trick, where
ministat "|awk '{print 1/$1}' file1" "|awk '{print 1/$1}' file2"
(I never understood why that got shouted down in 199x, and I still
think it would be a damn nice feature to have...)
We already have this feature in awk..
Post by Poul-Henning Kamp
But for ministat specificall, I'd rather stop before we even get
started, point at the 'mini' and tell people to run awk(1) or learn
R if they need non-mini functionality.
I still think it is a good idea... It's small change, not intrusive..

I've now spent about 5x time discussing this than it took to write the
patch in the first place...
Post by Poul-Henning Kamp
PS: I also agree with Michael that claiming copyright for adding a
single division operation comes across as a bit expansionist.
As I explained to him, the Copyright is on the man page, not the
code...
--
John-Mark Gurney Voice: +1 415 225 5579

"All that I will do, has been done, All that I have, has not."
Poul-Henning Kamp
2015-07-15 20:30:53 UTC
Permalink
--------
Post by John-Mark Gurney
There are lots of tools the repeat functionality... and it's only
getting worse... And the amount of code that this adds is strikingly
small...
We do agree that is not a coherent argument, right ?

I still think it is a step in the wrong direction, and that it should
therefore not be taken.
--
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
***@FreeBSD.ORG | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
Warner Losh
2015-07-16 02:30:50 UTC
Permalink
Post by Poul-Henning Kamp
--------
Post by John-Mark Gurney
There are lots of tools the repeat functionality... and it's only
getting worse... And the amount of code that this adds is strikingly
small...
We do agree that is not a coherent argument, right ?
I still think it is a step in the wrong direction, and that it should
therefore not be taken.
I agree that this is a step best not taken. This is ministat, and why are
we optimizing for this one use-case, when there’s dozens of other that
I’ve wished for over the years. What’s next -l for log(x) and -e for exp(x)?

But if reason doesn’t prevail, can we at least name it right? The current name
isn’t quite appropriate. You’re transitioning from time domain to the frequency
domain, and just saying that it’s inverse.

Warner

Michael Gmelin
2015-07-15 06:59:24 UTC
Permalink
Post by John-Mark Gurney
I have created a patch to invert the data passed into ministat. It
is often easier to measure data in time (seconds) using /usr/bin/time
or another method, but often you like to think in per second, or
throughput which is the inverse.
Instead of having to massage the data, or know that below a certain
percentage you can just flip the sign, provide this, and you'll now
convert to x per second, giving you an easier comparision for talking.
Are you certain that such a minor patch requires adding "Copyright 2015 Netflix, Inc"?
Post by John-Mark Gurney
Review: https://reviews.freebsd.org/D3084
Thanks.
--
John-Mark Gurney Voice: +1 415 225 5579
"All that I will do, has been done, All that I have, has not."
_______________________________________________
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
Loading...