[XRay][compiler-rt] Reduce XRay log spam
authorDean Michael Berris <dberris@google.com>
Wed, 13 Dec 2017 06:37:13 +0000 (06:37 +0000)
committerDean Michael Berris <dberris@google.com>
Wed, 13 Dec 2017 06:37:13 +0000 (06:37 +0000)
This change makes XRay print the log file output only when the verbosity
level is higher than 0. It reduces the log spam in the default case when
we want XRay running silently, except when there are actual
fatal/serious errors.

We also update the documentation to show how to get the information
after the change to the default behaviour.

llvm-svn: 320550

compiler-rt/lib/xray/xray_utils.cc
llvm/docs/XRay.rst
llvm/docs/XRayExample.rst

index b9a38d1b98eb432f8168dc790e2b2e26f5634e7c..cf800d3aeaf88d67c1748772e3b6c56d8172f345 100644 (file)
@@ -117,7 +117,8 @@ int getLogFD() XRAY_NEVER_INSTRUMENT {
            TmpFilename);
     return -1;
   }
-  Report("XRay: Log file in '%s'\n", TmpFilename);
+  if (__sanitizer::Verbosity())
+    Report("XRay: Log file in '%s'\n", TmpFilename);
 
   return Fd;
 }
index 942b479af749c940eec465208c05ca40f8a7df1c..ebf0256783057bc95a5686b99f21528ed3b9ae51 100644 (file)
@@ -164,6 +164,9 @@ variable, where we list down the options and their defaults below.
 |                   |                 |               | Data Recorder          |
 |                   |                 |               | (FDR) mode.            |
 +-------------------+-----------------+---------------+------------------------+
+| verbosity         | ``int``         | ``0``         | Runtime verbosity      |
+|                   |                 |               | level.                 |
++-------------------+-----------------+---------------+------------------------+
 
 
 If you choose to not use the default logging implementation that comes with the
index 9f74442bcebe962b21e5b77ec2a243af80b727c7..f8e7d943fedd5b8ec57784bed337880345148e05 100644 (file)
@@ -60,7 +60,7 @@ to enable XRay at application start. To do this, XRay checks the
   $ ./bin/llc input.ll
 
   # We need to set the XRAY_OPTIONS to enable some features.
-  $ XRAY_OPTIONS="patch_premain=true xray_mode=xray-basic" ./bin/llc input.ll
+  $ XRAY_OPTIONS="patch_premain=true xray_mode=xray-basic verbosity=1" ./bin/llc input.ll
   ==69819==XRay: Log file in 'xray-log.llc.m35qPB'
 
 At this point we now have an XRay trace we can start analysing.