SST
13.1.0
Structural Simulation Toolkit
|
Output object provides consistent method for outputting data to stdout, stderr and/or sst debug file. More...
#include <output.h>
Public Types | |
enum | output_location_t { NONE , STDOUT , STDERR , FILE } |
Choice of output location. More... | |
Public Member Functions | |
Output (const std::string &prefix, uint32_t verbose_level, uint32_t verbose_mask, output_location_t location, const std::string &localoutputfilename="") | |
Constructor. More... | |
Output () | |
Default Constructor. More... | |
void | init (const std::string &prefix, uint32_t verbose_level, uint32_t verbose_mask, output_location_t location, const std::string &localoutputfilename="") |
Initialize the object after construction. More... | |
void | output (uint32_t line, const char *file, const char *func, const char *format,...) const |
Output the message with formatting as specified by the format parameter. More... | |
void | output (const char *format,...) const |
Output the message with formatting as specified by the format parameter. More... | |
void | verbose (uint32_t line, const char *file, const char *func, uint32_t output_level, uint32_t output_bits, const char *format,...) const |
Output the verbose message with formatting as specified by the format parameter. More... | |
void | verbosePrefix (const char *tempPrefix, uint32_t line, const char *file, const char *func, uint32_t output_level, uint32_t output_bits, const char *format,...) |
Output the verbose message with formatting as specified by the format parameter. More... | |
void | debugPrefix (const char *tempPrefix, uint32_t line, const char *file, const char *func, uint32_t output_level, uint32_t output_bits, const char *format,...) |
Output the debug message with formatting as specified by the format parameter. More... | |
void | debug (uint32_t line, const char *file, const char *func, uint32_t output_level, uint32_t output_bits, const char *format,...) const |
Output the debug message with formatting as specified by the format parameter. More... | |
void | fatal (uint32_t line, const char *file, const char *func, int exit_code, const char *format,...) const |
Output the fatal message with formatting as specified by the format parameter. More... | |
void | setPrefix (const std::string &prefix) |
Sets object prefix. More... | |
std::string | getPrefix () const |
Returns object prefix. | |
void | setVerboseMask (uint32_t verbose_mask) |
Sets object verbose mask. More... | |
uint32_t | getVerboseMask () const |
Returns object verbose mask. | |
void | setVerboseLevel (uint32_t verbose_level) |
Sets object verbose level. More... | |
uint32_t | getVerboseLevel () const |
Returns object verbose level. | |
void | setOutputLocation (output_location_t location) |
Sets object output location. More... | |
output_location_t | getOutputLocation () const |
Returns object output location. | |
void | flush () const |
This method allows for the manual flushing of the output. | |
Static Public Member Functions | |
static void | setFileName (const std::string &filename) |
This method sets the static filename used by SST. More... | |
static Output & | getDefaultObject () |
Static Public Attributes | |
static constexpr uint32_t | PrintAll = std::numeric_limits<uint32_t>::max() |
Friends | |
class | TraceFunction |
Output object provides consistent method for outputting data to stdout, stderr and/or sst debug file.
All components should use this class to log any information.
SST::Output::Output | ( | const std::string & | prefix, |
uint32_t | verbose_level, | ||
uint32_t | verbose_mask, | ||
output_location_t | location, | ||
const std::string & | localoutputfilename = "" |
||
) |
Constructor.
Set up output configuration.
prefix | Prefix to be prepended to all strings emitted by calls to debug(), verbose(), fatal() and possibly output(). NOTE: No space will be inserted between the prepended prefix string and the normal output string. Prefix can contain the following escape codes:
|
verbose_level | Debugging output level. Calls to debug(), verbose() and fatal() are only output if their output_level parameter is less than or equal to the verbose_level currently set for the object |
verbose_mask | Bitmask of allowed message types for debug(), verbose() and fatal(). The Output object will only output the message if the set bits of the output_bits parameter are set in the verbose_mask of the object. It uses this logic: if (~verbose_mask & output_bits == 0) then output is enabled. |
location | Output location. Output will be directed to STDOUT, STDERR, FILE, or NONE. If FILE output is selected, the output will be directed to the file defined by the –debug runtime parameter, or to the file 'sst_output' if the –debug parameter is not defined. If the size of MPI_COMM_WORLD is > 1, then the rank process will be appended to the file name. |
localoutputfilename. | Send the output of this class to the file identified in localoutputfilename instead of the of the normal output file set by the run time parameter –debug-file. location parameter must be set to FILE. This parameter is intended for special case debug purposes only. |
References init().
SST::Output::Output | ( | ) |
|
inline |
Output the debug message with formatting as specified by the format parameter.
Output will only occur if specified output_level and output_bits meet criteria defined by object. The output will be prepended with the expanded prefix set in the object. NOTE: Debug outputs will only occur if the SST_DEBUG_OUTPUT is defined. this define can be set in source code or by setting the –enable-debug option during SST configuration.
line | Line number of calling function (use CALL_INFO macro) |
file | File name calling function (use CALL_INFO macro) |
func | Function name calling function (use CALL_INFO macro) |
output_level | For output to occur, output_level must be less than or equal to verbose_level set in object |
output_bits | The Output object will only output the message if the set bits of the output_bits parameter are set in the verbose_mask of the object. It uses this logic: if (~verbose_mask & output_bits == 0) then output is enabled. |
format | Format string. All valid formats for printf are available. |
... | Arguments for format. |
References NONE.
|
inline |
Output the debug message with formatting as specified by the format parameter.
Output will only occur if specified output_level and output_bits meet criteria defined by object. The output will be prepended with the expanded prefix set in the object.
tempPrefix | For just this call use this prefix |
line | Line number of calling function (use CALL_INFO macro) |
file | File name calling function (use CALL_INFO macro) |
func | Function name calling function (use CALL_INFO macro) |
output_level | For output to occur, output_level must be less than or equal to verbose_level set in object |
output_bits | The Output object will only output the message if the set bits of the output_bits parameter are set in the verbose_mask of the object. It uses this logic: if (~verbose_mask & output_bits == 0) then output is enabled. |
format | Format string. All valid formats for printf are available. |
... | Arguments for format. |
References NONE.
void SST::Output::fatal | ( | uint32_t | line, |
const char * | file, | ||
const char * | func, | ||
int | exit_code, | ||
const char * | format, | ||
... | |||
) | const |
Output the fatal message with formatting as specified by the format parameter.
Message will be sent to the output location and to stderr. The output will be prepended with the expanded prefix set in the object. NOTE: fatal() will call MPI_Abort(exit_code) to terminate simulation.
line | Line number of calling function (use CALL_INFO macro) |
file | File name calling function (use CALL_INFO macro) |
func | Function name calling function (use CALL_INFO macro) |
exit_code | The exit code used for termination of simulation. will be passed to MPI_Abort() |
format | Format string. All valid formats for printf are available. |
... | Arguments for format. |
References SST::Simulation_impl::emergencyShutdown(), flush(), NONE, STDERR, and STDOUT.
Referenced by SST::Event::clone(), SST::Core::SSTJSONModelDefinition::createConfigGraph(), SST::Core::SSTPythonModelDefinition::createConfigGraph(), SST::SSTElementPythonModule::createPrimaryModule(), SST::Factory::CreateStatistic(), SST::Simulation_impl::getNextClockCycle(), SST::TimeLord::getTimeConverter(), SST::Simulation_impl::intializeProfileTools(), SST::BaseComponent::isUserSubComponentLoadableUsingAPI(), SST::BaseComponent::loadUserSubComponent(), SST::UnitAlgebra::operator+=(), SST::UnitAlgebra::operator-=(), SST::UnitAlgebra::operator<(), SST::UnitAlgebra::operator<=(), SST::UnitAlgebra::operator>(), SST::UnitAlgebra::operator>=(), SST::Statistics::Statistic< void >::outputStatisticFields(), SST::Core::Serialization::pvt::ser_packer::pack_buffer(), SST::Link::recv(), SST::Exit::refDec(), SST::Link::replaceFunctor(), SST::Simulation_impl::reregisterClock(), SST::Link::send_impl(), SST::Link::sendUntimedData(), SST::Link::setFunctor(), and SST::Core::Serialization::pvt::ser_unpacker::unpack_buffer().
void SST::Output::init | ( | const std::string & | prefix, |
uint32_t | verbose_level, | ||
uint32_t | verbose_mask, | ||
output_location_t | location, | ||
const std::string & | localoutputfilename = "" |
||
) |
Initialize the object after construction.
prefix | Prefix to be prepended to all strings emitted by calls to debug(), verbose(), fatal() and possibly output(). NOTE: No space will be inserted between the prepended prefix string and the normal output string. Prefix can contain the following escape codes:
|
verbose_level | Debugging output level. Calls to debug(), verbose() and fatal() are only output if their output_level parameter is less than or equal to the verbose_level currently set for the object |
verbose_mask | Bitmask of allowed message types for debug(), verbose() and fatal(). The Output object will only output the message if the set bits of the output_bits parameter are set in the verbose_mask of the object. It uses this logic: if (~verbose_mask & output_bits == 0) then output is enabled. |
location | Output location. Output will be directed to STDOUT, STDERR, FILE, or NONE. If FILE output is selected, the output will be directed to the file defined by the –debug runtime parameter, or to the file 'sst_output' if the –debug parameter is not defined. If the size of MPI_COMM_WORLD is > 1, then the rank process will be appended to the file name. |
localoutputfilename. | Send the output of this class to the file identified in localoutputfilename instead of the of the normal output file set by the run time parameter –debug-file. location parameter must be set to FILE. This parameter is intended for special case debug purposes only. |
Referenced by Output().
|
inline |
|
inline |
Output the message with formatting as specified by the format parameter.
The output will be prepended with the expanded prefix set in the object.
line | Line number of calling function (use CALL_INFO macro) |
file | File name calling function (use CALL_INFO macro) |
func | Function name calling function (use CALL_INFO macro) |
format | Format string. All valid formats for printf are available. |
... | Argument strings for format. |
References NONE.
Referenced by SST::CoreTestMemPoolTest::MemPoolTestComponent::finish(), SST::OneShot::print(), SST::IMPL::TimeVortexBinnedMapBase< TS >::print(), SST::IMPL::TimeVortexPQBase< TS >::print(), SST::Params::print_all_params(), SST::Simulation_impl::printStatus(), SST::Statistics::StatisticOutputCSV::printUsage(), SST::Statistics::StatisticOutputJSON::printUsage(), SST::Statistics::StatisticOutputTextBase::printUsage(), and SST::Params::verifyKey().
|
static |
This method sets the static filename used by SST.
It can only be called once, and is automatically called by the SST Core. No components should call this method.
void SST::Output::setOutputLocation | ( | output_location_t | location | ) |
Sets object output location.
location | Output location. Output will be directed to STDOUT, STDERR, FILE, or NONE. If FILE output is selected, the output will be directed to the file defined by the –debug runtime parameter, or to the file 'sst_output' if the –debug parameter is not defined. If the size of MPI_COMM_WORLD is > 1, then the rank process will be appended to the file name. |
void SST::Output::setPrefix | ( | const std::string & | prefix | ) |
Sets object prefix.
prefix | Prefix to be prepended to all strings emitted by calls to debug(), verbose(), fatal() and possibly output(). NOTE: No space will be inserted between the prepended prefix string and the normal output string. Prefix can contain the following escape codes:
|
void SST::Output::setVerboseLevel | ( | uint32_t | verbose_level | ) |
void SST::Output::setVerboseMask | ( | uint32_t | verbose_mask | ) |
Sets object verbose mask.
verbose_mask | Bitmask of allowed message types for debug(), verbose() and fatal(). The Output object will only output the message if the set bits of the output_bits parameter are set in the verbose_mask of the object. It uses this logic: if (~verbose_mask & output_bits == 0) then output is enabled. |
|
inline |
Output the verbose message with formatting as specified by the format parameter.
Output will only occur if specified output_level and output_bits meet criteria defined by object. The output will be prepended with the expanded prefix set in the object.
line | Line number of calling function (use CALL_INFO macro) |
file | File name calling function (use CALL_INFO macro) |
func | Function name calling function (use CALL_INFO macro) |
output_level | For output to occur, output_level must be less than or equal to verbose_level set in object |
output_bits | The Output object will only output the message if the set bits of the output_bits parameter are set in the verbose_mask of the object. It uses this logic: if (~verbose_mask & output_bits == 0) then output is enabled. |
format | Format string. All valid formats for printf are available. |
... | Arguments for format. |
References NONE.
Referenced by SST::Core::SSTPythonModelDefinition::createConfigGraph(), and SST::Exit::refDec().
|
inline |
Output the verbose message with formatting as specified by the format parameter.
Output will only occur if specified output_level and output_bits meet criteria defined by object. The output will be prepended with the expanded prefix set in the object.
tempPrefix | For just this call use this prefix |
line | Line number of calling function (use CALL_INFO macro) |
file | File name calling function (use CALL_INFO macro) |
func | Function name calling function (use CALL_INFO macro) |
output_level | For output to occur, output_level must be less than or equal to verbose_level set in object |
output_bits | The Output object will only output the message if the set bits of the output_bits parameter are set in the verbose_mask of the object. It uses this logic: if (~verbose_mask & output_bits == 0) then output is enabled. |
format | Format string. All valid formats for printf are available. |
... | Arguments for format. |
References NONE.