Skip to content
Snippets Groups Projects
Commit 13ab51be authored by Erik von Reis's avatar Erik von Reis
Browse files

Merge branch 'daqd_data_rate' into 'master'

Adding more epics diagnostics to the daqd

See merge request cds/advligorts!127
parents 48e941f8 452f191b
No related branches found
No related tags found
1 merge request!127Adding more epics diagnostics to the daqd
......@@ -39,6 +39,14 @@ namespace PV
PV_SECOND_FRAME_SIZE,
PV_MINUTE_FRAME_SIZE,
PV_RETRANSMIT_TOTAL,
// DCU counts
PV_PRDCR_UNIQUE_DCU_REPORTED_PER_S,
PV_PRDCR_TOTAL_DCU_REPORTED_PER_S,
// Producer data rate information
PV_PRDCR_TOTAL_DATA_RATE_KB_PER_S,
PV_PRDCR_TP_DATA_RATE_KB_PER_S,
PV_PRDCR_MODEL_DATA_RATE_KB_PER_S,
PV_PRDCR_OPEN_TP_COUNT,
// Main producer thread timings
PV_PRDCR_TIME_FULL_MEAN_MS,
PV_PRDCR_TIME_FULL_MIN_MS,
......@@ -75,8 +83,8 @@ namespace PV
// run/configuration numbers
PV_CONFIGURATION_NUMBER,
// raw trend writer state
PV_RAW_MTREND_TW_STATE, // is the raw trend writer currently writing
PV_RAW_MTREND_TW_WRITE_SEC, // processing time for raw trend data
PV_RAW_MTREND_TW_STATE, // is the raw trend writer currently writing
PV_RAW_MTREND_TW_WRITE_SEC, // processing time for raw trend data
MAX_PV
};
......
......@@ -227,6 +227,48 @@ pvInfo exServer::pvList[] = {
excasIoSync,
1,
pvValue + PV::PV_RETRANSMIT_TOTAL ),
pvInfo( 1,
"PRDCR_UNIQUE_DCU_REPORTED_PER_S",
0xffffffff,
0,
excasIoSync,
1,
pvValue + PV::PV_PRDCR_UNIQUE_DCU_REPORTED_PER_S ),
pvInfo( 1,
"PRDCR_TOTAL_DCU_REPORTED_PER_S",
0xffffffff,
0,
excasIoSync,
1,
pvValue + PV::PV_PRDCR_TOTAL_DCU_REPORTED_PER_S ),
pvInfo( 1,
"PRDCR_TOTAL_DATA_RATE_KB_PER_S",
0xffffffff,
0,
excasIoSync,
1,
pvValue + PV::PV_PRDCR_TOTAL_DATA_RATE_KB_PER_S ),
pvInfo( 1,
"PRDCR_TP_DATA_RATE_KB_PER_S",
0xffffffff,
0,
excasIoSync,
1,
pvValue + PV::PV_PRDCR_TP_DATA_RATE_KB_PER_S ),
pvInfo( 1,
"PRDCR_MODEL_DATA_RATE_KB_PER_S",
0xffffffff,
0,
excasIoSync,
1,
pvValue + PV::PV_PRDCR_MODEL_DATA_RATE_KB_PER_S ),
pvInfo( 1,
"PRDCR_OPEN_TP_COUNT",
0xffffffff,
0,
excasIoSync,
1,
pvValue + PV::PV_PRDCR_OPEN_TP_COUNT ),
pvInfo( 1,
"PRDCR_TIME_FULL_MEAN_MS",
0xffffffff,
......
......@@ -28,8 +28,9 @@
#include <fstream>
#include <algorithm>
#include <array>
#include <cctype> // old <ctype.h>
#include <cctype>
#include <memory>
#include <numeric>
#include <sys/prctl.h>
#ifdef USE_SYMMETRICOM
......@@ -77,6 +78,36 @@ struct ToLower
}
};
/*!
* @brief return a pointer to the first dcu_msg_header_t in the
* daq_multi_dcu_header_t structure
* @param headers the headers structure
* @return pointer to the first message header.
* @note added so that standard algorithms could be used with the set of
* populated dcu headers in a block
*/
inline daq_msg_header_t*
begin( daq_multi_dcu_header_t& headers )
{
return headers.dcuheader;
}
/*!
* @brief return a pointer just past the last used dcu_msg_header_t in the
* daq_multi_dcu_header_t structure
* @param headers the headers structure
* @return pointer just passed the last used message header (as denoted by the
* dcuTotalModels field)
* @note added so that standard algorithms could be used with the set of
* populated dcu headers in a block
* @note this does not check for an invalid dcuTotalModels value
*/
inline daq_msg_header_t*
end( daq_multi_dcu_header_t& headers )
{
return begin( headers ) + headers.dcuTotalModels;
}
/* GM and shared memory communication area */
/* This may still be needed for test points */
......@@ -246,6 +277,17 @@ producer::frame_writer( )
PV::set_pv( PV::PV_UPTIME_SECONDS, 0 );
PV::set_pv( PV::PV_GPS, 0 );
std::array< std::uint8_t, DCU_COUNT > dcu_recv_mask{};
std::uint32_t dcu_recv_count = 0;
std::uint64_t data_in_kb = 0;
std::uint64_t data_regular_in_kb = 0;
std::uint64_t data_tp_in_kb = 0;
PV::set_pv( PV::PV_PRDCR_UNIQUE_DCU_REPORTED_PER_S, 0 );
PV::set_pv( PV::PV_PRDCR_TOTAL_DCU_REPORTED_PER_S, 0 );
PV::set_pv( PV::PV_PRDCR_TOTAL_DATA_RATE_KB_PER_S, 0 );
PV::set_pv( PV::PV_PRDCR_TP_DATA_RATE_KB_PER_S, 0 );
PV::set_pv( PV::PV_PRDCR_MODEL_DATA_RATE_KB_PER_S, 0 );
int prev_controller_cycle = -1;
int dcu_cycle = 0;
int resync = 0;
......@@ -275,6 +317,41 @@ producer::frame_writer( )
daq_dc_data_t* data_block = shmem_receiver.receive_data( );
stat_recv.tick( );
if ( i % 16 == 0 )
{
unsigned int tp_count = 0;
for ( const auto& dcu_header : data_block->header )
{
tp_count += dcu_header.tpCount;
}
PV::set_pv( PV::PV_PRDCR_OPEN_TP_COUNT, tp_count );
PV::set_pv( PV::PV_PRDCR_UNIQUE_DCU_REPORTED_PER_S,
std::accumulate( dcu_recv_mask.begin( ),
dcu_recv_mask.end( ),
static_cast< std::uint32_t >( 0 ) ) );
PV::set_pv( PV::PV_PRDCR_TOTAL_DCU_REPORTED_PER_S, dcu_recv_count );
PV::set_pv( PV::PV_PRDCR_TOTAL_DATA_RATE_KB_PER_S,
data_in_kb / 1024 );
PV::set_pv( PV::PV_PRDCR_TP_DATA_RATE_KB_PER_S,
data_tp_in_kb / 1024 );
PV::set_pv( PV::PV_PRDCR_MODEL_DATA_RATE_KB_PER_S,
data_regular_in_kb / 1024 );
std::fill( dcu_recv_mask.begin( ), dcu_recv_mask.end( ), 0 );
dcu_recv_count = 0;
data_in_kb = 0;
data_tp_in_kb = 0;
data_regular_in_kb = 0;
}
data_in_kb += data_block->header.fullDataBlockSize;
dcu_recv_count += data_block->header.dcuTotalModels;
for ( const auto& dcu_header : data_block->header )
{
dcu_header.tpCount;
dcu_recv_mask[ dcu_header.dcuId ] = 1;
data_tp_in_kb += dcu_header.tpBlockSize;
data_regular_in_kb += dcu_header.dataBlockSize;
}
producer_buf* cur_buffer =
work_queue->get_from_queue( RECV_THREAD_INPUT );
circ_buffer_block_prop_t* cur_prop = &cur_buffer->prop;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment