[profiler] Add + prefix to file names to append the pid. This makes enabling it with...
authorRodrigo Kumpera <kumpera@gmail.com>
Mon, 12 Jun 2017 23:36:53 +0000 (16:36 -0700)
committerRodrigo Kumpera <kumpera@gmail.com>
Tue, 13 Jun 2017 19:52:53 +0000 (12:52 -0700)
mono/profiler/log-args.c
mono/profiler/log.c

index af647a0524179db38b1448997761cfbab346a3b0..fbbafd4dbce8f8e85994d5f43cfdb033d0ded64e 100644 (file)
@@ -314,6 +314,7 @@ usage (void)
        printf ("\tmaxframes=NUM        collect up to NUM stack frames\n");
        printf ("\tcalldepth=NUM        ignore method events for call chain depth bigger than NUM\n");
        printf ("\toutput=FILENAME      write the data to file FILENAME (The file is always overwriten)\n");
+       printf ("\toutput=+FILENAME     write the data to file FILENAME.pid (The file is always overwriten)\n");
        printf ("\toutput=|PROGRAM      write the data to the stdin of PROGRAM\n");
        printf ("\t                     %%t is subtituted with date and time, %%p with the pid\n");
        printf ("\treport               create a report instead of writing the raw data to a file\n");
index 95f2d809e60cb4517ba12d1f4c413003415555b3..3c8e8a8d8ca7c42a1b5bed44603d4bacc2112074 100644 (file)
@@ -4512,6 +4512,12 @@ create_profiler (const char *args, const char *filename, GPtrArray *filters)
                filename++;
                g_warning ("WARNING: the output:-FILENAME option is deprecated, the profiler now always overrides the output file\n");
        }
+
+       //If filename begin with +, append the pid at the end
+       if (filename && *filename == '+')
+               filename = g_strdup_printf ("%s.%d", filename + 1, getpid ());
+
+
        if (!filename) {
                if (do_report)
                        filename = "|mprof-report -";