(please don't top-post on this list) On Sun, Aug 30, 2015 at 12:58 PM, Gabor Bernat <bernat@xxxxxxxxxxxxxx> wrote: > I would argue against the every n commit check, or at least making it > configurable, as in my case the speed is something between 0.01 and > 1.5 seconds per commit. Checking it every n commit would make it I > feel quite slow to adapt. But it's debatable. I'm wondering why these two decisions ("showing estimated time" and "frequency of the computation") should be put in the hands of the user in the first place. 1. Why have a --progress-eta option at all as opposed to just enabling it unconditionally if the platform can support it ("date +%s") and if it can be done without impacting the overall runtime noticeably? 2. Why make the user responsible for deciding how often to do the time check (via some configuration) as opposed to adjusting it dynamically based upon how quickly the operation is proceeding. That is, if the filter-branch operation is zipping along at 0.01 seconds per commit, then the time check can be done less frequently (say every 50 or 100 commits) so that it doesn't slow the overall operation. Conversely, if the operation is molasses, moving at 2 seconds per commit, then doing the time check more frequently (perhaps after each commit) probably won't noticeably impact the user's perception of the operation's progress. > On 8/30/15, Junio C Hamano <gitster@xxxxxxxxx> wrote: >> Eric Sunshine <sunshine@xxxxxxxxxxxxxx> writes: >> >>>>> Most portable likely would be Perl, however, that's probably too >>>>> heavyweight inside a loop like this, even if called only once each N >>>>> iterations. >> >> I think that is true. Now, when it is too heavy to spawn perl, >> would it be light enough to spawn awk, I have to wonder. Even if >> the implementation uses awk, I think the time measurement should be >> done only once each N iterations (e.g. every 1000 commits measure >> the rate and divide the remaining commits with that rate while >> displaying the progress; if you are chewing 100 commits per minute >> and have 2000 commits to go, you know it will take 20 more minutes). >> >>>> http://stackoverflow.com/questions/2445198/get-seconds-since-epoch-in-any-posix-compliant-shell >>>> Found this, >>>> >>>> awk 'BEGIN{srand();print srand()}' >>>> >>>> srand() in awk returns the previous seed value, and calling it without >>>> an argument sets it to time of day, so the above sequence should >>>> return seconds since the epoch, or at least something in seconds that >>>> is relative to a fixed point which is all that's needed in this >>>> thread. >> >> In practice this should work, but it makes me feel somewhat uneasy. >> >> POSIX says "Set the seed value for rand to expr or use the time of >> day if expr is omitted. The previous seed value shall be returned." >> but I do not see anything that says that "the time of day" is >> counted in seconds around there (which is the crucial bit for this >> application). >> >> http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html >> (4.15 Seconds since the Epoch) says "The relationship between the >> actual time of day and the current value for seconds since the Epoch >> is unspecified." -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html