Skip to content
This repository has been archived by the owner on Jul 20, 2020. It is now read-only.

Document large second inaccuracy #3

Open
ysangkok opened this issue Mar 17, 2017 · 1 comment
Open

Document large second inaccuracy #3

ysangkok opened this issue Mar 17, 2017 · 1 comment

Comments

@ysangkok
Copy link

I think this could be related to the startup taking about 0.2 seconds on my machine, but it would be nice to have it documented, as this is often seen as an alternative to time(1).

$ (sleep 0.2; echo line) | gnomon   
   0.0227s   line
   0.0014s   
             
     Total   0.0253s
$ (sleep 0.2; echo line) | time cat
line
cat  0.00s user 0.00s system 0% cpu 0.202 total

Why is the duration next to "line" and in total so low? I am using version 1.5.0.

@zetlen
Copy link
Contributor

zetlen commented Mar 21, 2017

Hey @ysangkok, I'm not a PayPal employee anymore, but I am noticing something unusual about this. There seems to be a "sweet spot" above which the measurement gets an order of magnitude more accurate.

00:24 zetlen@sam $ (sleep .1; echo done) | gnomon
   0.0073s   done
   0.0009s

     Total   0.0087s
✔ ~
00:25 zetlen@sam $ (sleep .8; echo done) | gnomon
   0.6482s   done
   0.0011s

     Total   0.6501s
✔ ~
00:25 zetlen@sam $ (sleep .4; echo done) | gnomon
   0.2481s   done
   0.0008s

     Total   0.2496s
✔ ~
00:25 zetlen@sam $ (sleep .6; echo done) | gnomon
   0.3711s   done
   0.0013s

     Total   0.3733s
✔ ~

I must confess that I didn't write this tool with much knowledge of how processes are managed by different OSes. When piping foo | bar, does the OS wait until foo produces stdout before invoking bar? I'm not sure.

This program was meant to troubleshoot software build processes that have steps which take many seconds, so I never meant to use it at the level of precision you're looking for. I think the variable nature of v8 startup time might make Node a bad fit for measurement numbers at that level. Maybe try moreutils and ts for that!

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants