Line data Source code
1 : #ifndef HEADER_fd_src_flamenco_log_collector_fd_log_collector_base_h 2 : #define HEADER_fd_src_flamenco_log_collector_fd_log_collector_base_h 3 : 4 : #include "../fd_flamenco_base.h" 5 : 6 : /* Base definition for fd_log_collector_t. 7 : (This is needed to avoid circular dependencies) */ 8 : 9 188658 : #define FD_LOG_COLLECTOR_MAX (10000UL) /* Max bytes of actual log messages before truncate: 10 : https://github.com/anza-xyz/agave/blob/v2.0.6/program-runtime/src/log_collector.rs#L4 */ 11 : #define FD_LOG_COLLECTOR_EXTRA (4000UL) /* Large enough to cover worst cases: 12 : The serialization overhead is 2-3 bytes/log message, 13 : and realistically there can only be <800 messages. 14 : Moreover, we need extra space for possibly large 15 : vsnprintf, e.g. program_return(). 16 : So, roughly, 2000 + 2000 = 4000 extra bytes. */ 17 188595 : #define FD_LOG_COLLECTOR_PROTO_TAG (0x32) /* Tag for protobuf serialization */ 18 : 19 : struct fd_log_collector { 20 : ushort buf_sz; /* The size of buf currently used, including serialization 21 : overheads. For example, if you need to copy all logs, 22 : you should copy buf_sz bytes. */ 23 : 24 : ushort log_sz; /* The total bytes count of logs inserted, up to 25 : FD_LOG_COLLECTOR_MAX. 26 : This is only used to match Agave's behavior and 27 : truncate logs when necessary. */ 28 : 29 : uchar warn; /* Whether we truncated or not logs, to match Agave's 30 : behavior. */ 31 : 32 : uchar disabled; /* Whether txn logs are disabled (1) or enabled (0). */ 33 : 34 : /* Log buffer, serialized. */ 35 : uchar buf[ FD_LOG_COLLECTOR_MAX + FD_LOG_COLLECTOR_EXTRA ]; 36 : }; 37 : typedef struct fd_log_collector fd_log_collector_t; 38 : 39 : FD_PROTOTYPES_BEGIN 40 : 41 : FD_PROTOTYPES_END 42 : 43 : #endif /* HEADER_fd_src_flamenco_log_collector_fd_log_collector_base_h */