Reminder to self to add to docs based on following explanation from Sergey.
[21:02] apn Let me typ ean example
[21:03] apn % timerate -calibrate {}
0.03468333977558236 µs/#-overhead 0.034767 µs/# 56144881 # 28762746 #/sec
% timerate {incr x}
0.086050 µs/# 8282712 # 11621140 #/sec 712.728 net-ms
% timerate {}
0.003148 µs/# 26433088 # 317655750 #/sec 83.213 net-ms
% timerate -overhead 0.003148 {incr x}
0.108830 µs/# 8930339 # 9188650 #/sec 971.888 net-ms
[21:04] apn I would have expected the measurement of incr x in the two cases to be much closer
[21:05] apn (Similar proportionate differences for more expensive operations)
++++++++++++++++++++++ End Of History ++++++++++++++++++++++
[21:08] sebres › apn, you used calibrated call to estimate overhead... this is not quite correct, let me explain with an example:
[21:08] sebres › % proc test {} { set ovh [lindex [timerate {incr i}] 0]; timerate -overhead $ovh { incr i } }; test
[21:08] sebres › 0.000000 µs/# 10536827 # 10536827000000 #/sec 0.001 net-ms
[21:08] sebres › % timerate -calibrate {}
[21:08] sebres › 0.03138602152473443 µs/#-overhead 0.031464 µs/# 62038772 # 31782157 #/sec
[21:08] sebres › % proc test {} { set ovh [lindex [timerate {incr i}] 0]; timerate -overhead $ovh { incr i } }; test
[21:08] sebres › 0.030830 µs/# 10408764 # 32435958 #/sec 320.902 net-ms
[21:08] sebres › % proc test {} { set ovh [lindex [timerate -overhead 0 {incr i}] 0]; timerate -overhead $ovh { incr i } }; test
[21:08] sebres › 0.000000 µs/# 10427036 # 10427036000000 #/sec 0.001 net-ms
[21:09] bwani54 macht wie eine Banane...
[21:09] sebres › ... if you used calibrate - use -overhead 0 for timerate call estimating the overhead
[21:10] henriquegogo wandelt luid schreeuwend binnen.
[21:12] sebres › however I'm not against to fix it - e. g. to sum the overhead with a calibration value stored internally, so this `-overhead 0` becomes redundant
[21:13] apn Back, let me go through that ...
[21:18] apn So currently, the -calibrate invocation only affects the next measurement?
[21:19] sebres › no, it affects the calls without overhead (it uses internal overhead)
[21:19] apn Gotcha
[21:19] sebres › well, the "fix" would not become superfluous, it'd be a bit incompatible if used previously, so if we'd fix it, one need to mention it somewhere in the docu
[21:19] apn So it's kind of the overhead used if -overhead is not specified.
[21:21] sebres › exactly, if no -overhead, use calibrated overhead, otherwise values given with -overhead
[21:21] apn I think the current behavior is ok but I did not understand that from the manpage. I'll go read it again to see if I missed something.
[21:21] sebres › ... the fix may be a sum of both
[21:21] apn And to measure the overhead, one should also pass -overhead 0 to the command
[21:21] apn right?
[21:22] sebres › currently yes (to be sure, the -calibrate overhead is not evolved)