\f[I]calls\f[] enables method enter/leave events if they were
disabled by another option like \f[I]heapshot\f[].
.IP \[bu] 2
-\f[I]heapshot\f[]: collect heap shot data at each major collection.
+\f[I]heapshot[=MODE]\f[]: collect heap shot data at each major
+collection.
The frequency of the heap shots can be changed with the
-\f[I]hsmode\f[] option below.
+\f[I]MODE\f[] parameter.
When this option is used allocation events and method enter/leave
events are not recorded by default: if they are needed, they need
to be enabled explicitly.
-.IP \[bu] 2
-\f[I]hsmode=MODE\f[]: modify the default heap shot frequency
-according to MODE.
-hsmode can be used multiple times with different modes: in that
+The optional parameter \f[I]MODE\f[] can modify the default heap
+shot frequency.
+heapshot can be used multiple times with different modes: in that
case a heap shot is taken if either of the conditions are met.
MODE can be one of:
.RS 2
format.
.IP \[bu] 2
\f[I]output=OUTSPEC\f[]: instead of writing the profiling data to
-the output.mlpd file, do according to \f[I]OUTSPEC\f[]:
+the output.mlpd file, substitute \f[I]%p\f[] in \f[I]OUTSPEC\f[]
+with the current process id and \f[I]%t\f[] with the current date
+and time, then do according to \f[I]OUTSPEC\f[]:
.RS 2
.IP \[bu] 2
if \f[I]OUTSPEC\f[] begins with a \f[I]|\f[] character, execute the
rest as a program and feed the data to its standard input
.IP \[bu] 2
-otherwise write the data the the named file
+if \f[I]OUTSPEC\f[] begins with a \f[I]-\f[] character, use the
+rest of OUTSPEC as the filename, but force overwrite any existing
+file by that name
+.IP \[bu] 2
+otherwise write the data the the named file: note that is a file by
+that name already exists, a warning is issued and profiling is
+disabled.
.RE
.IP \[bu] 2
\f[I]report\f[]: the profiling data is sent to mprof-report, which
will print a summary report.
This is equivalent to the option: \f[B]output=mprof-report\ -\f[].
+If the \f[I]output\f[] option is specified as well, the report will
+be written to the output file instead of the console.
.SS Analyzing the profile data
.PP
Currently there is a command line program (\f[I]mprof-report\f[])
The other major source of data is the heapshot profiler option:
especially if the managed heap is big, since every object needs to
be inspected.
-The \f[I]hsmode\f[] option can be used to reduce the frequency of
-the heap shots.
+The \f[I]MODE\f[] parameter of the \f[I]heapshot\f[] option can be
+used to reduce the frequency of the heap shots.
.SS Reduce the timestamp overhead
.PP
On many operating systems or architectures what actually slows down
.PP
Heap shot data can also be huge: by default it is collected at each
major collection.
-To reduce the frequency, you can use the \f[I]hsmode\f[] profiler
-option to collect for example every 5 collections (including major
-and minor):
+To reduce the frequency, you can specify a heapshot mode: for
+example to collect every 5 collections (including major and minor):
.PP
-\f[B]hsmode=5gc\f[]
+\f[B]heapshot=5gc\f[]
.PP
or when at least 5 seconds passed since the last heap shot:
.PP
-\f[B]hsmode=5000ms\f[]
+\f[B]heapshot=5000ms\f[]
.SS Compressing the data
.PP
To reduce the amout of disk space used by the data, the data can be
control this behaviour. *calls* enables method enter/leave events if they were disabled
by another option like *heapshot*.
-* *heapshot*: collect heap shot data at each major collection. The frequency of the
-heap shots can be changed with the *hsmode* option below. When this option is used
+* *heapshot[=MODE]*: collect heap shot data at each major collection. The frequency of the
+heap shots can be changed with the *MODE* parameter. When this option is used
allocation events and method enter/leave events are not recorded by default: if they
are needed, they need to be enabled explicitly.
-
-* *hsmode=MODE*: modify the default heap shot frequency according to MODE.
-hsmode can be used multiple times with different modes: in that case a heap shot is
+The optional parameter *MODE* can modify the default heap shot frequency.
+heapshot can be used multiple times with different modes: in that case a heap shot is
taken if either of the conditions are met.
MODE can be one of:
* *NUM*ms: perform a heap shot if at least *NUM* milliseconds passed since
completely, by setting it to 0.
The other major source of data is the heapshot profiler option: especially
-if the managed heap is big, since every object needs to be inspected. The *hsmode*
-option can be used to reduce the frequency of the heap shots.
+if the managed heap is big, since every object needs to be inspected. The *MODE*
+parameter of the *heapshot* option can be used to reduce the frequency of the heap
+shots.
### Reduce the timestamp overhead
Allocation events can be eliminated with the *noalloc* option.
Heap shot data can also be huge: by default it is collected at each major collection.
-To reduce the frequency, you can use the *hsmode* profiler option to collect for example
+To reduce the frequency, you can specify a heapshot mode: for example to collect
every 5 collections (including major and minor):
-`hsmode=5gc`
+`heapshot=5gc`
or when at least 5 seconds passed since the last heap shot:
-`hsmode=5000ms`
+`heapshot=5000ms`
### Compressing the data
printf ("\thelp show this usage info\n");
printf ("\t[no]alloc enable/disable recording allocation info\n");
printf ("\t[no]calls enable/disable recording enter/leave method events\n");
- printf ("\theapshot record heap shot info (by default at each major collection)\n");
- printf ("\thsmode=MODE heapshot mode: every XXms milliseconds or every YYgc collections\n");
+ printf ("\theapshot[=MODE] record heap shot info (by default at each major collection)\n");
+ printf ("\t heapshot MODE: every XXms milliseconds or every YYgc collections\n");
printf ("\ttime=fast use a faster (but more inaccurate) timer\n");
printf ("\tmaxframes=NUM collect up to NUM stack frames\n");
printf ("\tcalldepth=NUM ignore method events for call chain depth bigger than NUM\n");
*rval = val;
return opt + l;
}
+ if (p [len] == 0 || p [len] == ',') {
+ *rval = NULL;
+ return p + len + (p [len] == ',');
+ }
usage (1);
} else {
if (p [len] == 0)
return p;
}
+static void
+set_hsmode (char* val, int allow_empty)
+{
+ char *end;
+ unsigned int count;
+ if (allow_empty && !val)
+ return;
+ count = strtoul (val, &end, 10);
+ if (val == end)
+ usage (1);
+ if (strcmp (end, "ms") == 0)
+ hs_mode_ms = count;
+ else if (strcmp (end, "gc") == 0)
+ hs_mode_gc = count;
+ else
+ usage (1);
+ free (val);
+}
+
/*
* declaration to silence the compiler: this is the entry point that
* mono will load from the shared library and call.
do_report = 1;
continue;
}
- if ((opt = match_option (p, "heapshot", NULL)) != p) {
+ if ((opt = match_option (p, "heapshot", &val)) != p) {
events &= ~MONO_PROFILE_ALLOCATIONS;
events &= ~MONO_PROFILE_ENTER_LEAVE;
nocalls = 1;
do_heap_shot = 1;
+ set_hsmode (val, 1);
continue;
}
if ((opt = match_option (p, "hsmode", &val)) != p) {
- char *end;
- unsigned int count = strtoul (val, &end, 10);
- if (val == end)
- usage (1);
- if (strcmp (end, "ms") == 0)
- hs_mode_ms = count;
- else if (strcmp (end, "gc") == 0)
- hs_mode_gc = count;
- else
- usage (1);
- free (val);
+ fprintf (stderr, "The hsmode profiler option is obsolete, use heapshot=MODE.\n");
+ set_hsmode (val, 0);
continue;
}
if ((opt = match_option (p, "zip", NULL)) != p) {