|
2025-01-28
| ||
| 10:47 | • Closed ticket [48a7a56dda]: Documentation of timerate -overhead needs some detai... artifact: 21158ec466 user: sebres | |
| 10:41 | merge 8.7: man timerate fix [48a7a56dda844782] clarifying -overhead check-in: 48b86a8487 user: sebres tags: trunk, main | |
| 10:41 | merge 8.6: man timerate fix [48a7a56dda844782] clarifying -overhead check-in: fe7f181baf user: sebres tags: core-8-branch | |
| 08:24 | • Ticket [48a7a56dda] Documentation of timerate -overhead needs some detail st... artifact: d43c924501 user: apnadkarni | |
|
2025-01-21
| ||
| 16:39 | • Ticket [48a7a56dda]: 3 changes artifact: 62f5fe4717 user: sebres | |
| 16:13 | may fix [48a7a56dda] in the form that -overhead 0 is not expected anymore to estimate the overhead i... closed check-in: 98b8512f2f user: sebres tags: fix-48a7a56dda-timerate-overhead-with-calibrate | |
| 16:01 | • New ticket [48a7a56dda] Documentation of timerate -overhead needs some detail</i... artifact: df64317355 user: apnadkarni | |
Documentation of timerate -overhead needs some detail
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)
98b8512f2fmay fix [48a7a56dda] in the form that -overhead 0 is not expected anymore to estimate the overhead in calibrated timerate check-in2025-01-21 16:13:45
Alternatively, [98b8512f2f85cb49] may fix this on the code side (not the documentation side) in the form that -overhead 0 becomes superfluous or rather will be unexpected anymore to estimate the overhead (in calibrated timerate). The whole overhead considered by timerate call is then a sum of both, the given with -overhead value and the internal value estimated by calibration. With other words, the -overhead 0 must no longer be used in that case to measure the overhead with previously calibrated timerate.
Pros:
* don't need to know whether it was calibrated or not, -overhead 0 becomes redundant;
* calibration of empty evaluation (cost of invocation) wouldn't reflect in estimated overhead, it becomes hidden now.
Cons:
* a bit backwards incompatible; * possibly unwanted behaviour under some circumstances - it'd indirectly depend on the calibration, which did before overhead measurement, if it changes later, the overhead may be wrong (but such "circumstances" are rather artificial thing, imho; * the estimated overhead doesn't reflect the calibration overhead anymore - it is hidden now for any case.
@sebres, having thought about it, I think updating the example in the manpage is preferable to changing the behavior of timerate in an incompatible fashion, no matter how minor.
If you agree, please review the suggested manpage change.
Looks good, thx!
Commit merged everywhere, closing ticket.