summaryrefslogtreecommitdiff
path: root/rts/RtsFlags.c
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2018-11-02 14:24:12 -0400
committerBen Gamari <ben@smart-cactus.org>2018-11-02 17:13:03 -0400
commit5f81952e230fef1f65ae473e09d44101c489c483 (patch)
tree67213bfee6bc8a8231745c835553187dae376de2 /rts/RtsFlags.c
parent118fca7fe413c3cf986cd07b8694917fde190a3b (diff)
downloadhaskell-5f81952e230fef1f65ae473e09d44101c489c483.tar.gz
rts: Allow output filename of eventlog to be given by command-line
This introduces the `+RTS -ol` flag, which allows user to specify the destination file for eventlog output. Test Plan: Validate with included test Reviewers: simonmar, erikd Reviewed By: simonmar Subscribers: rwbarton, carter Differential Revision: https://phabricator.haskell.org/D5293
Diffstat (limited to 'rts/RtsFlags.c')
-rw-r--r--rts/RtsFlags.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c
index 6a72e67859..0aa0b623e7 100644
--- a/rts/RtsFlags.c
+++ b/rts/RtsFlags.c
@@ -219,6 +219,7 @@ void initRtsFlagsDefaults(void)
RtsFlags.TraceFlags.sparks_sampled= false;
RtsFlags.TraceFlags.sparks_full = false;
RtsFlags.TraceFlags.user = false;
+ RtsFlags.TraceFlags.trace_output = NULL;
#endif
#if defined(PROFILING)
@@ -349,7 +350,8 @@ usage_text[] = {
#if defined(TRACING)
"",
-" -l[flags] Log events in binary format to the file <program>.eventlog",
+" -ol<file> Send binary eventlog to <file> (default: <program>.eventlog)",
+" -l[flags] Log events to a file",
# if defined(DEBUG)
" -v[flags] Log events to stderr",
# endif
@@ -1434,7 +1436,30 @@ error = true;
}
) break;
- /* =========== TRACING ---------=================== */
+ /* =========== OUTPUT ============================ */
+
+ case 'o':
+ switch(rts_argv[arg][2]) {
+ case 'l':
+ OPTION_SAFE;
+ TRACING_BUILD_ONLY(
+ if (strlen(&rts_argv[arg][3]) == 0) {
+ errorBelch("-ol expects filename");
+ error = true;
+ } else {
+ RtsFlags.TraceFlags.trace_output =
+ strdup(&rts_argv[arg][3]);
+ }
+ );
+ break;
+
+ default:
+ errorBelch("Unknown output flag -o%c", rts_argv[arg][2]);
+ error = true;
+ }
+ break;
+
+ /* =========== TRACING ============================ */
case 'l':
OPTION_SAFE;