Data type definition for Lua output functions module in the Lua API
Function definitions for Lua output functions module in the Lua API
getopt(commandline, optionlist)
Read commandline parameters and split them to the given options. The version LIKWID uses was originally taken from the web but extended to talk short '-o' and long options "--option". It returns an iterator for the commandline options.
Basic usage:
for opt,arg in likwid.getopt(arg, {"n:","h"}) do
if (type(arg) == "string") then
local s,e = arg:find("-")
if s == 1 then
print(string.format("ERROR: Argmument %s to option -%s starts with invalid character -.", arg, opt))
print("ERROR: Did you forget an argument to an option?")
os.exit(1)
end
end
–parse options
end
The option 'n' takes an argument, specified by the ':'. If found the option argument for option 'h' is true. The type check for the argument is recommended to get errors with an argument awaiting option where the argument is missing.
| Direction | Data type(s) |
| Input Parameter |
| commandline | Normally, Lua saves the commandline parameters in variable 'arg' |
| optionlist | List of options that should be recognized. Options with ':' as last character need an argument
Example {"h","v","cpu:"} |
|
| Returns |
| option | Option string found on the commandline without leading '-' |
| argument | Argument to the option. If option does not require an argument, true or false is returned in argument |
|
parse_time(timestr)
Parses time interval describing strings like 2s, 100ms or 250us
| Direction | Data type(s) |
| Input Parameter |
| timestr | String describing a time interval |
|
| Returns |
| duration | Time string timestr resolved to usecs |
|
printtable(table)
Prints the given two dimensional table as fancy ASCII table. For CSV output use printcsv
| Direction | Data type(s) |
| Input Parameter |
| table | Two dimensional list with table entries. First dim. are columns and second dim. the lines |
|
| Returns | None |
printcsv(table)
Prints the given two dimensional table in CSV format. For ASCII table output see printtable
| Direction | Data type(s) |
| Input Parameter |
| table | Two dimensional list with table entries. First dim. are columns and second dim. the lines |
|
| Returns | None |
stringsplit(str, sSeparator,( nMax, bRegexp))
Splits the given string at separating character
| Direction | Data type(s) |
| Input Parameter |
| str | String to split |
| sSeparator | String with separating character |
| nMax | Split string maximally nMax times (optional) |
| bRegexp | Lua RegEx string for separation (optional) |
|
| Returns | List of str splitted at sSeparator or bRegexp |
printOutput(groups, results, groupData, cpulist)
Prints results
| Direction | Data type(s) |
| Input Parameter |
| groups | List of groups for printing |
| results | List of results as returned by getResults function |
| groupData | List of group data structures |
| cpulist | List of thread ID to CPU ID relations |
|
| Returns | None |
print_markerOutput(groups, results, groupData, cpulist)
Prints results of a Marker API run. This is different to printOutput because we have to resolve the measurement regions
| Direction | Data type(s) |
| Input Parameter |
| groups | List of groups for printing |
| results | List of results as returned by getMarkerResults function |
| groupData | List of group data structures |
| cpulist | List of thread ID to CPU ID relations |
|
| Returns | None |
addSimpleAsciiBox(container, lineIdx, colIdx, label)
Add a simple ASCII box with given label to box container. This function is only used by likwid-topology
| Direction | Data type(s) |
| Input Parameter |
| container | Box container containing all boxes |
| lineIdx | Add box at line index lineIdx |
| colIdx | Add box at column index colIdx |
| label | Content of the box |
|
| Returns | None |
addJoinedAsciiBox(container, lineIdx, startColIdx, endColIdx, label)
Add a joined ASCII box with given label to box container. Joined boxes can span the space of multiple simple boxes. This function is only used by likwid-topology
| Direction | Data type(s) |
| Input Parameter |
| container | Box container containing all boxes |
| lineIdx | Add box at line index lineIdx |
| startColIdx | Start joined box at column index startColIdx |
| endColIdx | End joined box at column index endColIdx |
| label | Content of the box |
|
| Returns | None |
printAsciiBox(container)
Print the box container previously filled with addSimpleAsciiBox and addJoinedAsciiBox. This function is only used by likwid-topology
| Direction | Data type(s) |
| Input Parameter |
| container | Box container containing all boxes |
|
| Returns | None |
*/