Silly Question About Timing
- From
- Hilco Wijbenga <hilco.wijbenga@gmail.com>
- Date
- Feb 9, 2012, 21:10 UTC
- Message-ID
- <CAE1pOi1+FQNoPZ_P-fmFx-YhnUYzMQT=6zh3s-OyT71vcDm=wQ@mail.gmail.com>
Hi all,
This is a bit silly but I'm trying to time how long it takes to enter a Git controlled directory. I guess this is more of a GNU/Linux question then anything else.
I've noticed that entering a Git controlled project directory takes quite some time so I wanted to measure exactly how much (it's the prompt I'm using that's taking the time, I suspect). I first tried (a bit naive, I admit :-) )
time cd my-project
This doesn't work of course. Obviously, writing a script doesn't work either because then the prompt isn't calculated. Next I tried
date +%H:%M:%S.%N ; cd my-project-abc ; date +%H:%M:%S.%N
but, surprisingly (to me), that doesn't work either. It simply prints the two timestamps and *then* does the cd (or, at least, that's how it seems to behave).
So how would one do this? :-)
Cheers, Hilco
P.S. This slow cd is only the first time, afterwards things have been cached.