The paradigm shift of my engineering practice

No, I didn’t forget the story! Back in elementary school, I was demonstrated the power of mirror as a catalyst to accelerate the boiling process of water. Far more than that, mirror is used to shape the odds in day-to-day life. Never imagine that this can be the story of evolution. I have to see the odds and only then to shape it right.

It was the design choice of available resources to capture and to synthesize the stream of data from a remote device with the facility of Bluetooth Low Energy (BLE) as a connectivity protocol. Everything was working fine but poorly, from the standpoint of utilization of a usable thing. The poor design choice of using service, “Message Queue” to transfer data from interrupt service routine (ISR) in RTOS (Real-Time Operating System) environment while the frequency of incoming data stream is high. High frequency of incoming data stream cost the CPU to spend more time to read the data by waking the task that blocked upon that particular queue. Since this scenario has occurred in every piece of data received, CPU utilized all of its capacity (100%) at that particular instant of time.

CPU load (100%) to transfer data using "Message Queue" service from UART ISR

I found the odd, now it’s time to shape it right. I had to choose a “circular ring buffer” instead of “message queue” to store the incoming data stream inside the ISR and a RTOS task is then check for the availability of data in the ring buffer at a predefined interval of time. If there was desired number of bytes in the ring buffer, assigned task used to read the chunk of bytes to find the meaning and finally made an action if the meaning was valid. The difference? I don’t have a single word to describe. At first, I failed to obverse the difference. It was impossible for my naked eyes to zoom-in that high to see the utilization pile of this new approach. Utilization of this particular event has been reduced to 0.03 from previous 100 (using message queue). It’s worth mentioning that all other functionalities (actors as defined by Tracealyzer) of the application were remained same, I had to unmark the visibility option of all other actors to make 0.03 visible to my eyes.

CPU load (0.03%) to transfer data using "circular ring buffer" from UART ISR

There is much more to the picture than meet the eyes as oscilloscope, logic analyzer taught in the realm of hardware debugging. Never knew this day will come when I have the opportunity to portrait the picture of the architecture of embedded software application. Tracealyzer, the marvel-mirror from Percepio helps me to believe that the way I design an application isn’t always the best possible way. There is always a way to evolve only if I can see it. As the saying goes, data will be the new oil where ubiquitous devices will play the primary role as a source. And tools like Tracealyzer will boost engineers to do things right. The same rule goes to a team/community where we may have the opportunity to act as a mirror for the sake of humanity.

Leave a Reply

Your email address will not be published. Required fields are marked *