-
Notifications
You must be signed in to change notification settings - Fork 15
bfbin2csv
bfbin2csv - convert Byfl output to a comma-separated value file
bfbin2csv [--output=filename.csv] [--colsep=string] [--include=table_name] [--exclude=table_name] [--no-table-names] [--no-column-names] [--no-data] [--flat-output] [--live-data] filename.byfl
bfbin2csv --help
By default, applications instrumented with Byfl write measurement data
to a binary .byfl
file. bfbin2csv converts such files to
comma-separated value (.csv
) text files. These can be processed
programmatically using tools such as AWK and Perl or loaded into a
spreadsheet program such as LibreOffice Calc or Microsoft Excel.
bfbin2csv accepts the following command-line options:
-
-h, --help
Output a brief usage message.
-
-o filename.csv, --output=filename.csv
Specify the name of the output file. By default, output is written to the standard output device.
-
-c string, --colsep=string
Replace the comma as the column separator with string.
-
-i table_name, --include=table_name
Include only the table called table_name in the output, ignoring all others. This option can be specified repeatedly to list multiple tables to include.
-
-e table_name, --exclude=table_name
Exclude the table called table_name in the output while including all others. This option can be specified repeatedly to list multiple tables to exclude.
-
-T, --no-table-names
Suppress the output of the table name before the table contents.
-
-C, --no-column-names
Suppress the output of the column names in each table.
-
-D, --no-data
Suppress the output of each table's data.
-
-f, --flat-output
Output one value per line for ease of parsing. Each line is of the form "table_name,row_number,column_name,value", where the first three of those columns together uniquely identify a single measurement.
-
-l, --live-data
Indicate that the input file is being generated concurrently with bfbin2csv's execution. When --live-data is specified, a premature end of file causes bfbin2csv to wait for more data to arrive instead of immediately producing an error message and aborting.
In addition, the name of a binary .byfl
input file must be provided
on the command line.
The simplest usage is just
$ bfbin2csv myprog.byfl -o myprog.csv
which produces myprog.csv
.
bfbin2csv can be used to list all of the tables in a .byfl
file:
$ bfbin2csv --no-column-names --no-data myprog.byfl
"Basic blocks"
"Functions"
"Called functions"
"Vector operations"
"Program"
"Memory accesses by data type"
"Instruction mix"
"Memory locality"
"Environment variables"
"Command line"
"Byfl options"
Combining bfbin2csv and awk makes it easy to perform simple operations on the data:
$ bfbin2csv --include="Basic blocks" --no-table-name --no-data myprog.byfl
"Tag","Address","Symbolic location","Load operations","Store operations","Floating-point operations","Integer operations","Unconditional and direct branch operations","Conditional or indirect branch operations","Other branch operations","Floating-point operation bits","Integer operation bits","Bytes loaded","Bytes stored","Calls to memset","Bytes stored by memset","Calls to memcpy and memmove","Bytes loaded and stored by memcpy and memmove"
$ bfbin2csv --include="Basic blocks" --no-table-name --no-data myprog.byfl | awk -F, '{print $13, $14, $6}'
"Bytes loaded" "Bytes stored" "Floating-point operations"
$ bfbin2csv --include="Basic blocks" --no-table-name --no-column-names myprog.byfl | awk -F, '$6>0 {print ($13+$14)/$6}' | sort -u
0.8
4
8
24
If the .byfl
file is expected to be used only to produce the CSV
file and then deleted, one can save time and disk space by writing
Byfl binary output to a named pipe and running bfbin2csv on that
named pipe:
$ mkfifo myprog.pipe
$ bfbin2csv myprog.pipe -o myprog.csv &
$ env BF_BINOUT=myprog.pipe ./myprog
$ rm myprog.pipe
The --no-table-names, --no-column-names, and --no-data options are ignored when --flat-output is specified.
Scott Pakin, [email protected]
awk(1), perl(1), bfbin2cgrind(1), bfbin2hdf5(1), bfbin2hpctk(1), bfbin2sqlite3(1), bfbin2xmlss(1), bf-clang(1), bf-clang++(1), bf-flang(1), the Byfl home page