diff --git a/docs/source/management_options.rst b/docs/source/management_options.rst index fa00ff728ec15cb1153db8aa459b0d0cd7d5a65e..7ded873db3311831cf36d4dc7ebe5353d2370f6b 100644 --- a/docs/source/management_options.rst +++ b/docs/source/management_options.rst @@ -121,3 +121,69 @@ Usage example: spb::Some_other::op(item); spb::Sink::op(item); } // End of stream region + +Management Options for Multi-source Benchmarks +---------------------------------------------- + +In multi-source benchmarks, each source offers to users some methods to control its behavior individually. + + - ``source.setBatchSize(items_per_batch)`` + + This method can be used to change the batch size of the items on the stream. + + - ``source.setBatchInterval(batch_interval_in_sec)`` + + This method can be used to change the batch time interval of the stream. + + - ``source.setFrequency(items_per_second)`` + + If the in-memory option was not enable in the execution command, the maximum frequency will be limited by the speed of the disk. + Ideally, this option may be used in an in-memory execution to achieve high speed data. + + - ``source.setQueueMaxSize(queue_size);`` + + This option changes the queue size for te respective source. It has no impact on the inter-stage queues of the parallel implementations. + + - ``source.init()`` + + It is necessary to run this method once before the stream region to start the source execution. + + Alternativelly, these attributes can be specified through the constructor of the source object: + + - ``spb::Source source(, , , );`` + + When using this second method, ``source.init()`` is not required. + +Code example: + +.. code-block:: C++ + ... + // Compact source creation method. This source will run immediately. + // Parameters: , , , + spb::Source source1(2, 0, 1, 0); + + // Alternative source creation method + spb::Source source2; + + // These parameters can be changed anytime during execution + source2.setBatchSize(1); // 1 item per batch + source2.setBatchInterval(0.5); // 500 ms batch window + source2.setQueueMaxSize(3); // 3 slots in this source's queue + source2.setFrequency(30); // 30 items per second + + // You must use the init() method to run the source2 + // because it dos not run immediately on creation + source2.init(); + + /* Stream region */ + while(!(source1.depleted() && source2.depleted())){ + ... + if(/*my condition*/){ + // all parameters can be changed anytime + source1.setQueueMaxSize(4); + source2.setFrequency(50); + } + ... + } + ... +