#738 add Derek's warning

This commit is contained in:
Scott Fennell 2019-02-27 16:00:03 -06:00
parent 6eeb4cee80
commit 08d0ea5d40
2 changed files with 12 additions and 0 deletions

View File

@ -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(--) */

View File

@ -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) ;
}