Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: df643173556a46ff8f92548cd207ed6d03fa15cbb501793430a57d7b99f274ce
Ticket: 48a7a56dda84478202d547f61746d8d646aa7d8d
Documentation of timerate -overhead needs some detail
User & Date: apnadkarni on 2025-01-21 16:01:16
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/x-markdown"
  4. comment changed to:
    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)
    ```
    
  5. foundin changed to: "9.0.1"
  6. is_private changed to: "0"
  7. login: "apnadkarni"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "9546e9877f1a8899e25a89082561ee694e7fb402"
  10. resolution changed to: "None"
  11. severity changed to: "Minor"
  12. status changed to: "Open"
  13. submitter changed to: "apnadkarni"
  14. subsystem changed to: "- New Builtin Commands"
  15. title changed to:
    Documentation of timerate -overhead needs some detail
    
  16. type changed to: "RFE"