Skip to content

Commit

Permalink
bench: Manpage for tll-bench-channel
Browse files Browse the repository at this point in the history
  • Loading branch information
shramov committed Nov 30, 2023
1 parent e805532 commit 0ae1cf4
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bench/channel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ int main(int argc, char *argv[])
std::swap(msg, *r);
}
} else
return fail(1, "Invalid preload url in config: {}", url.error());
return fail(1, "Invalid payload url in config: {}", url.error());

for (auto &[p, _] : cfg->browse("channel.*", true)) {
auto r = cfg->getT<tll::Channel::Url>(p);
Expand Down
86 changes: 86 additions & 0 deletions bench/channel.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
tll-channel-bench
=================

:Manual Section: 3
:Manual Group: TLL
:Subtitle: Run basic benchmarks for list of TLL channels

Synopsis
--------

``tll-channel-bench [--config CONFIG] [-m module] [--count COUNT] [--msgid ID] [--msgsize SIZE] URLS...``


Description
-----------

Measure time needed to post a message and (optionaly) processing time on a list of
channels. Default message has zeroed body but user can provide it's own with ``--payload`` option.

Options
-------

``URLS...`` list of channel urls to benchmark. If nothing is specified - measure TLL overhead for
post/callback functions using set of pirmitive channels:

- ``null://`` measure post overhead with one function pointer call;
- ``prefix+null://`` prefix overhead with two function pointer calls;
- ``echo://`` posted message is echoed back, same as ``null://`` but with callback call;
- ``prefix+echo://`` measure both paths of prefix channel, both posts and callbacks;

``-m | --module MODULE`` load additional channel module, can be specified multiple times.

``-C | --count COUNT`` run ``COUNT`` number of iterations, by default 10000000.

``--process`` benchmark ``tll::Channel::process`` function.

``--callback`` run tests with data callback added to channels.

``--msgid ID`` use ``ID`` for messages that are posted in benchmark.

``--msgsize SIZE`` size of message used in benchmark, defaults to 1024. Ignored if message body is loaded using
``--payload`` option.

``--payload URL`` read first message from channel ``URL`` and use it for benchmark. ``--msgid``
option can be used to override message id got from this channel.

``--config CONFIG``: read options from YAML config file, command line has precedence over config
parameters. Supported variables are following:

- ``msgid``: message id, see ``--msgid`` option.
- ``msgsize``: message size, see ``--msgsize`` option.
- ``module``: list of modules to load in format similar to processor config: ``module: [{module: tll-http}, {module: tll-lua}]``
- ``channel``: channels to measure, concatenated with command line list. Configuration format of
each channel is same as in processor:

* scalar url string value: ``null://;stat=yes``
* broken down parameters url: ``{tll.proto: null, stat: yes}``
* mixed variant: ``{url: null://, stat: yes}``

- ``payload``: channel that provides message body for benchmark (see ``--payload`` option), for
configuration format see ``channel`` key.

Examples
--------

Measure relative overhead of statistic gathering

::

tll-bench-channel 'null://' 'null://;stat=yes'

Read message body from yaml file and benchmark some lua code two times (to demonstrate syntax),
configuration file that should be used with ``--config`` option:


::

module:
- { module: tll-lua }
payload: yaml://payload.yaml;scheme=yaml://scheme.yaml
channel:
- lua+null://;lua.code=file://code.lua;scheme=yaml://scheme.yaml
- { url: lua+null://, lua.code: file://code.lua, scheme=yaml://scheme.yaml}

..
vim: sts=4 sw=4 et tw=100
9 changes: 9 additions & 0 deletions bench/meson.build
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
executable('bench-time', sources: ['time.cc'], dependencies: [fmt, tll])
executable('tll-bench-channel', sources: ['channel.cc'], dependencies: [fmt, tll], install: true)
executable('bench-binder', sources: ['binder.cc'], dependencies: [fmt], include_directories: include)


custom_target('tll-bench-channel.3'
, output : 'tll-bench-channel.3'
, input : 'channel.rst'
, command : [rst2man, '@INPUT@', '@OUTPUT@']
, install_dir: get_option('mandir') / 'man3'
, install: true
)
1 change: 1 addition & 0 deletions debian/libtll-bin.install
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
/usr/bin/tll-bench-channel
/usr/lib/*/libtll-logic*.so
/usr/share/tll/scheme/tll/logic
/usr/share/man/*/tll-bench-channel.*
2 changes: 2 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ threads = dependency('threads')

include = include_directories('src')

rst2man = find_program('rst2man', disabler: true, required: false)

subdir('src')
subdir('python')

Expand Down

0 comments on commit 0ae1cf4

Please sign in to comment.