25 #ifndef GALOIS_RUNTIME_TRACER_H
26 #define GALOIS_RUNTIME_TRACER_H
31 #include "galois/config.h"
43 static inline void traceImpl(std::ostringstream& os) { os <<
"\n"; }
48 template <
typename T,
typename... Args>
49 static inline void traceImpl(std::ostringstream& os, T&&, Args&&... args) {
51 traceImpl(os, std::forward<Args>(args)...);
57 static inline void traceFormatImpl(std::ostringstream& os,
const char* format) {
64 template <
typename T,
typename... Args>
65 static inline void traceFormatImpl(std::ostringstream& os,
const char* format,
66 T&& value, Args&&... args) {
67 for (; *format !=
'\0'; format++) {
70 traceFormatImpl(os, format + 1, std::forward<Args>(args)...);
86 void print(std::ostream& os)
const {
87 os <<
"< " << v.size() <<
" : ";
98 std::ostream& operator<<(std::ostream& os, const vecPrinter<T>& vp) {
106 void printTrace(std::ostringstream&);
111 void print_output_impl(std::ostringstream&);
114 extern bool initTrace;
122 template <
typename T>
124 return internal::vecPrinter<T>(v);
131 template <
typename... Args>
132 static inline void trace(Args&&...) {}
134 template <
typename... Args>
135 static inline void trace(Args&&... args) {
136 if (!internal::initTrace) {
138 internal::initTrace =
true;
140 if (internal::doTrace) {
141 std::ostringstream os;
142 internal::traceImpl(os, std::forward<Args>(args)...);
143 internal::printTrace(os);
154 template <
typename... Args>
155 static inline void printOutput(
const char* format, Args&&... args) {
156 std::ostringstream os;
157 internal::traceFormatImpl(os, format, std::forward<Args>(args)...);
158 internal::print_output_impl(os);
bool EnvCheck(const char *varName)
Return true if the Enviroment variable is set.
Definition: EnvCheck.cpp:24
internal::vecPrinter< T > printVec(const galois::PODResizeableArray< T > &v)
Given a vector, returns a vector printer object that is able to print the vector out onto an output s...
Definition: Tracer.h:123
This is a container that encapsulates a resizeable array of plain-old-datatype (POD) elements...
Definition: PODResizeableArray.h:40