From 08d0ea5d4019dbe1694d55988e6d56693c440f1a Mon Sep 17 00:00:00 2001 From: Scott Fennell Date: Wed, 27 Feb 2019 16:00:03 -0600 Subject: [PATCH] #738 add Derek's warning --- include/trick/DataRecordGroup.hh | 3 +++ trick_source/sim_services/DataRecord/DataRecordGroup.cpp | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/include/trick/DataRecordGroup.hh b/include/trick/DataRecordGroup.hh index 43ff0fae..421167f5 100644 --- a/include/trick/DataRecordGroup.hh +++ b/include/trick/DataRecordGroup.hh @@ -121,6 +121,9 @@ namespace Trick { /** Current file size for data record file in bytes.\n */ uint64_t total_bytes_written; /**< trick_io(**) trick_units(--) */ + /** Bool to signify that the warning for reaching max filesize has been printed */ + bool max_size_warning; + /** Buffer to hold formatted data ready for disk or other destination.\n */ char * writer_buff ; /**< trick_io(**) trick_units(--) */ diff --git a/trick_source/sim_services/DataRecord/DataRecordGroup.cpp b/trick_source/sim_services/DataRecord/DataRecordGroup.cpp index ad16655a..36f53e2c 100644 --- a/trick_source/sim_services/DataRecord/DataRecordGroup.cpp +++ b/trick_source/sim_services/DataRecord/DataRecordGroup.cpp @@ -73,6 +73,7 @@ Trick::DataRecordGroup::DataRecordGroup( std::string in_name ) : writer_num(0), max_file_size(1<<30), // 1 GB total_bytes_written(0), + max_size_warning(false), writer_buff(NULL), single_prec_only(false), buffer_type(DR_Buffer), @@ -692,6 +693,14 @@ int Trick::DataRecordGroup::write_data(bool must_write) { writer_num++ ; } + + if(!max_size_warning && (total_bytes_written > max_file_size)) { + std::cerr << "WARNING: Data record max file size " << (max_file_size>>10) << "KB reached. Contact Derek Bankieris regarding any concerns.\n" + "https://github.com/nasa/trick/wiki/Data-Record#changing-the-max-file-size-of-a-data-record-group-ascii-and-binary-only" + << std::endl; + max_size_warning = true; + } + pthread_mutex_unlock(&buffer_mutex) ; }