7.2. Tutorials
7.2.1. Using the CSV storage utility plugin with Converter
If you have a recorded database in any of the binary CDR serialized formats, it is pretty difficult to analyze the recorded data without replaying it. While there is an option to convert the recorded database to JSON (see Section 5.2.21), you can also convert it to CSV format.
The Converter can convert an XCDR database to CSV format using a default
configuration called sqliteToCsv
.
7.2.1.1. Setup
We need to make sure rtistorageutils
can be loaded dynamically by
rticonverter
, set the library search path variable as follows:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH;<NDDSHOME>/lib/<architecture>
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH;<NDDSHOME>/lib/<architecture>
set PATH=%PATH%;<NDDSHOME>\lib\<architecture>
Note
<NDDSHOME>
is described in section Section 1.3.
7.2.1.2. Execution
To demonstrate the functionality we first need to record some data. Run Shapes Demo with the default configuration and publish some Triangles and Circles (using Shapes Demo is described in Section 3.6.1.2). Once Shapes Demo has started, run Recording Service as follows:
<NDDSHOME>/bin/rtirecordingservice
The default configuration should record data in a directory called cdr_recording
.
Now run Converter to perform the conversion of the previously generated
database into a single text file in CSV
format:
<NDDSHOME>/bin/rticonverter -cfgName sqliteToCsv
If you need to customize the behavior of this configuration, you can do so by adding user variables to the command, as shown:
<NDDSHOME>/bin/rticonverter -cfgName sqliteToCsv -DCSV_WORKSPACE_DIR=my_custom_dir
-DCSV_MERGE_FILES=false -DINPUT_DIR=my_cdr_recording_dir
Wait until conversion of the entire input database is performed and rticonverter
exits automatically. Upon successful conversion, you will find a folder in the current
directory with the name csv_output
. That folder will contain a file called
csv_converted.csv
containing topic data for the Triangles and Circles published
earlier by the Shapes Demo and recorded by rtirecordingservice
. This can be verified by
opening the file using an editor of your choice.