SST  9.1.0
StructuralSimulationToolkit
SST::Output Class Reference

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, 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, 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. More...
 

Static Public Member Functions

static void setFileName (const std::string &filename)
 This method sets the static filename used by SST. More...
 
static OutputgetDefaultObject ()
 

Static Public Attributes

static constexpr uint32_t PrintAll = std::numeric_limits<uint32_t>::max()
 

Friends

class TraceFunction
 

Detailed Description

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.

Member Enumeration Documentation

Choice of output location.

Enumerator
NONE 

No output

STDOUT 

Print to stdout

STDERR 

Print to stderr

FILE 

Print to a file

Constructor & Destructor Documentation

SST::Output::Output ( const std::string &  prefix,
uint32_t  verbose_level,
uint32_t  verbose_mask,
output_location_t  location,
std::string  localoutputfilename = "" 
)

Constructor.

Set up output configuration.

Parameters
prefixPrefix 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:
  • @f Name of the file in which output call was made.
  • @l Line number in the file in which output call was made.
  • @p Name of the function from which output call was made.
  • @r MPI rank of the calling process. Will be empty if MPI_COMM_WORLD size is 1.
  • @R MPI rank of the calling process. Will be 0 if MPI_COMM_WORLD size is 1.
  • @i Thread Id of the calling process. Will be empty if number of threads is 1.
  • @I Thread Id of the calling process. Will be 0 if number of threads is 1.
  • @x Rank information of the calling process. Will be empty if number of MPI ranks and number of threads are both 1 Same as [@r:@i]
  • @X Rank information of the calling process. Will be [0.0] if number of MPI ranks and number of threads are both 1 Same as [@R:@I]
  • @t Simulation time. Will be the raw simulation cycle time retrieved from the SST Core.
verbose_levelDebugging 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_maskBitmask 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.
locationOutput 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 ( )

Default Constructor.

User must call init() to properly initialize obj. Until init() is called, no output will occur.

References NONE.

Member Function Documentation

void SST::Output::debug ( uint32_t  line,
const char *  file,
const char *  func,
uint32_t  output_level,
uint32_t  output_bits,
const char *  format,
  ... 
) const
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.

Parameters
lineLine number of calling function (use CALL_INFO macro)
fileFile name calling function (use CALL_INFO macro)
funcFunction name calling function (use CALL_INFO macro)
output_levelFor output to occur, output_level must be less than or equal to verbose_level set in object
output_bitsThe 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.
formatFormat string. All valid formats for printf are available.
...Arguments for format.

References NONE.

void SST::Output::debugPrefix ( const char *  tempPrefix,
uint32_t  line,
const char *  file,
const char *  func,
uint32_t  output_level,
uint32_t  output_bits,
const char *  format,
  ... 
)
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.

Parameters
tempPrefixFor just this call use this prefix
lineLine number of calling function (use CALL_INFO macro)
fileFile name calling function (use CALL_INFO macro)
funcFunction name calling function (use CALL_INFO macro)
output_levelFor output to occur, output_level must be less than or equal to verbose_level set in object
output_bitsThe 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.
formatFormat 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.

Parameters
lineLine number of calling function (use CALL_INFO macro)
fileFile name calling function (use CALL_INFO macro)
funcFunction name calling function (use CALL_INFO macro)
exit_codeThe exit code used for termination of simulation. will be passed to MPI_Abort()
formatFormat string. All valid formats for printf are available.
...Arguments for format.

References flush(), NONE, and STDERR.

Referenced by SST::ConfigGraph::checkForStructuralErrors(), SST::Factory::CreateComponent(), SST::Factory::CreateModule(), SST::Factory::CreateModuleWithComponent(), SST::Factory::CreatePartitioner(), SST::SSTElementPythonModule::createPrimaryModule(), SST::Factory::CreateStatistic(), SST::Factory::CreateSubComponent(), SST::Factory::DoesComponentInfoStatisticNameExist(), SST::Factory::DoesSubComponentSlotExist(), SST::RankSyncSerialSkip::exchangeLinkUntimedData(), SST::RankSyncParallelSkip::exchangeLinkUntimedData(), SST::ThreadSync::execute(), SST::Factory::GetComponentInfoStatisticEnableLevel(), SST::Factory::GetComponentInfoStatisticUnits(), SST::Simulation::getNextClockCycle(), SST::Factory::getParamNames(), SST::TimeLord::getTimeConverter(), SST::Factory::isPortNameValid(), SST::BaseComponent::loadUserSubComponent(), SST::UnitAlgebra::operator+=(), SST::UnitAlgebra::operator-=(), SST::UnitAlgebra::operator<(), SST::UnitAlgebra::operator<=(), SST::UnitAlgebra::operator>(), SST::UnitAlgebra::operator>=(), SST::Core::Serialization::pvt::ser_packer::pack_buffer(), SST::Simulation::performWireUp(), SST::ThreadSyncSimpleSkip::processLinkUntimedData(), SST::ThreadSync::processLinkUntimedData(), SST::Link::recv(), SST::Exit::refDec(), SST::Simulation::reregisterClock(), SST::Link::send(), and SST::Core::Serialization::pvt::ser_unpacker::unpack_buffer().

