diff options
author | Eric Fiselier <eric@efcs.ca> | 2016-08-02 15:12:43 -0600 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2016-08-02 15:12:43 -0600 |
commit | 44128d87d2846fc20d540ef41eda6da9ffbb6aba (patch) | |
tree | 5464a5accffa01f6401ab603a6a45fa0361fa334 /src/colorprint.cc | |
parent | f68e64c60a6b20a1f50046df58111107a09fd6a3 (diff) | |
download | google-benchmark-44128d87d2846fc20d540ef41eda6da9ffbb6aba.tar.gz |
Add --benchmark_out=<filename> and --benchmark_out_format=<format> options.
These options allow you to write the output of a benchmark to the specified
file and with the specified format. The goal of this change is to help support
tooling.
Diffstat (limited to 'src/colorprint.cc')
-rw-r--r-- | src/colorprint.cc | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/colorprint.cc b/src/colorprint.cc index efb8626..b7d316f 100644 --- a/src/colorprint.cc +++ b/src/colorprint.cc @@ -20,7 +20,6 @@ #include <string> #include <memory> -#include "commandlineflags.h" #include "check.h" #include "internal_macros.h" @@ -28,8 +27,6 @@ #include <Windows.h> #endif -DECLARE_bool(color_print); - namespace benchmark { namespace { #ifdef BENCHMARK_OS_WINDOWS @@ -120,14 +117,14 @@ std::string FormatString(const char *msg, ...) { void ColorPrintf(std::ostream& out, LogColor color, const char* fmt, ...) { va_list args; va_start(args, fmt); + ColorPrintf(out, color, fmt, args); + va_end(args); +} - if (!FLAGS_color_print) { - out << FormatString(fmt, args); - va_end(args); - return; - } - +void ColorPrintf(std::ostream& out, LogColor color, const char* fmt, va_list args) { #ifdef BENCHMARK_OS_WINDOWS + ((void)out); // suppress unused warning + const HANDLE stdout_handle = GetStdHandle(STD_OUTPUT_HANDLE); // Gets the current text color. @@ -152,7 +149,6 @@ void ColorPrintf(std::ostream& out, LogColor color, const char* fmt, ...) { out << FormatString(fmt, args) << "\033[m"; #endif - va_end(args); } } // end namespace benchmark |