DDS QoS - LATENCY

    技术2022-07-11  141

    https://download.csdn.net/download/eidolon_foot/12568768

    8. LATENCY_BUDGET

    OpenDDS:

    The LATENCY_BUDGET policy applies to topic, data reader, and data writer entities via the latency_budget member of their respective QoS policy structures. Below is the IDL related to the LatencyBudget QoS policy: 延迟预算策略通过其各自的QoS策略结构的延迟预算成员应用于主题、数据读取器和数据写入器实体。下面是与LatencyBudget QoS策略相关的IDL: struct LatencyBudgetQosPolicy { Duration_t duration; }; The default value of duration is zero indicating that the delay should be minimized. This policy is considered a hint to the transport layer to indicate the urgency of samples being sent. OpenDDS uses the value to bound a delay interval for reporting unacceptable delay in transporting samples from publication to subscription. This policy is used for monitoring purposes only at this time. Use the TRANSPORT_PRIORITY policy to modify the sending of samples. The data writer policy value is used only for compatibility comparisons and if left at the default value of zero will result in all requested duration values from data readers being matched. duration的默认值为零,表示应该将延迟最小化。此策略被视为对传输层的提示,以指示发送样本的紧迫性。OpenDDS使用该值绑定一个延迟间隔,用于报告将样本从发布传输到订阅时的不可接受延迟。此策略目前仅用于监视目的。使用传输优先级策略修改样本的发送。数据写入器策略值仅用于兼容性比较,如果保留为默认值零,则将匹配来自数据读取器的所有请求持续时间值。 An additional listener extension has been added to allow reporting delays in excess of the policy duration setting. The OpenDDS::DCPS::DataReaderListener interface has an additional operation for notification that samples were received with a measured transport delay greater than the latency_budget policy duration. The IDL for this method is: 添加了一个附加的侦听器扩展,以允许报告超过策略持续时间设置的延迟。OpenDDS::DCPS::DataReaderListener接口有一个附加操作,用于通知收到的样本的传输延迟测量值大于latency_budget策略持续时间。该方法的IDL为: struct BudgetExceededStatus { long total_count; long total_count_change; DDS::InstanceHandle_t last_instance_handle; }; void on_budget_exceeded( in DDS::DataReader reader, in BudgetExceededStatus status); To use the extended listener callback you will need to derive the listener implementation from the extended interface, as shown in the following code fragment: 要使用扩展侦听器回调,需要从扩展接口派生侦听器实现,如以下代码片段所示: class DataReaderListenerImpl     : public virtual       OpenDDS::DCPS::LocalObject<OpenDDS::DCPS::DataReaderListener>   Then you must provide a non-null implementation for the on_budget_exceeded() operation. Note that you will need to provide empty implementations for the following extended operations as well: 然后必须为on_budget_exceeded()操作提供非空实现。请注意,您还需要为以下扩展操作提供空实现: on_subscription_disconnected() on_subscription_reconnected() on_subscription_lost() on_connection_deleted() OpenDDS also makes the summary latency statistics available via an extended interface of the data reader. This extended interface is located in the OpenDDS::DCPS module and the IDL is defined as:

    OpenDDS还通过数据读取器的扩展接口提供了摘要延迟统计信息。此扩展接口位于OpenDDS::DCPS模块中,IDL定义为:

    struct LatencyStatistics { GUID_t publication; unsigned long n; double maximum; double minimum; double mean; double variance; }; typedef sequence<LatencyStatistics> LatencyStatisticsSeq; local interface DataReaderEx : DDS::DataReader {   /// Obtain a sequence of statistics summaries.   void get_latency_stats( inout LatencyStatisticsSeq stats);   /// Clear any intermediate statistical values.   void reset_latency_stats();   /// Statistics gathering enable state.   attribute boolean statistics_enabled; }; To gather this statistical summary data you will need to use the extended interface. You can do so simply by dynamically casting the OpenDDS data reader pointer and calling the operations directly. In the following example, we assume that reader is initialized correctly by calling DDS::Subscriber::create_datareader() : 要收集这些统计摘要数据,您需要使用扩展接口。您可以通过动态转换OpenDDS数据读取器指针并直接调用操作来实现。在下面的示例中,我们假设通过调用DDS::Subscriber::create_datareader()正确初始化了读取器: DDS::DataReader_var reader; // ... // To start collecting new data. dynamic_cast<OpenDDS::DCPS::DataReaderImpl*>(reader.in())-> reset_latency_stats(); dynamic_cast<OpenDDS::DCPS::DataReaderImpl*>(reader.in())-> statistics_enabled(true); // ... // To collect data. OpenDDS::DCPS::LatencyStatisticsSeq stats; dynamic_cast<OpenDDS::DCPS::DataReaderImpl*>(reader.in())-> get_latency_stats(stats); for (unsigned long i = 0; i < stats.length(); ++i) { std::cout << "stats[" << i << "]:" << std::endl; std::cout << " n = " << stats[i].n << std::endl; std::cout << " max = " << stats[i].maximum << std::endl; std::cout << " min = " << stats[i].minimum << std::endl; std::cout << " mean = " << stats[i].mean << std::endl; std::cout << " variance = " << stats[i].variance << std::endl; } formal/2015-04-10: This policy provides a means for the application to indicate to the middleware the “urgency” of the data-communication. By having a non-zero duration the Service can optimize its internal operation.

    此策略为应用程序提供了一种向中间件指示数据通信的“紧迫性”的方法。通过具有非零的持续时间,服务可以优化其内部操作。

    This policy is considered a hint. There is no specified mechanism as to how the service should take advantage of this hint. 这项政策被认为是一个暗示。对于服务应该如何利用这个提示,没有指定的机制。 The value offered is considered compatible with the value requested if and only if the inequality “offered duration <= requested duration ” evaluates to ‘TRUE.’ 当且仅当不等式“offered duration<=requested duration”的计算结果为“TRUE”时,才认为提供的值与请求的值兼容
    Processed: 0.011, SQL: 10