void SST::Output::flush ( ) const
inline

This method allows for the manual flushing of the output.

Referenced by fatal().

void SST::Output::init ( const std::string &  prefix,
uint32_t  verbose_level,
uint32_t  verbose_mask,
output_location_t  location,
std::string  localoutputfilename = "" 
)

Initialize the object after construction.

Parameters
prefixPrefix 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:
  • @f Name of the file in which output call was made.
  • @l Line number in the file in which output call was made.
  • @p Name of the function from which output call was made.
  • @r MPI rank of the calling process. Will be empty if MPI_COMM_WORLD size is 1.
  • @R MPI rank of the calling process. Will be 0 if MPI_COMM_WORLD size is 1.
  • @i Thread Id of the calling process. Will be empty if number of threads is 1.
  • @I Thread Id of the calling process. Will be 0 if number of threads is 1.
  • @x Rank information of the calling process. Will be empty if number of MPI ranks and number of threads are both 1 Same as [@r:@i]
  • @X Rank information of the calling process. Will be [0.0] if number of MPI ranks and number of threads are both 1 Same as [@R:@I]
  • @t Simulation time. Will be the raw simulation cycle time retrieved from the SST Core.
verbose_levelDebugging 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_maskBitmask 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.
locationOutput 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().

void SST::Output::output ( uint32_t  line,
const char *  file,
const char *  func,
const char *  format,
  ... 
) const
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.

Parameters
lineLine number of calling function (use CALL_INFO macro)
fileFile name calling function (use CALL_INFO macro)
funcFunction name calling function (use CALL_INFO macro)
formatFormat string. All valid formats for printf are available.
...Argument strings for format.

References NONE.

Referenced by SST::ConfigGraph::checkForStructuralErrors(), SST::Action::print(), SST::StopAction::print(), SST::IMPL::TimeVortexPQ::print(), SST::ThreadSync::print(), SST::Exit::print(), SST::Clock::print(), SST::OneShot::print(), SST::SyncManager::print(), SST::Event::print(), SST::Activity::print(), SST::NullEvent::print(), SST::Simulation::printStatus(), SST::Statistics::StatisticOutputJSON::printUsage(), SST::Statistics::StatisticOutputConsole::printUsage(), SST::Statistics::StatisticOutputCSV::printUsage(), SST::Statistics::StatisticOutputTxt::printUsage(), SST::Statistics::StatisticOutputHDF5::printUsage(), and SST::Params::verifyParam().

void SST::Output::output ( const char *  format,
  ... 
) const
inline

Output the message with formatting as specified by the format parameter.

Parameters
formatFormat string. All valid formats for printf are available.
...Arguments for format.

References NONE.

void SST::Output::setFileName ( const std::string &  filename)
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.

Parameters
locationOutput 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.

Parameters
prefixPrefix 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:
  • @f Name of the file in which output call was made.
  • @l Line number in the file in which output call was made.
  • @p Name of the function from which output call was made.
  • @r MPI rank of the calling process. Will be empty if MPI_COMM_WORLD size is 1.
  • @R MPI rank of the calling process. Will be 0 if MPI_COMM_WORLD size is 1.
  • @i Thread Id of the calling process. Will be empty if number of threads is 1.
  • @I Thread Id of the calling process. Will be 0 if number of threads is 1.
  • @x Rank information of the calling process. Will be empty if number of MPI ranks and number of threads are both 1 Same as [@r:@i]
  • @X Rank information of the calling process. Will be [0.0] if number of MPI ranks and number of threads are both 1 Same as [@R:@I]
  • @t Simulation time. Will be the raw simulation cycle time retrieved from the SST Core.
void SST::Output::setVerboseLevel ( uint32_t  verbose_level)

Sets object verbose level.

Parameters
verbose_levelDebugging 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
void SST::Output::setVerboseMask ( uint32_t  verbose_mask)

Sets object verbose mask.

Parameters
verbose_maskBitmask 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.
void SST::Output::verbose ( uint32_t  line,
const char *  file,
const char *  func,
uint32_t  output_level,
uint32_t  output_bits,
const char *  format,
  ... 
) const
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.

Parameters
lineLine number of calling function (use CALL_INFO macro)
fileFile name calling function (use CALL_INFO macro)
funcFunction name calling function (use CALL_INFO macro)
output_levelFor output to occur, output_level must be less than or equal to verbose_level set in object
output_bitsThe 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.
formatFormat string. All valid formats for printf are available.
...Arguments for format.

References NONE.

Referenced by SST::Exit::refDec().

void SST::Output::verbosePrefix ( const char *  tempPrefix,
uint32_t  line,
const char *  file,
const char *  func,
uint32_t  output_level,
uint32_t  output_bits,
const char *  format,
  ... 
)
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.

Parameters
tempPrefixFor just this call use this prefix
lineLine number of calling function (use CALL_INFO macro)
fileFile name calling function (use CALL_INFO macro)
funcFunction name calling function (use CALL_INFO macro)
output_levelFor output to occur, output_level must be less than or equal to verbose_level set in object
output_bitsThe 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.
formatFormat string. All valid formats for printf are available.
...Arguments for format.

References NONE.


The documentation for this class was generated from the following files: