From ad0769fc84ba4ab7c55cf61d5ccfc76e39d6d218 Mon Sep 17 00:00:00 2001 From: Jonathan Hanks <jonathan.hanks@ligo.org> Date: Fri, 30 Oct 2020 15:20:46 -0700 Subject: [PATCH] Updating the timing of epics broadcasts and the data crcs for cps_recv. Update the epics more frequently than 1s to allow caget to work w/o timeouts. Update the data crc on data cycle 0. --- src/pub_sub_stream/dc_stats.cc | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/pub_sub_stream/dc_stats.cc b/src/pub_sub_stream/dc_stats.cc index b1e29ba06..a0daa7646 100644 --- a/src/pub_sub_stream/dc_stats.cc +++ b/src/pub_sub_stream/dc_stats.cc @@ -582,6 +582,7 @@ DCStats::run( simple_pv_handle epics_server ) for_each( dcu_status_, clear_entries ); for ( std::uint64_t cycles = 1;; ++cycles ) { + unsigned int data_cycle = 0xffffffff; total_data_crc.reset( ); dc_queue::value_type entry{ get_message( epics_server ) }; @@ -633,6 +634,7 @@ DCStats::run( simple_pv_handle epics_server ) if ( first ) { gpstime_ = cur_header.timeSec; + data_cycle = cur_header.cycle; first = false; } if ( cur_header.fileCrc != cur_status.expected_config_crc ) @@ -663,9 +665,18 @@ DCStats::run( simple_pv_handle epics_server ) } for_each( dcu_status_, mark_dcu_if_skipped_this_cycle ); for_each( dcu_status_, clear_seen_last_cycle_if_skipped ); + + bool alternating_cycle = cycles % 2 == 0; + bool one_sec_update = cycles % 16 == 0; + + if ( data_cycle == 0 ) + { + data_crc_ = static_cast< int >( total_data_crc.result( ) ); + } + // we can either do this off of our counter or off of the // data cycle counter. - if ( cycles % 16 == 0 ) + if ( one_sec_update ) { ++uptime_; tp_data_kb_per_s_ = static_cast< unsigned int >( tp_data / 1024 ); @@ -677,7 +688,7 @@ DCStats::run( simple_pv_handle epics_server ) open_tp_count_ = static_cast< int >( tp_count ); unique_dcus_per_sec_ = boost::count_if( dcu_status_, entry_was_processed ); - data_crc_ = static_cast< int >( total_data_crc.result( ) ); + simple_pv_server_update( epics_server ); for_each( dcu_status_, clear_entries ); @@ -691,5 +702,9 @@ DCStats::run( simple_pv_handle epics_server ) request_clear_crc_ = false; } } + else if ( alternating_cycle ) + { + simple_pv_server_update( epics_server ); + } } } \ No newline at end of file -- GitLab