Fwd: loadtools with high baudrate give only marginal performance improvement

Serg l serg at tvman.us
Wed Jul 3 15:02:58 UTC 2019


I was running loadtools on Ubuntu with FTDI USB to UART interface and
noticed that increasing baudrate was giving just marginal load speed
improvement. Quick analysis revealed that select() in the S-record echo was
signaled by the kernel with 10ms delay. I tried multiple baudrates and
confirmed that that was pretty much constant.

 xram-800k.PNG
<https://drive.google.com/a/tvman.us/file/d/0B-LGWaryBRksQzRuaXJqM0o4RXlNQzFRQUFtQTZ6S3NYbEY4/view?usp=drive_web>

 xram-400k.PNG
<https://drive.google.com/a/tvman.us/file/d/0B-LGWaryBRkscWJ5eTc2ZGpnLThvSldTRXJlek9FMUdRZnZj/view?usp=drive_web>

 xram-19200.PNG
<https://drive.google.com/a/tvman.us/file/d/0B-LGWaryBRksN1puYWFLQUJvUXIxRlEtZlRUSld3SXdNcVVj/view?usp=drive_web>

 xram-115200.PNG
<https://drive.google.com/a/tvman.us/file/d/0B-LGWaryBRksN0NyVVFJcE1fMnltQnhLVnJNcVlkM0Q3aDh3/view?usp=drive_web>

 xram-38400.PNG
<https://drive.google.com/a/tvman.us/file/d/0B-LGWaryBRksS3h4bUEySmJselY0UDhlLUJkQThzejZ2VVZV/view?usp=drive_web>

Since we use Linux specific libserial now, I added one more kernel tweak,
which may be not reproducible on other platforms. Maybe there is a better
place where we can set this flag, so here is a proof of concept.

 openport.c

/*
 * This module implements the basic serial port opening operation.
 */

#include <sys/types.h>
#include <sys/file.h>
#include <sys/ioctl.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <linux/serial.h>

int target_fd;

open_serial_port(ttyport)
        char *ttyport;
{
        target_fd = open(ttyport, O_RDWR|O_NONBLOCK);
        if (target_fd < 0) {
                perror(ttyport);
                exit(1);
        }
        ioctl(target_fd, TIOCEXCL);
        //Try Low latency settings
        struct serial_struct kernel_serial_settings;
        ioctl(target_fd, TIOCGSERIAL, &kernel_serial_settings);
        kernel_serial_settings.flags |= ASYNC_LOW_LATENCY;
        ioctl(target_fd, TIOCSSERIAL, &kernel_serial_settings);

        return 0;
}

This makes an image load lighting fast compared to what I was getting
before. So far no major problems observed.

 image.png
<https://drive.google.com/a/tvman.us/file/d/0B-LGWaryBRkseWpFSm81bmF6enFQaDlRRjN5ZGhhb1RUWnBj/view?usp=drive_web>

I hope it helps to somebody else


More information about the Community mailing list