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