SST  15.1.0
StructuralSimulationToolkit
output.h
1 // Copyright 2009-2025 NTESS. Under the terms
2 // of Contract DE-NA0003525 with NTESS, the U.S.
3 // Government retains certain rights in this software.
4 //
5 // Copyright (c) 2009-2025, NTESS
6 // All rights reserved.
7 //
8 // This file is part of the SST software package. For license
9 // information, see the LICENSE file in the top level directory of the
10 // distribution.
11 
12 #ifndef SST_CORE_OUTPUT_H
13 #define SST_CORE_OUTPUT_H
14 
15 #include "sst/core/serialization/serializer_fwd.h"
16 #include "sst/core/warnmacros.h"
17 
18 #include <cstdarg>
19 #include <cstdint>
20 #include <string>
21 #include <utility>
22 #include <vector>
23 
24 // UNCOMMENT OUT THIS LINE TO ENABLE THE DEBUG METHOD -OR_
25 // CHOOSE THE --enable-debug OPTION DURING SST CONFIGURATION
26 // #define __SST_DEBUG_OUTPUT__
27 
28 // This must be defined before inclusion of intttypes.h
29 #ifndef __STDC_FORMAT_MACROS
30 #define __STDC_FORMAT_MACROS
31 #endif
32 
33 #include <cinttypes>
34 #include <cstdio>
35 #include <stdarg.h>
36 #include <thread>
37 #include <unordered_map>
38 
39 extern int main(int argc, char** argv);
40 
41 namespace SST {
42 
43 // MACROS TO HELP BUILD THE CALLING FUNCTIONS INFORMATION
44 #define CALL_INFO __LINE__, __FILE__, __FUNCTION__
45 
46 #if defined(__GNUC__) || defined(__clang__)
47 #define CALL_INFO_LONG __LINE__, __FILE__, __PRETTY_FUNCTION__
48 #else
49 #define CALL_INFO_LONG __LINE__, __FILE__, __FUNCTION__
50 #endif
51 
52 /**
53  * Output object provides consistent method for outputting data to
54  * stdout, stderr and/or sst debug file. All components should
55  * use this class to log any information.
56  */
57 class Output
58 {
59 public:
60  /** Choice of output location
61  */
63  NONE, /*!< No output */
64  STDOUT, /*!< Print to stdout */
65  STDERR, /*!< Print to stderr */
66  FILE /*!< Print to a file */
67  };
68 
69  static constexpr uint32_t PrintAll = std::numeric_limits<uint32_t>::max();
70 
71  /** Constructor. Set up output configuration.
72  @param prefix Prefix to be prepended to all strings emitted by calls to
73  debug(), verbose(), fatal() and possibly output().
74  NOTE: No space will be inserted between the prepended prefix
75  string and the normal output string.
76  Prefix can contain the following escape codes:
77  - \@f Name of the file in which output call was made.
78  - \@l Line number in the file in which output call was made.
79  - \@p Name of the function from which output call was made.
80  - \@r MPI rank of the calling process. Will be empty if
81  MPI_COMM_WORLD size is 1.
82  - \@R MPI rank of the calling process. Will be 0 if
83  MPI_COMM_WORLD size is 1.
84  - \@i Thread Id of the calling process. Will be empty if
85  number of threads is 1.
86  - \@I Thread Id of the calling process. Will be 0 if
87  number of threads is 1.
88  - \@x Rank information of the calling process. Will be empty if
89  number of MPI ranks and number of threads are both 1
90  Same as [\@r:\@i]
91  - \@X Rank information of the calling process. Will be [0.0] if
92  number of MPI ranks and number of threads are both 1
93  Same as [\@R:\@I]
94  - \@t Simulation time. Will be the raw simulation cycle time
95  retrieved from the SST Core.
96  @param verbose_level Debugging output level. Calls to debug(),
97  verbose() and fatal() are only output if their output_level
98  parameter is less than or equal to the verbose_level currently
99  set for the object
100  @param verbose_mask Bitmask of allowed message types for debug(),
101  verbose() and fatal(). The Output object will only output the
102  message if the set bits of the output_bits parameter
103  are set in the verbose_mask of the object. It uses this logic:
104  if (~verbose_mask & output_bits == 0) then output is enabled.
105  @param location Output location. Output will be directed to STDOUT,
106  STDERR, FILE, or NONE. If FILE output is selected, the
107  output will be directed to the file defined by the
108  --debug runtime parameter, or to the file 'sst_output' if the
109  --debug parameter is not defined. If the size of MPI_COMM_WORLD
110  is > 1, then the rank process will be appended to the file name.
111  @param localoutputfilename. Send the output of this class to the
112  file identified in localoutputfilename instead of the of the
113  normal output file set by the run time parameter --debug-file.
114  location parameter must be set to FILE. This parameter is
115  intended for special case debug purposes only.
116  */
117  // CONSTRUCTION / DESTRUCTION
118  Output(const std::string& prefix, uint32_t verbose_level, uint32_t verbose_mask, output_location_t location,
119  const std::string& localoutputfilename = "");
120 
121  /** Default Constructor. User must call init() to properly initialize obj.
122  Until init() is called, no output will occur.
123  */
124  Output(); // Default constructor
125 
126  ~Output();
127 
128  Output(const Output&) = default;
129  Output& operator=(const Output&) = default;
130 
131  /** Initialize the object after construction
132  @param prefix Prefix to be prepended to all strings emitted by calls to
133  debug(), verbose(), fatal() and possibly output().
134  NOTE: No space will be inserted between the prepended prefix
135  string and the normal output string.
136  Prefix can contain the following escape codes:
137  - \@f Name of the file in which output call was made.
138  - \@l Line number in the file in which output call was made.
139  - \@p Name of the function from which output call was made.
140  - \@r MPI rank of the calling process. Will be empty if
141  MPI_COMM_WORLD size is 1.
142  - \@R MPI rank of the calling process. Will be 0 if
143  MPI_COMM_WORLD size is 1.
144  - \@i Thread Id of the calling process. Will be empty if
145  number of threads is 1.
146  - \@I Thread Id of the calling process. Will be 0 if
147  number of threads is 1.
148  - \@x Rank information of the calling process. Will be empty if
149  number of MPI ranks and number of threads are both 1
150  Same as [\@r:\@i]
151  - \@X Rank information of the calling process. Will be [0.0] if
152  number of MPI ranks and number of threads are both 1
153  Same as [\@R:\@I]
154  - \@t Simulation time. Will be the raw simulation cycle time
155  retrieved from the SST Core.
156  @param verbose_level Debugging output level. Calls to debug(),
157  verbose() and fatal() are only output if their output_level
158  parameter is less than or equal to the verbose_level currently
159  set for the object
160  @param verbose_mask Bitmask of allowed message types for debug(),
161  verbose() and fatal(). The Output object will only output the
162  message if the set bits of the output_bits parameter
163  are set in the verbose_mask of the object. It uses this logic:
164  if (~verbose_mask & output_bits == 0) then output is enabled.
165  @param location Output location. Output will be directed to STDOUT,
166  STDERR, FILE, or NONE. If FILE output is selected, the
167  output will be directed to the file defined by the
168  --debug runtime parameter, or to the file 'sst_output' if the
169  --debug parameter is not defined. If the size of MPI_COMM_WORLD
170  is > 1, then the rank process will be appended to the file name.
171  @param localoutputfilename. Send the output of this class to the
172  file identified in localoutputfilename instead of the of the
173  normal output file set by the run time parameter --debug-file.
174  location parameter must be set to FILE. This parameter is
175  intended for special case debug purposes only.
176  */
177  // INITIALIZATION
178  void init(const std::string& prefix, uint32_t verbose_level, uint32_t verbose_mask, output_location_t location,
179  const std::string& localoutputfilename = "");
180 
181  /** Output the message with formatting as specified by the format parameter.
182  The output will be prepended with the expanded prefix set in the object.
183  @param line Line number of calling function (use CALL_INFO macro)
184  @param file File name calling function (use CALL_INFO macro)
185  @param func Function name calling function (use CALL_INFO macro)
186  @param format Format string. All valid formats for printf are available.
187  @param ... Argument strings for format.
188  */
189  void output(uint32_t line, const char* file, const char* func, const char* format, ...) const
190  __attribute__((format(printf, 5, 6)))
191  {
192  va_list arg;
193  if ( true == m_objInitialized && NONE != m_targetLoc ) {
194  // Get the argument list and then print it out
195  va_start(arg, format);
196  outputprintf(line, file, func, format, arg);
197  va_end(arg);
198  }
199  }
200 
201  /** Output the message with formatting as specified by the format parameter.
202  @param format Format string. All valid formats for printf are available.
203  @param ... Arguments for format.
204  */
205  void output(const char* format, ...) const __attribute__((format(printf, 2, 3)))
206  {
207  va_list arg;
208  if ( true == m_objInitialized && NONE != m_targetLoc ) {
209  // Get the argument list and then print it out
210  va_start(arg, format);
211  outputprintf(format, arg);
212  va_end(arg);
213  }
214  }
215 
216  /** Output the verbose message with formatting as specified by the format
217  parameter. Output will only occur if specified output_level and
218  output_bits meet criteria defined by object. The output will be
219  prepended with the expanded prefix set in the object.
220  @param line Line number of calling function (use CALL_INFO macro)
221  @param file File name calling function (use CALL_INFO macro)
222  @param func Function name calling function (use CALL_INFO macro)
223  @param output_level For output to occur, output_level must be less than
224  or equal to verbose_level set in object
225  @param output_bits The Output object will only output the
226  message if the set bits of the output_bits parameter are set in
227  the verbose_mask of the object. It uses this logic:
228  if (~verbose_mask & output_bits == 0) then output is enabled.
229  @param format Format string. All valid formats for printf are available.
230  @param ... Arguments for format.
231  */
232  void verbose(uint32_t line, const char* file, const char* func, uint32_t output_level, uint32_t output_bits,
233  const char* format, ...) const __attribute__((format(printf, 7, 8)))
234  {
235  va_list arg;
236 
237  if ( true == m_objInitialized && NONE != m_targetLoc ) {
238  // First check to see if we are allowed to send output based upon the
239  // verbose_mask and verbose_level checks
240  if ( ((output_bits & ~m_verboseMask) == 0) && (output_level <= m_verboseLevel) ) {
241  // Get the argument list and then print it out
242  va_start(arg, format);
243  outputprintf(line, file, func, format, arg);
244  va_end(arg);
245  }
246  }
247  }
248 
249  /** Output the verbose message with formatting as specified by the format
250  parameter. Output will only occur if specified output_level and
251  output_bits meet criteria defined by object. The output will be
252  prepended with the expanded prefix set in the object.
253  @param tempPrefix For just this call use this prefix
254  @param line Line number of calling function (use CALL_INFO macro)
255  @param file File name calling function (use CALL_INFO macro)
256  @param func Function name calling function (use CALL_INFO macro)
257  @param output_level For output to occur, output_level must be less than
258  or equal to verbose_level set in object
259  @param output_bits The Output object will only output the
260  message if the set bits of the output_bits parameter are set in
261  the verbose_mask of the object. It uses this logic:
262  if (~verbose_mask & output_bits == 0) then output is enabled.
263  @param format Format string. All valid formats for printf are available.
264  @param ... Arguments for format.
265  */
266  void verbosePrefix(const char* tempPrefix, uint32_t line, const char* file, const char* func, uint32_t output_level,
267  uint32_t output_bits, const char* format, ...) __attribute__((format(printf, 8, 9)))
268  {
269 
270  va_list arg;
271 
272  if ( true == m_objInitialized && NONE != m_targetLoc ) {
273  const std::string normalPrefix = m_outputPrefix;
274  m_outputPrefix = tempPrefix;
275 
276  // First check to see if we are allowed to send output based upon the
277  // verbose_mask and verbose_level checks
278  if ( ((output_bits & ~m_verboseMask) == 0) && (output_level <= m_verboseLevel) ) {
279  // Get the argument list and then print it out
280  va_start(arg, format);
281  outputprintf(line, file, func, format, arg);
282  va_end(arg);
283  }
284 
285  m_outputPrefix = normalPrefix;
286  }
287  }
288 
289  /** Output the debug message with formatting as specified by the format
290  parameter. Output will only occur if specified output_level and
291  output_bits meet criteria defined by object. The output will be
292  prepended with the expanded prefix set in the object.
293  @param tempPrefix For just this call use this prefix
294  @param line Line number of calling function (use CALL_INFO macro)
295  @param file File name calling function (use CALL_INFO macro)
296  @param func Function name calling function (use CALL_INFO macro)
297  @param output_level For output to occur, output_level must be less than
298  or equal to verbose_level set in object
299  @param output_bits The Output object will only output the
300  message if the set bits of the output_bits parameter are set in
301  the verbose_mask of the object. It uses this logic:
302  if (~verbose_mask & output_bits == 0) then output is enabled.
303  @param format Format string. All valid formats for printf are available.
304  @param ... Arguments for format.
305  */
306  void debugPrefix(const char* UNUSED(tempPrefix), uint32_t UNUSED(line), const char* UNUSED(file),
307  const char* UNUSED(func), uint32_t UNUSED(output_level), uint32_t UNUSED(output_bits),
308  const char* UNUSED(format), ...) __attribute__((format(printf, 8, 9)))
309  {
310 
311 #ifdef __SST_DEBUG_OUTPUT__
312  va_list arg;
313 
314  if ( true == m_objInitialized && NONE != m_targetLoc ) {
315  const std::string normalPrefix = m_outputPrefix;
316  m_outputPrefix = tempPrefix;
317 
318  // First check to see if we are allowed to send output based upon the
319  // verbose_mask and verbose_level checks
320  if ( ((output_bits & ~m_verboseMask) == 0) && (output_level <= m_verboseLevel) ) {
321  // Get the argument list and then print it out
322  va_start(arg, format);
323  outputprintf(line, file, func, format, arg);
324  va_end(arg);
325  }
326 
327  m_outputPrefix = normalPrefix;
328  }
329 #endif
330  }
331 
332  /** Output the debug message with formatting as specified by the format
333  parameter. Output will only occur if specified output_level and
334  output_bits meet criteria defined by object. The output will be
335  prepended with the expanded prefix set in the object.
336  NOTE: Debug outputs will only occur if the __SST_DEBUG_OUTPUT__ is defined.
337  this define can be set in source code or by setting the
338  --enable-debug option during SST configuration.
339  @param line Line number of calling function (use CALL_INFO macro)
340  @param file File name calling function (use CALL_INFO macro)
341  @param func Function name calling function (use CALL_INFO macro)
342  @param output_level For output to occur, output_level must be less than
343  or equal to verbose_level set in object
344  @param output_bits The Output object will only output the
345  message if the set bits of the output_bits parameter are set in
346  the verbose_mask of the object. It uses this logic:
347  if (~verbose_mask & output_bits == 0) then output is enabled.
348  @param format Format string. All valid formats for printf are available.
349  @param ... Arguments for format.
350  */
351  void debug(uint32_t UNUSED(line), const char* UNUSED(file), const char* UNUSED(func), uint32_t UNUSED(output_level),
352  uint32_t UNUSED(output_bits), const char* UNUSED(format), ...) const __attribute__((format(printf, 7, 8)))
353  {
354 #ifdef __SST_DEBUG_OUTPUT__
355  va_list arg;
356  if ( true == m_objInitialized && NONE != m_targetLoc ) {
357  // First check to see if we are allowed to send output based upon the
358  // verbose_mask and verbose_level checks
359  if ( ((output_bits & ~m_verboseMask) == 0) && (output_level <= m_verboseLevel) ) {
360  // Get the argument list and then print it out
361  va_start(arg, format);
362  outputprintf(line, file, func, format, arg);
363  va_end(arg);
364  }
365  }
366 #endif
367  }
368 
369  /** Output the fatal message with formatting as specified by the format
370  parameter. Message will be sent to the output location and to stderr.
371  The output will be prepended with the expanded prefix set
372  in the object.
373  NOTE: fatal() will call MPI_Abort(exit_code) to terminate simulation.
374  @param line Line number of calling function (use CALL_INFO macro)
375  @param file File name calling function (use CALL_INFO macro)
376  @param func Function name calling function (use CALL_INFO macro)
377  @param exit_code The exit code used for termination of simulation.
378  will be passed to MPI_Abort()
379  @param format Format string. All valid formats for printf are available.
380  @param ... Arguments for format.
381  */
382  [[noreturn]]
383  void fatal(uint32_t line, const char* file, const char* func, int exit_code, const char* format, ...) const
384  __attribute__((format(printf, 6, 7)));
385 
386  // GET / SET METHODS
387 
388  /** Sets object prefix
389  @param prefix Prefix to be prepended to all strings emitted by calls to
390  debug(), verbose(), fatal() and possibly output().
391  NOTE: No space will be inserted between the prepended prefix
392  string and the normal output string.
393  Prefix can contain the following escape codes:
394  - \@f Name of the file in which output call was made.
395  - \@l Line number in the file in which output call was made.
396  - \@p Name of the function from which output call was made.
397  - \@r MPI rank of the calling process. Will be empty if
398  MPI_COMM_WORLD size is 1.
399  - \@R MPI rank of the calling process. Will be 0 if
400  MPI_COMM_WORLD size is 1.
401  - \@i Thread Id of the calling process. Will be empty if
402  number of threads is 1.
403  - \@I Thread Id of the calling process. Will be 0 if
404  number of threads is 1.
405  - \@x Rank information of the calling process. Will be empty if
406  number of MPI ranks and number of threads are both 1
407  Same as [\@r:\@i]
408  - \@X Rank information of the calling process. Will be [0.0] if
409  number of MPI ranks and number of threads are both 1
410  Same as [\@R:\@I]
411  - \@t Simulation time. Will be the raw simulation cycle time
412  retrieved from the SST Core.
413  */
414  void setPrefix(const std::string& prefix);
415 
416  /** Returns object prefix */
417  std::string getPrefix() const;
418 
419  /** Sets object verbose mask
420  @param verbose_mask Bitmask of allowed message types for debug(),
421  verbose() and fatal(). The Output object will only output the
422  message if the set bits of the output_bits parameter
423  are set in the verbose_mask of the object. It uses this logic:
424  if (~verbose_mask & output_bits == 0) then output is enabled.
425  */
426  void setVerboseMask(uint32_t verbose_mask);
427 
428  /** Returns object verbose mask */
429  uint32_t getVerboseMask() const;
430 
431  /** Sets object verbose level
432  @param verbose_level Debugging output level. Calls to debug(),
433  verbose() and fatal() are only output if their output_level
434  parameter is less than or equal to the verbose_level currently
435  set for the object
436  */
437  void setVerboseLevel(uint32_t verbose_level);
438 
439  /** Returns object verbose level */
440  uint32_t getVerboseLevel() const;
441 
442  /** Sets object output location
443  @param location Output location. Output will be directed to STDOUT,
444  STDERR, FILE, or NONE. If FILE output is selected, the
445  output will be directed to the file defined by the
446  --debug runtime parameter, or to the file 'sst_output' if the
447  --debug parameter is not defined. If the size of MPI_COMM_WORLD
448  is > 1, then the rank process will be appended to the file name.
449  */
450  void setOutputLocation(output_location_t location);
451 
452  /** Returns object output location */
454 
455  /** This method allows for the manual flushing of the output. */
456  inline void flush() const { std::fflush(*m_targetOutputRef); }
457 
458  /** This method sets the static filename used by SST. It can only be called
459  once, and is automatically called by the SST Core. No components should
460  call this method.
461  */
462  static void setFileName(const std::string& filename);
463 
464  static Output& getDefaultObject() { return m_defaultObject; }
465 
466  void serialize_order(SST::Core::Serialization::serializer& ser);
467 
468 private:
469  friend class TraceFunction;
470  // Support Methods
471  void setTargetOutput(output_location_t location);
472  void openSSTTargetFile() const;
473  void closeSSTTargetFile();
474  // std::string getMPIProcName() const;
475  int getMPIWorldRank() const;
476  int getMPIWorldSize() const;
477  uint32_t getNumThreads() const;
478  uint32_t getThreadRank() const;
479  std::string buildPrefixString(uint32_t line, const std::string& file, const std::string& func) const;
480 
481  void outputprintf(uint32_t line, const std::string& file, const std::string& func, const char* format,
482  va_list arg) const __attribute__((format(printf, 5, 0)));
483 
484  void outputprintf(const char* format, va_list arg) const __attribute__((format(printf, 2, 0)));
485 
486  // Versions of outputprintf that takes variable arguments instead of va_list
487  void outputprintf(uint32_t line, const std::string& file, const std::string& func, const char* format, ...) const
488  __attribute__((format(printf, 5, 6)))
489  {
490  va_list args;
491  va_start(args, format);
492  outputprintf(line, file, func, format, args);
493  va_end(args);
494  }
495 
496  void outputprintf(const char* format, ...) const __attribute__((format(printf, 2, 3)))
497  {
498  va_list args;
499  va_start(args, format);
500  outputprintf(format, args);
501  va_end(args);
502  }
503 
504  friend int ::main(int argc, char** argv);
505  static Output& setDefaultObject(const std::string& prefix, uint32_t verbose_level, uint32_t verbose_mask,
506  output_location_t location, const std::string& localoutputfilename = "")
507  {
508  m_defaultObject.init(prefix, verbose_level, verbose_mask, location, localoutputfilename);
509  return getDefaultObject();
510  }
511 
512  static void setWorldSize(int num_ranks, int num_threads, int mpiRank)
513  {
514  m_worldSize_ranks = num_ranks;
515  m_worldSize_threads = num_threads;
516  m_mpiRank = mpiRank;
517  }
518 
519  static void setThreadID(std::thread::id mach, uint32_t user) { m_threadMap.insert(std::make_pair(mach, user)); }
520 
521  // Internal Member Variables
522  bool m_objInitialized;
523  std::string m_outputPrefix;
524  uint32_t m_verboseLevel;
525  uint32_t m_verboseMask;
526  output_location_t m_targetLoc;
527 
528  static Output m_defaultObject;
529 
530  // m_targetOutputRef is a pointer to a FILE* object. This is because
531  // the actual FILE* object (m_sstFileHandle) is not created on construction,
532  // but during the first call any of output(), verbose() or debug() methods.
533  // m_targetOutputRef points to either &m_sstFileHandle, &stdout, or &stderr
534  // depending upon constructor for the object. However m_sstFileHandle is a
535  // static variable that is set by the startup of SST, and the location
536  // cannot be changed in the constructor or a call to setFileName().
537  std::FILE** m_targetOutputRef;
538 
539  // m_targetFileHandleRef, m_targetFileNameRef, and m_targetFileAccessCount
540  // are pointers to their associated types. These point to either the local
541  // output file information or to the global simulation output file information.
542  std::FILE** m_targetFileHandleRef;
543  std::string* m_targetFileNameRef;
544  uint32_t* m_targetFileAccessCountRef;
545 
546  // Static Member Variables regarding the Global simulation file info
547  static std::string m_sstGlobalSimFileName;
548  static std::FILE* m_sstGlobalSimFileHandle;
549  static uint32_t m_sstGlobalSimFileAccessCount;
550 
551  // File Member Variables regarding the local simulation file info
552  std::string m_sstLocalFileName;
553  std::FILE* m_sstLocalFileHandle;
554  uint32_t m_sstLocalFileAccessCount;
555 
556  static std::unordered_map<std::thread::id, uint32_t> m_threadMap;
557  static int m_worldSize_ranks;
558  static int m_worldSize_threads;
559  // static RankInfo m_worldSize;
560  static int m_mpiRank;
561 };
562 
563 /**
564  Class to easily trace function enter and exit. This class is for
565  temporary use during debugging only and is not part of the SST Core
566  stable API (i.e. the class can change at any time).
567 
568  NOTE: Output for TraceFunction will only be turned on if the
569  SST_TRACEFUNCTION_ACTIVATE envirnoment variable is set.
570 
571  You can also control whether or not an "indent marker" will be used
572  by setting SST_TRACEFUNCTION_INDENT_MARKER. If the environment
573  variable is defined but empty, a | will be used. If the variable
574  isn't empty, it will use the first character as the indent marker.
575  This will look like:
576 
577 static void class1::func1() enter function
578 | static void class1::func2() enter function
579 | static void class1::func2() exit function
580 static void class1::func1() exit function
581 static void class1::func1() enter function
582 | static void class1::func2() enter function
583 | static void class1::func2() exit function
584 static void class1::func1() exit function
585 
586 */
588 {
589  thread_local static int trace_level;
590  thread_local static std::vector<char> indent_array;
591 
592 public:
593  TraceFunction(uint32_t line, const char* file, const char* func, bool print_sim_info = true, bool activate = true);
594  ~TraceFunction();
595 
596  /** Output the message with formatting as specified by the format parameter.
597  @param format Format string. All valid formats for printf are available.
598  @param ... Arguments for format.
599  */
600  void output(const char* format, ...) const __attribute__((format(printf, 2, 3)));
601 
602 private:
603  Output output_obj_;
604  uint32_t line_;
605  std::string file_;
606  std::string function_;
607  int indent_length_;
608  bool active_;
609 
610  // Static to determine if TraceFunction should be active
611  static bool global_active_;
612  static char indent_marker_;
613 };
614 
615 } // namespace SST
616 
617 #endif // SST_CORE_OUTPUT_H
Output object provides consistent method for outputting data to stdout, stderr and/or sst debug file...
Definition: output.h:57
void setVerboseLevel(uint32_t verbose_level)
Sets object verbose level.
Definition: output.cc:103
This class is basically a wrapper for objects to declare the order in which their members should be s...
Definition: serializer.h:42
void setOutputLocation(output_location_t location)
Sets object output location.
Definition: output.cc:139
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.
Definition: output.h:232
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.
Definition: output.cc:156
output_location_t
Choice of output location.
Definition: output.h:62
void debugPrefix(const char *UNUSED(tempPrefix), uint32_t UNUSED(line), const char *UNUSED(file), const char *UNUSED(func), uint32_t UNUSED(output_level), uint32_t UNUSED(output_bits), const char *UNUSED(format),...)
Output the debug message with formatting as specified by the format parameter.
Definition: output.h:306
void setVerboseMask(uint32_t verbose_mask)
Sets object verbose mask.
Definition: output.cc:115
Output()
Default Constructor.
Definition: output.cc:60
Definition: output.h:63
Definition: action.cc:18
void flush() const
This method allows for the manual flushing of the output.
Definition: output.h:456
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.
Definition: output.h:266
Definition: output.h:66
void debug(uint32_t UNUSED(line), const char *UNUSED(file), const char *UNUSED(func), uint32_t UNUSED(output_level), uint32_t UNUSED(output_bits), const char *UNUSED(format),...) const
Output the debug message with formatting as specified by the format parameter.
Definition: output.h:351
Class to easily trace function enter and exit.
Definition: output.h:587
static void setFileName(const std::string &filename)
This method sets the static filename used by SST.
Definition: output.cc:217
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.
Definition: output.h:189
output_location_t getOutputLocation() const
Returns object output location.
Definition: output.cc:149
Definition: output.h:64
Definition: output.h:65
uint32_t getVerboseLevel() const
Returns object verbose level.
Definition: output.cc:109
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.
Definition: output.cc:73
uint32_t getVerboseMask() const
Returns object verbose mask.
Definition: output.cc:121
void setPrefix(const std::string &prefix)
Sets object prefix.
Definition: output.cc:127
std::string getPrefix() const
Returns object prefix.
Definition: output.cc:133
void output(const char *format,...) const
Output the message with formatting as specified by the format parameter.
Definition: output.h:205
void output(const char *format,...) const
Output the message with formatting as specified by the format parameter.
Definition: output.cc:574