diff options
Diffstat (limited to 'slowbaud.1')
-rw-r--r-- | slowbaud.1 | 36 |
1 files changed, 1 insertions, 35 deletions
@@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH SLOWBAUD 1 "2021-07-23" "0.0.1" "Urchlay's Useless Stuff" +.TH SLOWBAUD 1 "2021-07-24" "0.0.1" "Urchlay's Useless Stuff" .SH NAME slowbaud \- simulate a low bitrate serial connection . @@ -131,40 +131,6 @@ I/O is done with byte granularity. For calculation purposes, \fI<bits\-per\-sec>\fP is divided by 10 to get bytes per second. This simulates "8\-N\-1": one start bit, 8 data bits, no parity, and 1 stop bit (total of 10 bits per byte). -.sp -The timing code works by calculating how long to sleep after each -character (in microseconds), but actually sleeping slightly less -than that, then busy\-waiting until the rest of the interval expires. -At slower bitrates, this works well, and the CPU overhead is barely -noticeable (at least on reasonably fast modern systems). -.sp -Timing accuracy depends on your OS, kernel config (HZ and/or NO_HZ -on Linux), and system load. Also on the amount of data, since the -timing loop is self\-regulating (the first few bytes will have less -accurate timing than later ones). No "fancy" techniques like realtime -scheduling or hardware event timers are used. At bitrates up to -115200, on an unloaded Linux system, the timing should be at least -99.9% accurate. At higher bitrates, accuracy will decrease. -.sp -Timing is more accurate on Linux than OSX. It\(aqs done with getitimer() -and sigwait(). This works out to be slightly more accurate than -using usleep() on both Linux and OSX. It would be possible to use -the realtime timer_create() and clock_gettime() API on Linux, for -possibly even better accuracy, but OSX doesn\(aqt have these (and I want to be -portable). On an unloaded OSX system, the accuracy gets steadily worse -as you go above 57600bps. There\(aqs also more CPU overhead on OSX. -.sp -If this were a truly useful application, it would be worth trying to -increase accuracy further, with realtime process scheduling. I didn\(aqt -do this because slowbaud is just a toy, and because the RT stuff tends -to be unportable and require elevated privileges (root, or something -like setrtlimit or extended filesystem attributes to manage capabilities). -.sp -About the name... I\(aqm aware that "baud" is not synonymous with bps. I -just think "slowbaud" sounds better than "slowbps", as a name. Anyway -the stty command on both Linux and OSX misuses the term ("speed -38400 baud"), as well as the man page for termios(3), so I\(aqm in good -company. .SH BUGS .sp With \fB\-c\fP, signals aren\(aqt handled gracefully. Window size changes |