Add real world data to Linux trace without LTTng hacking

In my 10+ years of embedded Linux work I’ve worked with a lot of Linux trace technologies including the Linux Trace Toolkit (LTTng), System Tap, and even the not so well known and the unlikely to be mainline dtrace for Linux port. These are all very powerful tools that can expose many of the internal details of a Linux system and, depending how you use each tool, create huge volumes of data along the way. I’ve also worked with, so far, three different analysis tools that can take this data and create visualizations of the results.

I’m often asked how to integrate external data into these analysis tools. In this blog post I’ll show you how we do that with our own Sourcery Analyzer. One advantage of this technique is that data can be shown time synchronized with LTTng data without having to become an LTTng expert.

Embedded software developers often need to see how the external world impacts the operation of their software. The best way to see the impact of external events is to show them side-by-side with software execution. Sourcery Analyzer is very flexible in the types of data it can work with. All that is required is an event name, a timestamp, a source, and optionally one or more event payload entries that represent the data. For this example I’m working with data from the OBDII diagnostic port on my Honda Accord. Using an OBDII to USB interface I’ve captured diagnostic data from my car and I’ll show you how to import it to Sourcery Analyzer for analysis.

Preparing the data

To begin lets look at the data. I’m capturing the engine performance information using Movi which outputs performance data as a set of individual files:

Engine RPM.txt
Power.txt
Throttle position.txt
Torque.txt
Vehicle speed.txt

Each file has a brief header and then measurements are shown, one per line:

Movi Live Data
2013-01-23  21:02:02

Time(seconds)	rpm
21.405261	825
22.955986	829
24.486217	836
26.151863	837

In addion to LTTng data Sourcery Analyzer knows how to import  a simple text data (EFF, the Event File Format) in this form:

timestamp;event type identifier;event source identifier{;field}{;}
  • timestamp: a decimal integer representing nanoseconds
  • event type identifier: a string which gives the event a name
  • event source identifier: a string which can be useful when multiple event sources are combined in one file
  • field: zero or more fields which hold the actual data. The field format is simple key=value syntax

The file can also contain event declarations specifying event types and data types but for this simple example Sourcery Analyzer can automatically deduce event declarations. All that was required was a simple script to combine the multiple files into one file in the proper format:

20415192000;throttle;0;percent=16
20485718000;power;0;hp=0
20485718000;torque;0;lbft=0
21405261000;rpm;0;rpm=825
21707727000;speed;0;mph=0
22011435000;throttle;0;percent=15

Importing to Sourcery Analyzer

Adding the data to Sourcery Analyzer is easy. This 1 minute video will show you how:

Here’s the resulting graph showing RPM over time:

Graph of imported data showing RPM

In the next post I’ll introduce the waveform measurement tool which can give us some useful insight into this graph. If you’d like to try this out on your own then you’ll need:

If you import something interesting to Sourcery Analyzer please come back and leave a comment!

Post Author

Posted April 18th, 2013, by

Post Tags

, ,

Post Comments

2 Comments

About Embedded Blog

Open source experts discuss challenges and community happenings for embedded Linux, automotive, IVI, HMI and technology integration. Embedded Blog

Comments

2 comments on this post | ↓ Add Your Own

[...] Add real world data to Linux trace without LTTng hacking [...]

Commented on July 14, 2013 at 5:30 am
By mikiliniz wapo

thanks for this

Add Your Comment

Archives