From 4ccf632ad4418114df0cd8460c7dd3a86c246f9d Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Sun, 22 Apr 2018 22:20:18 +0200 Subject: feat(#12): Buffer instrumentation measurements This change will make the simulator by default buffer all measurements of attached instruments to prevent strange situations where certain measurements are not recorded due to the processing running on another thread. --- .../kotlin/com/atlarge/opendc/simulator/instrumentation/Port.kt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'opendc-core/src/main') diff --git a/opendc-core/src/main/kotlin/com/atlarge/opendc/simulator/instrumentation/Port.kt b/opendc-core/src/main/kotlin/com/atlarge/opendc/simulator/instrumentation/Port.kt index caa11761..880f9a15 100644 --- a/opendc-core/src/main/kotlin/com/atlarge/opendc/simulator/instrumentation/Port.kt +++ b/opendc-core/src/main/kotlin/com/atlarge/opendc/simulator/instrumentation/Port.kt @@ -13,15 +13,13 @@ interface Port { /** * Install the given instrumentation device to produce a stream of measurements of type T. * - * The [ReceiveChannel] returned by this channel is by default unlimited, which means the channel buffers at most - * one measurement, so that the receiver always gets the most recently sent element. - * Back-to-send sent measurements are conflated – only the the most recently sent element is received, while - * previously sent elements are lost. + * The [ReceiveChannel] returned by this channel is by default backed by an unlimited buffer + * (using [Channel.UNLIMITED]), which may induce unnecessary overhead. * * @param instrument The instrumentation device to install. * @return A [ReceiveChannel] to which the of measurements produced by the instrument are published. */ - fun install(instrument: Instrument): ReceiveChannel = install(Channel.CONFLATED, instrument) + fun install(instrument: Instrument): ReceiveChannel = install(Channel.UNLIMITED, instrument) /** * Install the given instrumentation device to produce a stream of measurements of type code>T. -- cgit v1.2.3