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 |
getResults()
Get all results for all group, event, thread combinations
Direction | Data type(s) |
Input Parameter | None |
Returns | Three-dimensional list with results. First dim. is groups, second dim. is events and third dim. are the threads |
getLastResults()
Get the results of the last measurement cycle for all group, event, thread combinations
Direction | Data type(s) |
Input Parameter | None |
Returns | Three-dimensional list with results. First dim. is groups, second dim. is events and third dim. are the threads |
getMetrics()
Get all derived metric results for all group, metric, thread combinations
Direction | Data type(s) |
Input Parameter | None |
Returns | Three-dimensional list with derived metric results. First dim. is groups, second dim. is metrics and third dim. are the threads |
getLastMetrics()
Get the derived metric results of the last measurement cycle for all group, metric, thread combinations
Direction | Data type(s) |
Input Parameter | None |
Returns | Three-dimensional list with derived metric results. First dim. is groups, second dim. is metrics and third dim. are the threads |
printOutput(results, metrics, cpulist, region, stats)
Prints results
Direction | Data type(s) |
Input Parameter |
results | List of results with format list[ngroups][nevents][nthreads] |
metrics | List of metric results with format list[ngroups][nmetrics][nthreads] |
cpulist | List of thread ID to CPU ID relations |
region | Name of region or 'nil' for no region |
stats | Print statistics table for one CPU |
|
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 |
*/