How to reduce CAN message reading time?

Create issue
Issue #4 open
Venkatesan SoundiraRajan created an issue

Thank you for your continuous support.

I have wrote my own static code for decode asc with help of dbc file.
Now the issue, Execution of my application is not in real time, due to packet reading time. ASC::Event * event =; it's taking 2 to 6 msec with my PC.

Can you give me some idea to reduce into microseconds.

Thanks in advance.

Regards, Venkatesan S

Comments (8)

  1. Tobias Lorenz repo owner

    Hi Venkat,

    I see three options to improve the read times. Both are significant changes.

    1. Let the library run in an own thread and read all messages in a queue. This can be done in your program, but only helps, if your program has something else to do in parallel and is not waiting for Vector::ASC.
    2. Introduce bison grammar parser. Currently flex is used to detect the message type and then a regex is actually parsing its content. Bison works flawless together with flex, so that the message is already read, when the message type was detected.
    3. The library itself can run multi-threaded and parse multiple lines in parallel. This would require a message queue with std::future to distribute the work and std::promise to parse the lines.

    I've already started working on 2, but it takes what it takes ;-)

    Bye Tobias

  2. Venkatesan SoundiraRajan reporter

    Hello Tobias,

    Thanks for you suggestion & support.

    I have done your 1st option with help of Qt Creator and I could't achieve good performance due to delay of reading log file.

    I have tried your 3rd option also and I have getting RUN time error, due to flexlexer library(I don't have enough knowledge on flexlexer programming).

    So I am believing your 2nd option would be best.

    Is that possible to get updated Vector_ASC? I can follow the 2nd option, If you can guide me.

    Thanks once again for continuous support.

    Regards, Venkatesan S

  3. Tobias Lorenz repo owner

    Hi Venkat, I had the grammar once in the repository, but deleted it before releasing the first version. The bison grammar is still available in the history: That's the base to start with. With Bison, the first step is always to describe a grammar that parses the file. The second step is to store the data during parsing. I improved with integrating flex+bison+c++ a lot in the other libraries, especially Vector::DBC. So this shows best how to integrate it. Bye Tobias

  4. Venkatesan SoundiraRajan reporter

    Hello Tobias,

    Thanks for you suggestion & support.

    Actually I have tried your suggestion & had difficult to implement the same. As per my current requirement is with CANMessage class only. So, I just used "CanMessage * CanMessage::read(File & file, std::string & line)" directly with out "ASC::Event * event =;" and I got a good performance.

    Thank you very much.

    Regards, Venkatesan S

  5. Amol Vagad

    Hi @Tobias Lorenz , how can I run the binaries for associating DBC file with an ASCII file? I build the package and also did make install. I do not see a bin folder created. SO I am not sure how can I run this package against a file. Thanks

  6. Tobias Lorenz repo owner

    Hi Amol, Vector_ASC and Vector_DBC create its own installation artifacts. If you’ve build the software and run a make install, there will also be parsers that are installed in /usr/bin or /usr/local/bin. Both projects don’t depend on each other. If you want to use a DBC file to get more information out of an ASC file, you currently have to write this on your own. I’ll do it probably in the future, but currently my focus is more on Vector_BLF.

  7. Log in to comment