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 = ascFile.read(); 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 (6)

  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: https://bitbucket.org/tobylorenz/vector_asc/commits/a2ea482ffcb1131ba9e0ffed94c4a19c139b08e7 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 = ascFile.read();" and I got a good performance.

    Thank you very much.

    Regards, Venkatesan S

  5. Log in to comment