MoreDocs
[mono.git] / man / mono.1
1 .\" 
2 .\" mono manual page.
3 .\" Copyright 2003 Ximian, Inc. 
4 .\" Copyright 2004-2009 Novell, Inc. 
5 .\" Author:
6 .\"   Miguel de Icaza (miguel@gnu.org)
7 .\"
8 .TH Mono "Mono 2.5"
9 .SH NAME
10 mono \- Mono's ECMA-CLI native code generator (Just-in-Time and Ahead-of-Time)
11 .SH SYNOPSIS
12 .PP
13 .B mono [options] file [arguments...]
14 .SH DESCRIPTION
15 \fImono\fP is a runtime implementation of the ECMA Common Language
16 Infrastructure.  This can be used to run ECMA and .NET applications.
17 .PP
18 The runtime contains a native code generator that transforms the
19 Common Intermediate Language into native code.
20 .PP
21 The code generator can operate in two modes: just in time compilation
22 (JIT) or ahead of time compilation (AOT).  Since code can be
23 dynamically loaded, the runtime environment and the JIT are always
24 present, even if code is compiled ahead of time.
25 .PP
26 The runtime loads the specified
27 .I file
28 and optionally passes
29 the
30 .I arguments
31 to it.  The 
32 .I file
33 is an ECMA assembly.  They typically have a .exe or .dll extension.
34 .PP
35 The runtime provides a number of configuration options for running
36 applications, for developing and debugging, and for testing and
37 debugging the runtime itself.
38 .SH PORTABILITY
39 On Unix-based systems, Mono provides a mechanism to emulate the 
40 Windows-style file access, this includes providing a case insensitive
41 view of the file system, directory separator mapping (from \\ to /) and
42 stripping the drive letters.
43 .PP
44 This functionality is enabled by setting the 
45 .B MONO_IOMAP 
46 environment variable to one of 
47 .B all, drive
48 and 
49 .B case.
50 .PP
51 See the description for 
52 .B MONO_IOMAP
53 in the environment variables section for more details.
54 .SH RUNTIME OPTIONS
55 The following options are available:
56 .TP
57 \fB--aot\fR, \fB--aot[=options]\fR
58 This option is used to precompile the CIL code in the specified
59 assembly to native code.  The generated code is stored in a file with
60 the extension .so.  This file will be automatically picked up by the
61 runtime when the assembly is executed.  
62 .Sp 
63 Ahead-of-Time compilation is most useful if you use it in combination
64 with the -O=all,-shared flag which enables all of the optimizations in
65 the code generator to be performed.  Some of those optimizations are
66 not practical for Just-in-Time compilation since they might be very
67 time consuming.
68 .Sp
69 Unlike the .NET Framework, Ahead-of-Time compilation will not generate
70 domain independent code: it generates the same code that the
71 Just-in-Time compiler would produce.   Since most applications use a
72 single domain, this is fine.   If you want to optimize the generated
73 code for use in multi-domain applications, consider using the
74 -O=shared flag.
75 .Sp
76 This pre-compiles the methods, but the original assembly is still
77 required to execute as this one contains the metadata and exception
78 information which is not available on the generated file.  When
79 precompiling code, you might want to compile with all optimizations
80 (-O=all).  Pre-compiled code is position independent code.
81 .Sp
82 Pre compilation is just a mechanism to reduce startup time, increase
83 code sharing across multiple mono processes and avoid just-in-time
84 compilation program startup costs.  The original assembly must still
85 be present, as the metadata is contained there.
86 .Sp
87 AOT code typically can not be moved from one computer to another
88 (CPU-specific optimizations that are detected at runtime) so you
89 should not try to move the pre-generated assemblies or package the
90 pre-generated assemblies for deployment.    
91 .Sp
92 A few options are available as a parameter to the 
93 .B --aot 
94 command line option.   The options are separated by commas, and more
95 than one can be specified:
96 .RS
97 .ne 8
98 .TP
99 .I bind-to-runtime-version
100 .Sp
101 If specified, forces the generated AOT files to be bound to the
102 runtime version of the compiling Mono.   This will prevent the AOT
103 files from being consumed by a different Mono runtime.
104 .I full
105 This is currently an experimental feature as it is not complete.
106 This instructs Mono to precompile code that has historically not been
107 precompiled with AOT.   
108 .TP
109 .I write-symbols
110 Instructs the AOT compiler to emit debug symbol information.
111 .TP
112 .I soft-debug
113 This instructs the compiler to generate sequence point checks that
114 allow Mono's soft debugger to debug applications even on systems where
115 it is not possible to set breakpoints or to single step (certain
116 hardware configurations like the cell phones and video gaming
117 consoles). 
118 .TP
119 .I static
120 Create an ELF object file (.o) which can be statically linked into an executable
121 when embedding the mono runtime. When this option is used, the object file needs to
122 be registered with the embedded runtime using the mono_aot_register_module function
123 which takes as its argument the mono_aot_module_<ASSEMBLY NAME>_info global symbol 
124 from the object file:
125
126 .nf
127 extern void *mono_aot_module_hello_info;
128
129 mono_aot_register_module (mono_aot_module_hello_info);
130 .fi
131 .ne
132
133 .PP
134 For more information about AOT, see: http://www.mono-project.com/AOT
135 .RE
136 .TP
137 \fB--attach=[options]\fR
138 Currently the only option supported by this command line argument is
139 \fBdisable\fR which disables the attach functionality.
140 .TP
141 \fB--full-aot\fR
142 This is an experimental flag that instructs the Mono runtime to not
143 generate any code at runtime and depend exclusively on the code
144 generated from using mono --aot=full previously.   This is useful for
145 platforms that do not permit dynamic code generation.
146 .Sp
147 Notice that this feature will abort execution at runtime if a codepath
148 in your program, or Mono's class libraries attempts to generate code
149 dynamically.  You should test your software upfront and make sure that
150 you do not use any dynamic features.
151 .TP
152 \fB--config filename\fR
153 Load the specified configuration file instead of the default one(s).
154 The default files are /etc/mono/config and ~/.mono/config or the file
155 specified in the MONO_CONFIG environment variable, if set.  See the
156 mono-config(5) man page for details on the format of this file.
157 .TP
158 \fB--debugger-agent=[options]\fR 
159 This instructs the Mono runtime to
160 start a debugging agent inside the Mono runtime and connect it to a
161 client user interface will control the Mono process.
162 This option is typically used by IDEs, like the MonoDevelop IDE.
163 .PP
164 The
165 configuration is specified using one of more of the following options:
166 .RS
167 .ne 8
168 .TP
169 .I transport=transport_name
170 .Sp
171 This is used to specify the transport that the debugger will use to
172 communicate.   It must be specified and currently requires this to
173 be 'dt_socket'. 
174 .TP
175 .I address=host:port
176 .Sp
177 Use this option to specify the IP address where your debugger client is
178 listening to.
179 .TP
180 .I loglevel=LEVEL
181 .Sp
182 Specifies the diagnostics log level for 
183 .TP
184 .I logfile=filename
185 .Sp
186 Used to specify the file where the log will be stored, it defaults to
187 standard output.
188 .ne
189 .RE
190 .TP
191 \fB--desktop\fR
192 Configures the virtual machine to be better suited for desktop
193 applications.  Currently this sets the GC system to avoid expanding
194 the heap as much as possible at the expense of slowing down garbage
195 collection a bit.
196 .TP
197 \fB--help\fR, \fB-h\fR
198 Displays usage instructions.
199 .TP
200 \fB--optimize=MODE\fR, \fB-O=MODE\fR
201 MODE is a comma separated list of optimizations.  They also allow
202 optimizations to be turned off by prefixing the optimization name with
203 a minus sign.
204 .Sp
205 In general, Mono has been tuned to use the default set of flags,
206 before using these flags for a deployment setting, you might want to
207 actually measure the benefits of using them.    
208 .Sp
209 The following optimizations are implemented:
210 .nf
211              all        Turn on all optimizations
212              peephole   Peephole postpass
213              branch     Branch optimizations
214              inline     Inline method calls
215              cfold      Constant folding
216              consprop   Constant propagation
217              copyprop   Copy propagation
218              deadce     Dead code elimination
219              linears    Linear scan global reg allocation
220              cmov       Conditional moves [arch-dependency]
221              shared     Emit per-domain code
222              sched      Instruction scheduling
223              intrins    Intrinsic method implementations
224              tailc      Tail recursion and tail calls
225              loop       Loop related optimizations
226              fcmov      Fast x86 FP compares [arch-dependency]
227              leaf       Leaf procedures optimizations
228              aot        Usage of Ahead Of Time compiled code
229              precomp    Precompile all methods before executing Main
230              abcrem     Array bound checks removal
231              ssapre     SSA based Partial Redundancy Elimination
232              sse2       SSE2 instructions on x86 [arch-dependency]
233              gshared    Enable generic code sharing.
234 .fi
235 .Sp
236 For example, to enable all the optimization but dead code
237 elimination and inlining, you can use:
238 .nf
239         -O=all,-deadce,-inline
240 .fi
241 .Sp
242 The flags that are flagged with [arch-dependency] indicate that the
243 given option if used in combination with Ahead of Time compilation
244 (--aot flag) would produce pre-compiled code that will depend on the
245 current CPU and might not be safely moved to another computer. 
246 .TP
247 \fB--runtime=VERSION\fR
248 Mono supports different runtime versions. The version used depends on the program
249 that is being run or on its configuration file (named program.exe.config). This option
250 can be used to override such autodetection, by forcing a different runtime version
251 to be used. Note that this should only be used to select a later compatible runtime
252 version than the one the program was compiled against. A typical usage is for
253 running a 1.1 program on a 2.0 version:
254 .nf
255          mono --runtime=v2.0.50727 program.exe
256 .fi
257 .TP
258 \fB--security\fR, \fB--security=mode\fR
259 Activate the security manager, a currently experimental feature in
260 Mono and it is OFF by default. The new code verifier can be enabled
261 with this option as well.
262 .RS
263 .ne 8
264 .PP
265 Using security without parameters is equivalent as calling it with the
266 "cas" parameter.  
267 .PP
268 The following modes are supported:
269 .TP
270 .I cas
271 This allows mono to support declarative security attributes,
272 e.g. execution of Code Access Security (CAS) or non-CAS demands.
273 .TP 
274 .I core-clr
275 Enables the core-clr security system, typically used for
276 Moonlight/Silverlight applications.  It provides a much simpler
277 security system than CAS, see http://www.mono-project.com/Moonlight
278 for more details and links to the descriptions of this new system. 
279 .TP
280 .I validil
281 Enables the new verifier and performs basic verification for code
282 validity.  In this mode, unsafe code and P/Invoke are allowed. This
283 mode provides a better safety guarantee but it is still possible
284 for managed code to crash Mono. 
285 .TP
286 .I verifiable
287 Enables the new verifier and performs full verification of the code
288 being executed.  It only allows verifiable code to be executed.
289 Unsafe code is not allowed but P/Invoke is.  This mode should
290 not allow managed code to crash mono.  The verification is not as
291 strict as ECMA 335 standard in order to stay compatible with the MS
292 runtime.
293 .PP
294 The security system acts on user code: code contained in mscorlib or
295 the global assembly cache is always trusted.
296 .ne
297 .RE
298 .TP
299 \fB--server\fR
300 Configures the virtual machine to be better suited for server
301 operations (currently, a no-op).
302 .TP
303 \fB--verify-all\fR 
304 Verifies mscorlib and assemblies in the global
305 assembly cache for valid IL, and all user code for IL
306 verifiability. 
307
308 This is different from \fB--security\fR's verifiable
309 or validil in that these options only check user code and skip
310 mscorlib and assemblies located on the global assembly cache.
311 .TP
312 \fB-V\fR, \fB--version\fR
313 Prints JIT version information (system configuration, release number
314 and branch names if available). 
315
316
317 .SH DEVELOPMENT OPTIONS
318 The following options are used to help when developing a JITed application.
319 .TP
320 \fB--debug\fR, \fB--debug=OPTIONS\fR
321 Turns on the debugging mode in the runtime.  If an assembly was
322 compiled with debugging information, it will produce line number
323 information for stack traces. 
324 .RS
325 .ne 8
326 .PP
327 The optional OPTIONS argument is a comma separated list of debugging
328 options.  These options are turned off by default since they generate
329 much larger and slower code at runtime.
330 .TP
331 The following options are supported:
332 .TP
333 .I casts
334 Produces a detailed error when throwing a InvalidCastException.   This
335 option needs to be enabled as this generates more verbose code at
336 execution time. 
337 .TP
338 .I mdb-optimizations
339 Disable some JIT optimizations which are usually only disabled when
340 running inside the debugger.  This can be helpful if you want to attach
341 to the running process with mdb.
342 .TP
343 .I gdb
344 Generate and register debugging information with gdb. This is only supported on some
345 platforms, and only when using gdb 7.0 or later.
346 .ne
347 .RE
348 .TP
349 \fB--profile[=profiler[:profiler_args]]\fR
350 Turns on profiling.  For more information about profiling applications
351 and code coverage see the sections "PROFILING" and "CODE COVERAGE"
352 below. 
353 .TP
354 \fB--trace[=expression]\fR
355 Shows method names as they are invoked.  By default all methods are
356 traced. 
357 .Sp
358 The trace can be customized to include or exclude methods, classes or
359 assemblies.  A trace expression is a comma separated list of targets,
360 each target can be prefixed with a minus sign to turn off a particular
361 target.  The words `program', `all' and `disabled' have special
362 meaning.  `program' refers to the main program being executed, and
363 `all' means all the method calls.
364 .Sp
365 The `disabled' option is used to start up with tracing disabled.  It
366 can be enabled at a later point in time in the program by sending the
367 SIGUSR2 signal to the runtime.
368 .Sp
369 Assemblies are specified by their name, for example, to trace all
370 calls in the System assembly, use:
371 .nf
372
373         mono --trace=System app.exe
374
375 .fi
376 Classes are specified with the T: prefix.  For example, to trace all
377 calls to the System.String class, use:
378 .nf
379
380         mono --trace=T:System.String app.exe
381
382 .fi
383 And individual methods are referenced with the M: prefix, and the
384 standard method notation:
385 .nf
386
387         mono --trace=M:System.Console:WriteLine app.exe
388
389 .fi
390 As previously noted, various rules can be specified at once:
391 .nf
392
393         mono --trace=T:System.String,T:System.Random app.exe
394
395 .fi
396 You can exclude pieces, the next example traces calls to
397 System.String except for the System.String:Concat method.
398 .nf
399
400         mono --trace=T:System.String,-M:System.String:Concat
401
402 .fi
403 Finally, namespaces can be specified using the N: prefix:
404 .nf
405
406         mono --trace=N:System.Xml
407
408 .fi
409 .TP
410 \fB--no-x86-stack-align\fR
411 Don't align stack frames on the x86 architecture.  By default, Mono
412 aligns stack frames to 16 bytes on x86, so that local floating point
413 and SIMD variables can be properly aligned.  This option turns off the
414 alignment, which usually saves one intruction per call, but might
415 result in significantly lower floating point and SIMD performance.
416 .SH JIT MAINTAINER OPTIONS
417 The maintainer options are only used by those developing the runtime
418 itself, and not typically of interest to runtime users or developers.
419 .TP
420 \fB--break method\fR
421 Inserts a breakpoint before the method whose name is `method'
422 (namespace.class:methodname).  Use `Main' as method name to insert a
423 breakpoint on the application's main method.
424 .TP
425 \fB--breakonex\fR
426 Inserts a breakpoint on exceptions.  This allows you to debug your
427 application with a native debugger when an exception is thrown.
428 .TP
429 \fB--compile name\fR
430 This compiles a method (namespace.name:methodname), this is used for
431 testing the compiler performance or to examine the output of the code
432 generator. 
433 .TP
434 \fB--compileall\fR
435 Compiles all the methods in an assembly.  This is used to test the
436 compiler performance or to examine the output of the code generator
437 .TP 
438 \fB--graph=TYPE METHOD\fR
439 This generates a postscript file with a graph with the details about
440 the specified method (namespace.name:methodname).  This requires `dot'
441 and ghostview to be installed (it expects Ghostview to be called
442 "gv"). 
443 .Sp
444 The following graphs are available:
445 .nf
446           cfg        Control Flow Graph (CFG)
447           dtree      Dominator Tree
448           code       CFG showing code
449           ssa        CFG showing code after SSA translation
450           optcode    CFG showing code after IR optimizations
451 .fi
452 .Sp
453 Some graphs will only be available if certain optimizations are turned
454 on.
455 .TP
456 \fB--ncompile\fR
457 Instruct the runtime on the number of times that the method specified
458 by --compile (or all the methods if --compileall is used) to be
459 compiled.  This is used for testing the code generator performance. 
460 .TP 
461 \fB--stats\fR
462 Displays information about the work done by the runtime during the
463 execution of an application. 
464 .TP
465 \fB--wapi=hps|semdel\fR
466 Perform maintenance of the process shared data.
467 .Sp
468 semdel will delete the global semaphore.
469 .Sp
470 hps will list the currently used handles.
471 .TP
472 \fB-v\fR, \fB--verbose\fR
473 Increases the verbosity level, each time it is listed, increases the
474 verbosity level to include more information (including, for example, 
475 a disassembly of the native code produced, code selector info etc.).
476 .SH ATTACH SUPPORT
477 The Mono runtime allows external processes to attach to a running
478 process and load assemblies into the running program.   To attach to
479 the process, a special protocol is implemented in the Mono.Management
480 assembly. 
481 .PP
482 With this support it is possible to load assemblies that have an entry
483 point (they are created with -target:exe or -target:winexe) to be
484 loaded and executed in the Mono process.
485 .PP
486 The code is loaded into the root domain, and it starts execution on
487 the special runtime attach thread.    The attached program should
488 create its own threads and return after invocation.
489 .PP
490 This support allows for example debugging applications by having the
491 csharp shell attach to running processes.
492 .SH PROFILING
493 The mono runtime includes a profiler that can be used to explore
494 various performance related problems in your application.  The
495 profiler is activated by passing the --profile command line argument
496 to the Mono runtime, the format is:
497 .nf
498
499         --profile[=profiler[:profiler_args]]
500
501 .fi
502 Mono has a built-in profiler called 'default' (and is also the default
503 if no arguments are specified), but developers can write custom
504 profilers, see the section "CUSTOM PROFILERS" for more details.
505 .PP
506 If a 
507 .I profiler 
508 is not specified, the default profiler is used.
509 .Sp
510 The 
511 .I profiler_args 
512 is a profiler-specific string of options for the profiler itself.
513 .Sp
514 The default profiler accepts the following options 'alloc' to profile
515 memory consumption by the application; 'time' to profile the time
516 spent on each routine; 'jit' to collect time spent JIT-compiling methods
517 and 'stat' to perform sample statistical profiling.
518 If no options are provided the default is 'alloc,time,jit'. 
519 .PP
520 By default the
521 profile data is printed to stdout: to change this, use the 'file=filename'
522 option to output the data to filename.
523 .Sp
524 For example:
525 .nf
526
527         mono --profile program.exe
528
529 .fi
530 .Sp
531 That will run the program with the default profiler and will do time
532 and allocation profiling.
533 .Sp
534 .nf
535
536         mono --profile=default:stat,alloc,file=prof.out program.exe
537
538 .fi
539 Will do  sample statistical profiling and allocation profiling on
540 program.exe. The profile data is put in prof.out.
541 .Sp
542 Note that the statistical profiler has a very low overhead and should
543 be the preferred profiler to use (for better output use the full path
544 to the mono binary when running and make sure you have installed the
545 addr2line utility that comes from the binutils package).
546 .SH LOGGING PROFILER
547 .PP
548 The
549 .I logging profiler
550 is a general purpose profiler that can track many different kinds of
551 events and logs those into a file as the program executes.   This is
552 different than previous profilers in Mono that kept the information in
553 memory and rendered a summary of the results when the program shut
554 down.
555 .PP
556 Using the logging profiler means that useful information can be
557 gathered for long-running applications, applications that terminate
558 abormally (crashes, segfaults, complicated tear down processes) or
559 when no data about the shutdown is required.
560 .PP
561 The data collected by the running threads is kept independent of each
562 other to minimize the runtime overhead and the information dumped into
563 the log at regular intervals. 
564 .PP
565 A sample use is very simple:
566 .nf
567         $ mono --profile=logging program.exe
568
569         $ mprof-decoder program.mprof
570 .fi
571 .PP
572 In the above example the logging profiler is used in its default mode
573 that merely records GC statistics for the execution of program.exe.
574 The profiling data collected is stored in the file program.mprof.  The
575 mprof-decoder tool is then used to analyze the data.
576 .PP
577 You can instruct the logging profiler to record different one or more
578 sets of events.   These are the modes supported:
579 .IP
580 .I Statistical Profiling (stat)
581 the program instruction pointer is periodically sampled to determine
582 where the program is spending most of its time.   Statistical
583 profiling has a very low impact on a running application and it is
584 very useful to get a general picture of where time is being spent on a
585 program.   
586 .IP 
587 If call chains are requested, for each sample the profiler gets a
588 partial stack trace (limited by the specified depth) so that
589 caller-callee information is available.
590 .IP
591 .I Instrumenting:
592 each method enter and exit is logged with a timestamp; further processing of
593 the data can show the methods that took the longer to execute, with complete
594 accounting for callers and callees. However, this way of profiling is rather
595 intrusive and slows down the application significantly.
596 .IP
597 .I Allocation:
598 each allocation is logged.
599 .IP
600 .I Allocation summary:
601 shows, for each collection, a summary of the heap contents broken down by
602 class (for each class the number of allocated and released objects is
603 given, together with their aggregated size in bytes).
604 .IP
605 .I Heap snapshot mode:
606 dumps the whole heap contents at every collection (or at user specified
607 collections). It is also possible to request a collection and snapshot dump
608 with a signal.
609 .PP
610 Moreover, other events can be logged and analyzed, like jit time for each
611 method, load and unload for assemblies, modules and and individual classes,
612 and appdomain and thread creation and destruction.
613 .PP
614 This profiler is activated passing the \fB--profile=logging\fR option to
615 the mono runtime, and is controlled attaching further options, like
616 \fB--profile=logging:statistical\fR for doing statistical profiling (multiple
617 options are separated by commas).
618 .PP
619 As a quick primer, here are a few examples of the most common usage modes:
620 .PP
621 To perform statistical profiling:
622 .nf
623
624         mono --profile=logging:stat program.exe
625 .fi
626 .PP
627 To perform statistical profiling, inspecting call chains up to depth 8:
628 .nf
629
630         mono --profile=logging:stat=8 program.exe
631 .fi
632 .PP
633 To profile allocations (by default the call stack will be analized for
634 each allocation, producing detailed caller method attribution infornation):
635 .nf
636
637         mono --profile=logging:allocations program.exe
638 .fi
639 .PP
640 To profile garbage collection activity at a high level (collection time and objects freed
641 at each collection for each class are reported, but heap snapshots are not saved to disk):
642 .nf
643
644         mono --profile=logging:allocations-summary program.exe
645 .fi
646 .PP
647 To perform heap profiling taking heap snapshots:
648 .nf
649
650         mono --profile=logging:heap=all program.exe
651 .fi
652 .PP
653 To write the resulting data to a different file:
654 .nf
655
656         mono --profile=logging:output=mydata.mprof program.exe
657 .fi
658 .PP
659 Then you would need to invoke the decoder \fImprof-decoder(1)\fR
660 on the output file to see the profiling results, or to examine heap
661 snapshots and allocations in detail \fImprof-heap-viewer(1)\fR.
662 .PP
663 The operating modes described above are the default ones, and are sufficient
664 to use the profiler.
665 .PP
666 To further customize the profiler behavior there are more options, described
667 below.
668 .PP
669 These options can be individually enabled and disabled prefixing them
670 with an (optional) '+' character or a '-' character.  For instance,
671 the "allocations" option by default records also the full call stack
672 at each allocation.  If only the caller is wanted, one should use
673 "allocations,-save-allocation-stack", or to disable call tracking
674 completely (making the profiler less intrusive)
675 "allocations,-save-allocation-caller,-save-allocation-stack".  In
676 practice the "allocation" option by default behaves like
677 "allocations,save-allocation-caller,save-allocation-stack", but the
678 user can tune this to his needs.
679 .PP
680 These are all the available options, organized by category:
681 .PP
682 \fBExecution profiling modes\fR
683 .RS
684 .ne 8
685 .TP
686 \fIstatistical\fR, \fIstat\fR or \fIs\fR
687 Performs statistical profiling.   This is a lightweight profiling
688 mechanism and it has a much lower overhead than the \fIenter-leave\fR
689 profiling as it works by sampling where the program is spending its
690 time by using a timer.
691 If specified with \fIs=<number>\fR, also inspect call chains up to level
692 <number>.
693 .TP
694 \fIenter-leave\fR, \fIcalls\fR or \fIc\fR
695 Measure the time spent inside each method call, this is done by
696 logging the time when a method enters and when the method leaves.
697 This can be a time consuming operation. 
698 .TP
699 \fIjit\fR, \fIj\fR
700 Collect information about time spent by the JIT engine compiling
701 methods. 
702 .ne
703 .RE
704 .PP
705 \fBAllocation profiling modes\fR
706 .RS
707 .ne 8
708 .TP
709 \fIallocations\fR, \fIalloc\fR or \fIa\fR
710 Collect information about each allocation (object class and size).
711 By default this also implies "+save-allocation-caller" and
712 "+save-allocation-stack".
713 .TP
714 \fIsave-allocation-caller\fR, \fIsac\fR
715 Save the direct caller of each allocation. The profiler filters out wrapper
716 methods, and also recognizes if the allocation has been performed by the
717 runtime while jitting a method.
718 .TP
719 \fIsave-allocation-stack\fR, \fIsas\fR
720 Save the full managed execution stack at each allocation.
721 While the "sac" option saves the direct caller, this one records the whole
722 stack trace.
723 Note that in the call stack the wrapper methods are not filtered out.
724 Anyway the "sac" and "sas" options can be combined, and the decoder will
725 attribute the allocation to the correct method even if the wrapper is at the
726 top of the stack trace.
727 .TP
728 \fIallocations-summary\fR or \fIas\fR
729 At each collection dump a summary
730 of the heap contents (for each class, the number and collective size of all
731 live and freed heap objects). This very lightweight compared to full heap
732 snapshots.
733 .TP
734 \fIunreachable\fR, \fIfree\fR or \fIf\fR
735 Performs a lightweight profile of the garbage collector.  On each
736 collection performed by the GC, the list of unreachable objects is
737 recorded, and for each object the class and size is provided.  This
738 information can be used to compute the heap size broken down by class
739 (combined with "a" can give the same information of "as", but the log
740 file contains info about each individual object, while in "as" the
741 processing is done directly at runtime and the log file contains only
742 the summarized data broken down by class).
743 .TP
744 \fIgc\fR or \fIg\fR
745 Measure the time spent in each collection, and also trace heap resizes.
746 .TP
747 \fIheap-shot[=ARG]\fR, \fIheap[=ARG]\fR or \fIh[=ARH]\fR
748 Performs full heap profiling.   In this case on each
749 collection a full heap snapshot is recorded to disk.
750 Inside the snapshots, each object reference is still represented so
751 that it's possible to investigate who is responsible for keeping objects
752 alive.
753 .PP
754 If the value of ARG is 
755 .B all, 
756 a heap snapshot is taken at each collection.  
757 .PP
758 If the value is an integer
759 .B n,
760 a snapshot will be taken at the first
761 .B n
762 collections (like setting
763 .B gcd=n
764 );
765 .PP
766 If no additional argument is given to the heap option, the only way to take
767 heap snapshots is to requeste them using the runtime socket based command
768 interface described below (see "Profiler activity control").
769 .PP
770 Heap profiling also enables full allocation profiling (with call
771 stacks), and each allocation can be related to its corresponding
772 object in the snapshots, enabling investigations like "find all
773 objects of a given class allocated by a given method and still live at
774 a given collection, and then find all objects referencing them".
775 .PP
776 This kind of heap snapshot analysis is performed using the mprof-heap-viewer(1)
777 application.
778 .PP
779 The number of heap snapshots taken (and the moment in which they are taken)
780 can be further customized with the following options: 
781 .TP
782 \fIgc-dumps=N\fR, \fIgc-d=N\fR, \fIgcd=N\fR
783 states the number of snapshots that must be dumped (since the application
784 starts).  Zero means no dumps at all, -1 means dump at all collections.
785 .TP
786 These options exist because it can happen that the user wants to investigate
787 what happens during collections but without forcing a collection using the
788 command interface, because forcing a collection alters the program behavior.
789 Of course it is possible to simply take a snapshot at every collection, but
790 in some workloads this is could not be feasible (too much data).
791 So we have this "garbage collection dumps" counter to control how many
792 snapshots to take.
793 .ne
794 .RE
795 .PP
796 \fBProfiler activity control\fR
797 .RS
798 .ne 8
799 .TP
800 \fIoutput=FILE\fR, \fIout=FILE\fR or \fIo=FILE\fR
801 Use this option to provide the output file name for the profile log.
802 If this option is not specified, it will default to "<program-name>.mprof".
803 .TP
804 \fIoutput-suffix=SUFFIX\fR, \fIsuffix=SUFFIX\fR or \fIos=SUFFIX\fR: makes
805 the output file name equals to "<program-name>-SUFFIX.mprof".
806 .TP
807 \fIstart-enabled\fR or \fIse\fR: start with the profiler active
808 (which is the default).
809 .TP
810 \fIstart-disabled\fR or \fIsd\fR: start with the profiler inactive.
811 .TP
812 \fIforce-accurate-timer\fR (or \fIfac\fR): the profiler by default uses
813 rtdsc to acquire timestamps for frequent events, but this can be imprecise;
814 using this option you force the use of "gettimeofday" at every event, which
815 is more accurate but much slower.
816 .TP
817 \fIcommand-port=port\fR or \fIcp=port\fR (where port is an integer between
818 1024 nd 65535):
819 Choose a TCP port where the profiler will listen for user commands.
820 The protocol is ASCII based and line oriented (one line per command), and the
821 profiler answers with one line containing either "OK" or "ERROR" to each
822 received command.
823 .PP
824 The user can telnet to this port and give commands manually, or a GUI can
825 use this facility to control the profiler at runtime.
826 .PP
827 The available commands are:
828 .TP
829 \fIenable\fR: Enables the profiler.
830 .TP
831 \fIdisable\fR: Disables the profiler.
832 .TP
833 \fIheap-snapshot\fR: Takes a heap snapshot now (forces a full garbage collection).
834 .TP
835 \fIheap-snapshot-counter=arg\fR: Set the counter of the next heap snapshots
836 that must be taken, where arg can be "all" (take a snapshot at every
837 collection), "none" (do not take snapshots), or an integer "n" (take a heap
838 snapshot for the next "n" collections).
839 .ne
840 .RE
841 .PP
842 \fBInternal buffer sizes\fR
843 .RS
844 .ne 8
845 .TP
846 \fIper-thread-buffer-size=N\fR, \fItbs=N\fR
847 Use to specify the number of events that a thread buffer
848 can hold.   When the thread buffer is full, a log block is
849 written to disk.
850 .Sp
851 This defaults to tbs=10000.
852 .TP
853 \fIstatistical-thread-buffer-size=N\fR, \fIsbs=N\fR
854 The number of statistical samples that
855 are held in memory before they are dumped to disk (the system does
856 double-buffering and the statistical samples are written by a helper
857 thread, so the statistical profiler never stops and is able to profile
858 the profiler itself).  
859 .Sp
860 This defaults to sbs=10000.
861 .TP
862 \fIwrite-buffer-size\fR, \fIwbs\fR
863 Specifies the size in bytes of the internal write buffers.
864 .Sp
865 This defaults to wbs=1024.
866 .ne
867 .RE
868 .PP
869 In its current state, this profiler can also perform heap analysis
870 like the HeapShot profiler, but there is no UI to process this
871 information. 
872 .PP
873 Another known issue is that if the timer is not strictly monotonic (like
874 rtdsc), differences between times can underflow (they are handled as
875 unsigned integers) and weird numbers can show up in the logs.
876 .PP
877 Finally, it can happen that when exceptions are thrown the profiler temporarily
878 loses track of the execution stack and misattributes the caller for a few
879 allocations (and method execution time).
880 .PP
881 The output file contains compressed events, to process the data you should
882 use tools like the "Mono.Profiler" tool provided on the Mono SVN
883 repository.  
884 .PP
885 More explanations are provided here: "http://www.mono-project.com/LoggingProfiler".
886 .SH EXTERNAL PROFILERS
887 There are a number of external profilers that have been developed for
888 Mono, we will update this section to contain the profilers.
889 .PP
890 The heap Shot profiler can track all live objects, and references to
891 these objects, and includes a GUI tool, this is our recommended
892 profiler.
893 To install you must download the profiler
894 from Mono's SVN:
895 .nf
896         svn co svn://anonsvn.mono-project.com/source/trunk/heap-shot
897         cd heap-shot
898         ./autogen
899         make
900         make install
901 .fi
902 .PP
903 See the included documentation for details on using it.
904 .PP
905 The Live Type profiler shows at every GC iteration all of the live
906 objects of a given type.   To install you must download the profiler
907 from Mono's SVN:
908 .nf
909         svn co svn://anonsvn.mono-project.com/source/trunk/heap-prof
910         cd heap-prof
911         ./autogen
912         make
913         make install
914 .fi
915 .PP
916 To use the profiler, execute:
917 .nf
918         mono --profile=desc-heap program.exe
919 .fi
920 .PP
921 The output of this profiler looks like this:
922 .nf
923         Checkpoint at 102 for heap-resize
924            System.MonoType : 708
925            System.Threading.Thread : 352
926            System.String : 3230
927            System.String[] : 104
928            Gnome.ModuleInfo : 112
929            System.Object[] : 160
930            System.Collections.Hashtable : 96
931            System.Int32[] : 212
932            System.Collections.Hashtable+Slot[] : 296
933            System.Globalization.CultureInfo : 108
934            System.Globalization.NumberFormatInfo : 144
935 .fi
936 .PP
937 The first line describes the iteration number for the GC, in this case
938 checkpoint 102.
939 .PP
940 Then on each line the type is displayed as well as the number of bytes
941 that are being consumed by live instances of this object.
942 .PP 
943 The AOT profiler is used to feed back information to the AOT compiler
944 about how to order code based on the access patterns for pages.  To
945 use it, use:
946 .nf
947         mono --profile=aot program.exe
948 .fi
949 The output of this profile can be fed back into Mono's AOT compiler to
950 order the functions on the disk to produce precompiled images that
951 have methods in sequential pages.
952 .SH CUSTOM PROFILERS
953 Mono provides a mechanism for loading other profiling modules which in
954 the form of shared libraries.  These profiling modules can hook up to
955 various parts of the Mono runtime to gather information about the code
956 being executed.
957 .PP
958 To use a third party profiler you must pass the name of the profiler
959 to Mono, like this:
960 .nf
961
962         mono --profile=custom program.exe
963
964 .fi
965 .PP
966 In the above sample Mono will load the user defined profiler from the
967 shared library `mono-profiler-custom.so'.  This profiler module must
968 be on your dynamic linker library path.
969 .PP 
970 A list of other third party profilers is available from Mono's web
971 site (www.mono-project.com/Performance_Tips)
972 .PP
973 Custom profiles are written as shared libraries.  The shared library
974 must be called `mono-profiler-NAME.so' where `NAME' is the name of
975 your profiler.
976 .PP
977 For a sample of how to write your own custom profiler look in the
978 Mono source tree for in the samples/profiler.c.
979 .SH CODE COVERAGE
980 Mono ships with a code coverage module.  This module is activated by
981 using the Mono --profile=cov option.  The format is:
982 \fB--profile=cov[:assembly-name[/namespace]] test-suite.exe\fR
983 .PP
984 By default code coverage will default to all the assemblies loaded,
985 you can limit this by specifying the assembly name, for example to
986 perform code coverage in the routines of your program use, for example
987 the following command line limits the code coverage to routines in the
988 "demo" assembly:
989 .nf
990
991         mono --profile=cov:demo demo.exe
992
993 .fi
994 .PP
995 Notice that the 
996 .I assembly-name
997 does not include the extension.
998 .PP
999 You can further restrict the code coverage output by specifying a
1000 namespace:
1001 .nf
1002
1003         mono --profile=cov:demo/My.Utilities demo.exe
1004
1005 .fi
1006 .PP
1007 Which will only perform code coverage in the given assembly and
1008 namespace.  
1009 .PP
1010 Typical output looks like this:
1011 .nf
1012
1013         Not covered: Class:.ctor ()
1014         Not covered: Class:A ()
1015         Not covered: Driver:.ctor ()
1016         Not covered: Driver:method ()
1017         Partial coverage: Driver:Main ()
1018                 offset 0x000a
1019
1020 .fi
1021 .PP
1022 The offsets displayed are IL offsets.
1023 .PP
1024 A more powerful coverage tool is available in the module `monocov'.
1025 See the monocov(1) man page for details.
1026 .SH DEBUGGING AIDS
1027 To debug managed applications, you can use the 
1028 .B mdb
1029 command, a command line debugger.  
1030 .PP
1031 It is possible to obtain a stack trace of all the active threads in
1032 Mono by sending the QUIT signal to Mono, you can do this from the
1033 command line, like this:
1034 .nf
1035
1036         kill -QUIT pid
1037
1038 .fi
1039 Where pid is the Process ID of the Mono process you want to examine.
1040 The process will continue running afterwards, but its state is not
1041 guaranteed.
1042 .PP
1043 .B Important:
1044 this is a last-resort mechanism for debugging applications and should
1045 not be used to monitor or probe a production application.  The
1046 integrity of the runtime after sending this signal is not guaranteed
1047 and the application might crash or terminate at any given point
1048 afterwards.   
1049 .PP
1050 The \fB--debug=casts\fR option can be used to get more detailed
1051 information for Invalid Cast operations, it will provide information
1052 about the types involved.   
1053 .PP
1054 You can use the MONO_LOG_LEVEL and MONO_LOG_MASK environment variables
1055 to get verbose debugging output about the execution of your
1056 application within Mono.
1057 .PP
1058 The 
1059 .I MONO_LOG_LEVEL
1060 environment variable if set, the logging level is changed to the set
1061 value. Possible values are "error", "critical", "warning", "message",
1062 "info", "debug". The default value is "error". Messages with a logging
1063 level greater then or equal to the log level will be printed to
1064 stdout/stderr.
1065 .PP
1066 Use "info" to track the dynamic loading of assemblies.
1067 .PP
1068 .PP
1069 Use the 
1070 .I MONO_LOG_MASK
1071 environment variable to limit the extent of the messages you get: 
1072 If set, the log mask is changed to the set value. Possible values are
1073 "asm" (assembly loader), "type", "dll" (native library loader), "gc"
1074 (garbage collector), "cfg" (config file loader), "aot" (precompiler) and "all". 
1075 The default value is "all". Changing the mask value allows you to display only 
1076 messages for a certain component. You can use multiple masks by comma 
1077 separating them. For example to see config file messages and assembly loader
1078 messages set you mask to "asm,cfg".
1079 .PP
1080 The following is a common use to track down problems with P/Invoke:
1081 .nf
1082
1083         $ MONO_LOG_LEVEL="debug" MONO_LOG_MASK="dll" mono glue.exe
1084
1085 .fi
1086 .PP
1087 .SH SERIALIZATION
1088 Mono's XML serialization engine by default will use a reflection-based
1089 approach to serialize which might be slow for continuous processing
1090 (web service applications).  The serialization engine will determine
1091 when a class must use a hand-tuned serializer based on a few
1092 parameters and if needed it will produce a customized C# serializer
1093 for your types at runtime.  This customized serializer then gets
1094 dynamically loaded into your application.
1095 .PP
1096 You can control this with the MONO_XMLSERIALIZER_THS environment
1097 variable.
1098 .PP
1099 The possible values are 
1100 .B `no' 
1101 to disable the use of a C# customized
1102 serializer, or an integer that is the minimum number of uses before
1103 the runtime will produce a custom serializer (0 will produce a
1104 custom serializer on the first access, 50 will produce a serializer on
1105 the 50th use). Mono will fallback to an interpreted serializer if the
1106 serializer generation somehow fails. This behavior can be disabled
1107 by setting the option
1108 .B `nofallback'
1109 (for example: MONO_XMLSERIALIZER_THS=0,nofallback).
1110 .SH ENVIRONMENT VARIABLES
1111 .TP
1112 \fBGC_DONT_GC\fR
1113 Turns off the garbage collection in Mono.  This should be only used
1114 for debugging purposes
1115 .TP
1116 \fBLVM_COUNT\fR
1117 When Mono is compiled with LLVM support, this instructs the runtime to
1118 stop using LLVM after the specified number of methods are JITed.
1119 This is a tool used in diagnostics to help isolate problems in the
1120 code generation backend.   For example \fBLLVM_COUNT=10\fR would only
1121 compile 10 methods with LLVM and then switch to the Mono JIT engine.
1122 \fBLLVM_COUNT=0\fR would disable the LLVM engine altogether.
1123 .TP
1124 \fBMONO_AOT_CACHE\fR
1125 If set, this variable will instruct Mono to ahead-of-time compile new
1126 assemblies on demand and store the result into a cache in
1127 ~/.mono/aot-cache. 
1128 .TP
1129 \fBMONO_CFG_DIR\fR
1130 If set, this variable overrides the default system configuration directory
1131 ($PREFIX/etc). It's used to locate machine.config file.
1132 .TP
1133 \fBMONO_COM\fR
1134 Sets the style of COM interop.  If the value of this variable is "MS"
1135 Mono will use string marhsalling routines from the liboleaut32 for the
1136 BSTR type library, any other values will use the mono-builtin BSTR
1137 string marshalling.
1138 .TP
1139 \fBMONO_CONFIG\fR
1140 If set, this variable overrides the default runtime configuration file
1141 ($PREFIX/etc/mono/config). The --config command line options overrides the
1142 environment variable.
1143 .TP
1144 \fBMONO_DEBUG\fR
1145 If set, enables some features of the runtime useful for debugging.
1146 This variable should contain a comma separated list of debugging options.
1147 Currently, the following options are supported:
1148 .RS
1149 .ne 8
1150 .TP
1151 \fBbreak-on-unverified\fR
1152 If this variable is set, when the Mono VM runs into a verification
1153 problem, instead of throwing an exception it will break into the
1154 debugger.  This is useful when debugging verifier problems
1155 .TP
1156 \fBcollect-pagefault-stats\fR
1157 Collects information about pagefaults.   This is used internally to
1158 track the number of page faults produced to load metadata.  To display
1159 this information you must use this option with "--stats" command line
1160 option.
1161 .TP
1162 \fBdont-free-domains\fR
1163 This is an Optimization for multi-AppDomain applications (most
1164 commonly ASP.NET applications).  Due to internal limitations Mono,
1165 Mono by default does not use typed allocations on multi-appDomain
1166 applications as they could leak memory when a domain is unloaded. 
1167 .Sp
1168 Although this is a fine default, for applications that use more than
1169 on AppDomain heavily (for example, ASP.NET applications) it is worth
1170 trading off the small leaks for the increased performance
1171 (additionally, since ASP.NET applications are not likely going to
1172 unload the application domains on production systems, it is worth
1173 using this feature). 
1174 .TP
1175 \fBhandle-sigint\fR
1176 Captures the interrupt signal (Control-C) and displays a stack trace
1177 when pressed.  Useful to find out where the program is executing at a
1178 given point.  This only displays the stack trace of a single thread. 
1179 .TP
1180 \fBkeep-delegates\fR
1181 This option will leak delegate trampolines that are no longer
1182 referenced as to present the user with more information about a
1183 delegate misuse.  Basically a delegate instance might be created,
1184 passed to unmanaged code, and no references kept in managed code,
1185 which will garbage collect the code.  With this option it is possible
1186 to track down the source of the problems. 
1187 .TP
1188 \fBno-gdb-backtrace\fR
1189 This option will disable the GDB backtrace emitted by the runtime
1190 after a SIGSEGV or SIGABRT in unmanaged code.
1191 .TP
1192 \fBsuspend-on-sigsegv\fR
1193
1194 This option will suspend the program when a native SIGSEGV is received.
1195 This is useful for debugging crashes which do not happen under gdb,
1196 since a live process contains more information than a core file.
1197 .ne
1198 .RE
1199 .TP
1200 \fBMONO_DISABLE_AIO\fR
1201 If set, tells mono NOT to attempt using native asynchronous I/O services. In
1202 that case, a default select/poll implementation is used. Currently only epoll()
1203 is supported.
1204 .TP
1205 \fBMONO_DISABLE_MANAGED_COLLATION\fR
1206 If this environment variable is `yes', the runtime uses unmanaged
1207 collation (which actually means no culture-sensitive collation). It
1208 internally disables managed collation functionality invoked via the
1209 members of System.Globalization.CompareInfo class. Collation is
1210 enabled by default.
1211 .TP
1212 \fBMONO_EGD_SOCKET\fR
1213 For platforms that do not otherwise have a way of obtaining random bytes
1214 this can be set to the name of a file system socket on which an egd or
1215 prngd daemon is listening.
1216 .TP
1217 \fBMONO_EVENTLOG_TYPE\fR
1218 Sets the type of event log provider to use (for System.Diagnostics.EventLog).
1219 .Sp
1220 Possible values are:
1221 .RS
1222 .TP
1223 .I "local[:path]"
1224 .Sp
1225 Persists event logs and entries to the local file system.
1226 .Sp
1227 The directory in which to persist the event logs, event sources and entries
1228 can be specified as part of the value.
1229 .Sp
1230 If the path is not explicitly set, it defaults to "/var/lib/mono/eventlog"
1231 on unix and "%APPDATA%\mono\eventlog" on Windows.
1232 .TP
1233 .I "win32"
1234 .Sp
1235 .B 
1236 Uses the native win32 API to write events and registers event logs and
1237 event sources in the registry.   This is only available on Windows. 
1238 .Sp
1239 On Unix, the directory permission for individual event log and event source
1240 directories is set to 777 (with +t bit) allowing everyone to read and write
1241 event log entries while only allowing entries to be deleted by the user(s)
1242 that created them.
1243 .TP
1244 .I "null"
1245 .Sp
1246 Silently discards any events.
1247 .ne
1248 .PP
1249 The default is "null" on Unix (and versions of Windows before NT), and 
1250 "win32" on Windows NT (and higher).
1251 .RE
1252 .TP
1253 \fBMONO_EXTERNAL_ENCODINGS\fR
1254 If set, contains a colon-separated list of text encodings to try when
1255 turning externally-generated text (e.g. command-line arguments or
1256 filenames) into Unicode.  The encoding names come from the list
1257 provided by iconv, and the special case "default_locale" which refers
1258 to the current locale's default encoding.
1259 .IP
1260 When reading externally-generated text strings UTF-8 is tried first,
1261 and then this list is tried in order with the first successful
1262 conversion ending the search.  When writing external text (e.g. new
1263 filenames or arguments to new processes) the first item in this list
1264 is used, or UTF-8 if the environment variable is not set.
1265 .IP
1266 The problem with using MONO_EXTERNAL_ENCODINGS to process your
1267 files is that it results in a problem: although its possible to get
1268 the right file name it is not necessarily possible to open the file.
1269 In general if you have problems with encodings in your filenames you
1270 should use the "convmv" program.
1271 .TP
1272 \fBMONO_GAC_PREFIX\fR
1273 Provides a prefix the runtime uses to look for Global Assembly Caches.
1274 Directories are separated by the platform path separator (colons on
1275 unix). MONO_GAC_PREFIX should point to the top directory of a prefixed
1276 install. Or to the directory provided in the gacutil /gacdir command. Example:
1277 .B /home/username/.mono:/usr/local/mono/
1278 .TP
1279 \fBMONO_IOMAP\fR
1280 Enables some filename rewriting support to assist badly-written
1281 applications that hard-code Windows paths.  Set to a colon-separated
1282 list of "drive" to strip drive letters, or "case" to do
1283 case-insensitive file matching in every directory in a path.  "all"
1284 enables all rewriting methods.  (Backslashes are always mapped to
1285 slashes if this variable is set to a valid option.)
1286 .fi
1287 .Sp
1288 For example, this would work from the shell:
1289 .nf
1290
1291         MONO_IOMAP=drive:case
1292         export MONO_IOMAP
1293
1294 .fi
1295 If you are using mod_mono to host your web applications, you can use
1296 the 
1297 .B MonoIOMAP
1298 directive instead, like this:
1299 .nf
1300
1301         MonoIOMAP <appalias> all
1302
1303 .fi
1304 See mod_mono(8) for more details.
1305 .TP
1306 \fBMONO_MANAGED_WATCHER\fR
1307 If set to "disabled", System.IO.FileSystemWatcher will use a file watcher 
1308 implementation which silently ignores all the watching requests.
1309 If set to any other value, System.IO.FileSystemWatcher will use the default
1310 managed implementation (slow). If unset, mono will try to use inotify, FAM, 
1311 Gamin, kevent under Unix systems and native API calls on Windows, falling 
1312 back to the managed implementation on error.
1313 .TP
1314 \fBMONO_NO_SMP\fR
1315 If set causes the mono process to be bound to a single processor. This may be
1316 useful when debugging or working around race conditions.
1317 .TP
1318 \fBMONO_PATH\fR
1319 Provides a search path to the runtime where to look for library
1320 files.   This is a tool convenient for debugging applications, but
1321 should not be used by deployed applications as it breaks the assembly
1322 loader in subtle ways. 
1323 .Sp
1324 Directories are separated by the platform path separator (colons on unix). Example:
1325 .B /home/username/lib:/usr/local/mono/lib
1326 .Sp
1327 Alternative solutions to MONO_PATH include: installing libraries into
1328 the Global Assembly Cache (see gacutil(1)) or having the dependent
1329 libraries side-by-side with the main executable.
1330 .Sp
1331 For a complete description of recommended practices for application
1332 deployment, see
1333 http://www.mono-project.com/Guidelines:Application_Deployment
1334 .TP
1335 \fBMONO_RTC\fR
1336 Experimental RTC support in the statistical profiler: if the user has
1337 the permission, more accurate statistics are gathered.  The MONO_RTC
1338 value must be restricted to what the Linux rtc allows: power of two
1339 from 64 to 8192 Hz. To enable higher frequencies like 4096 Hz, run as root:
1340 .nf
1341
1342         echo 4096 > /proc/sys/dev/rtc/max-user-freq
1343
1344 .fi
1345 .Sp
1346 For example:
1347 .nf
1348
1349         MONO_RTC=4096 mono --profiler=default:stat program.exe
1350
1351 .fi
1352 .TP
1353 \fBMONO_NO_TLS\fR
1354 Disable inlining of thread local accesses. Try setting this if you get a segfault
1355 early on in the execution of mono.
1356 .TP 
1357 \fBMONO_SHARED_DIR\fR
1358 If set its the directory where the ".wapi" handle state is stored.
1359 This is the directory where the Windows I/O Emulation layer stores its
1360 shared state data (files, events, mutexes, pipes).  By default Mono
1361 will store the ".wapi" directory in the users's home directory.
1362 .TP 
1363 \fBMONO_SHARED_HOSTNAME\fR
1364 Uses the string value of this variable as a replacement for the host name when
1365 creating file names in the ".wapi" directory. This helps if the host name of
1366 your machine is likely to be changed when a mono application is running or if
1367 you have a .wapi directory shared among several different computers.
1368 .Sp
1369 Mono typically uses the hostname to create the files that are used to
1370 share state across multiple Mono processes.  This is done to support
1371 home directories that might be shared over the network.
1372 .TP
1373 \fBMONO_STRICT_IO_EMULATION\fR
1374 If set, extra checks are made during IO operations.  Currently, this
1375 includes only advisory locks around file writes.
1376 .TP
1377 \fBMONO_DISABLE_SHM\fR
1378 If set, disables the shared memory files used for cross-process
1379 handles: process have only private handles.  This means that process
1380 and thread handles are not available to other processes, and named
1381 mutexes, named events and named semaphores are not visible between
1382 processes.
1383 .Sp
1384 This is can also be enabled by default by passing the
1385 "--disable-shared-handles" option to configure.
1386 .TP
1387 \fBMONO_THEME\fR
1388 The name of the theme to be used by Windows.Forms.   Available themes today
1389 include "clearlooks", "nice" and "win32".
1390 .Sp
1391 The default is "win32".  
1392 .TP
1393 \fBMONO_TLS_SESSION_CACHE_TIMEOUT\fR
1394 The time, in seconds, that the SSL/TLS session cache will keep it's entry to
1395 avoid a new negotiation between the client and a server. Negotiation are very
1396 CPU intensive so an application-specific custom value may prove useful for 
1397 small embedded systems.
1398 .Sp
1399 The default is 180 seconds.
1400 .TP
1401 \fBMONO_THREADS_PER_CPU\fR
1402 The maximum number of threads in the general threadpool will be
1403 20 + (MONO_THREADS_PER_CPU * number of CPUs). The default value for this
1404 variable is 10.
1405 .TP
1406 \fBMONO_XMLSERIALIZER_THS\fR
1407 Controls the threshold for the XmlSerializer to produce a custom
1408 serializer for a given class instead of using the Reflection-based
1409 interpreter.  The possible values are `no' to disable the use of a
1410 custom serializer or a number to indicate when the XmlSerializer
1411 should start serializing.   The default value is 50, which means that
1412 the a custom serializer will be produced on the 50th use.
1413 .TP
1414 \fBMONO_XMLSERIALIZER_DEBUG\fR
1415 Set this value to 1 to prevent the serializer from removing the
1416 temporary files that are created for fast serialization;  This might
1417 be useful when debugging.
1418 .TP
1419 \fBMONO_ASPNET_INHIBIT_SETTINGSMAP\fR
1420 Mono contains a feature which allows modifying settings in the .config files shipped
1421 with Mono by using config section mappers. The mappers and the mapping rules are
1422 defined in the $prefix/etc/mono/2.0/settings.map file and, optionally, in the
1423 settings.map file found in the top-level directory of your ASP.NET application.
1424 Both files are read by System.Web on application startup, if they are found at the
1425 above locations. If you don't want the mapping to be performed you can set this
1426 variable in your environment before starting the application and no action will
1427 be taken.
1428 .TP
1429 \fBMONO_MESSAGING_PROVIDER\fR
1430 Mono supports a plugin model for its implementation of System.Messaging making
1431 it possible to support a variety of messaging implementations (e.g. AMQP, ActiveMQ).
1432 To specify which messaging implementation is to be used the evironement variable
1433 needs to be set to the full class name for the provider.  E.g. to use the RabbitMQ based
1434 AMQP implementation the variable should be set to:
1435
1436 .nf
1437 Mono.Messaging.RabbitMQ.RabbitMQMessagingProvider,Mono.Messaging.RabbitMQ
1438 .SH ENVIRONMENT VARIABLES FOR DEBUGGING
1439 .TP
1440 \fBMONO_ASPNET_NODELETE\fR
1441 If set to any value, temporary source files generated by ASP.NET support
1442 classes will not be removed. They will be kept in the user's temporary
1443 directory.
1444 .TP
1445 \fBMONO_LOG_LEVEL\fR
1446 The logging level, possible values are `error', `critical', `warning',
1447 `message', `info' and `debug'.  See the DEBUGGING section for more
1448 details.
1449 .TP
1450 \fBMONO_LOG_MASK\fR
1451 Controls the domain of the Mono runtime that logging will apply to. 
1452 If set, the log mask is changed to the set value. Possible values are
1453 "asm" (assembly loader), "type", "dll" (native library loader), "gc"
1454 (garbage collector), "cfg" (config file loader), "aot" (precompiler) and "all". 
1455 The default value is "all". Changing the mask value allows you to display only 
1456 messages for a certain component. You can use multiple masks by comma 
1457 separating them. For example to see config file messages and assembly loader
1458 messages set you mask to "asm,cfg".
1459 .TP
1460 \fBMONO_TRACE\fR
1461 Used for runtime tracing of method calls. The format of the comma separated
1462 trace options is:
1463 .nf
1464
1465         [-]M:method name
1466         [-]N:namespace
1467         [-]T:class name
1468         [-]all
1469         [-]program
1470         disabled                Trace output off upon start.
1471
1472 .fi
1473 You can toggle trace output on/off sending a SIGUSR2 signal to the program.
1474 .TP
1475 \fBMONO_TRACE_LISTENER\fR
1476 If set, enables the System.Diagnostics.DefaultTraceListener, which will 
1477 print the output of the System.Diagnostics Trace and Debug classes.  
1478 It can be set to a filename, and to Console.Out or Console.Error to display
1479 output to standard output or standard error, respectively. If it's set to
1480 Console.Out or Console.Error you can append an optional prefix that will
1481 be used when writing messages like this: Console.Error:MyProgramName.
1482 See the System.Diagnostics.DefaultTraceListener documentation for more
1483 information.
1484 .TP
1485 \fBMONO_XEXCEPTIONS\fR
1486 This throws an exception when a X11 error is encountered; by default a
1487 message is displayed but execution continues
1488 .TP
1489 \fBMONO_XSYNC\fR
1490 This is used in the System.Windows.Forms implementation when running
1491 with the X11 backend.  This is used to debug problems in Windows.Forms
1492 as it forces all of the commands send to X11 server to be done
1493 synchronously.   The default mode of operation is asynchronous which
1494 makes it hard to isolate the root of certain problems.
1495 .TP
1496 \fBMONO_GENERIC_SHARING\fR
1497 This environment variable controls the kind of generic sharing used.
1498 This variable is used by internal JIT developers and should not be
1499 changed in production.  Do not use it.
1500 .Sp
1501 The variable controls which classes will have generic code sharing
1502 enabled.
1503 .Sp
1504 Permissible values are:
1505 .RS
1506 .TP 
1507 .I "all" 
1508 All generated code can be shared. 
1509 .TP
1510 .I "collections" 
1511 Only the classes in System.Collections.Generic will have its code
1512 shared (this is the default value).
1513 .TP
1514 .I "corlib"
1515 Only code in corlib will have its code shared.
1516 .TP
1517 .I "none"
1518 No generic code sharing will be performed.
1519 .RE
1520 .Sp
1521 Generic code sharing by default only applies to collections.   The
1522 Mono JIT by default turns this on.
1523 .TP
1524 \fBMONO_XDEBUG\fR
1525 When the the MONO_XDEBUG env var is set, debugging info for JITted
1526 code is emitted into a shared library, loadable into gdb. This enables,
1527 for example, to see managed frame names on gdb backtraces.
1528 .TP
1529 \fBMONO_VERBOSE_METHOD\fR
1530 Enables the maximum JIT verbosity for the specified method. This is
1531 very helpfull to diagnose a miscompilation problems of a specific
1532 method.
1533 .SH VALGRIND
1534 If you want to use Valgrind, you will find the file `mono.supp'
1535 useful, it contains the suppressions for the GC which trigger
1536 incorrect warnings.  Use it like this:
1537 .nf
1538     valgrind --suppressions=mono.supp mono ...
1539 .fi
1540 .SH DTRACE
1541 On some platforms, Mono can expose a set of DTrace probes (also known
1542 as user-land statically defined, USDT Probes).
1543 .TP
1544 They are defined in the file `mono.d'.
1545 .TP
1546 .B ves-init-begin, ves-init-end
1547 .Sp
1548 Begin and end of runtime initialization.
1549 .TP
1550 .B method-compile-begin, method-compile-end
1551 .Sp
1552 Begin and end of method compilation.
1553 The probe arguments are class name, method name and signature,
1554 and in case of method-compile-end success or failure of compilation.
1555 .TP
1556 .B gc-begin, gc-end
1557 .Sp
1558 Begin and end of Garbage Collection.
1559 .TP
1560 To verify the availability of the probes, run:
1561 .nf
1562     dtrace -P mono'$target' -l -c mono
1563 .fi
1564 .SH PERMISSIONS
1565 Mono's Ping implementation for detecting network reachability can
1566 create the ICMP packets itself without requiring the system ping
1567 command to do the work.  If you want to enable this on Linux for
1568 non-root users, you need to give the Mono binary special permissions.
1569 .PP
1570 As root, run this command:
1571 .nf
1572    # setcap cap_net_raw=+ep /usr/bin/mono
1573 .fi
1574 .SH FILES
1575 On Unix assemblies are loaded from the installation lib directory.  If you set
1576 `prefix' to /usr, the assemblies will be located in /usr/lib.  On
1577 Windows, the assemblies are loaded from the directory where mono and
1578 mint live.
1579 .TP
1580 .B ~/.mono/aot-cache
1581 .Sp
1582 The directory for the ahead-of-time compiler demand creation
1583 assemblies are located. 
1584 .TP
1585 .B /etc/mono/config, ~/.mono/config
1586 .Sp
1587 Mono runtime configuration file.  See the mono-config(5) manual page
1588 for more information.
1589 .TP
1590 .B ~/.config/.mono/certs, /usr/share/.mono/certs
1591 .Sp
1592 Contains Mono certificate stores for users / machine. See the certmgr(1) 
1593 manual page for more information on managing certificate stores and
1594 the mozroots(1) page for information on how to import the Mozilla root
1595 certificates into the Mono certificate store. 
1596 .TP
1597 .B ~/.mono/assemblies/ASSEMBLY/ASSEMBLY.config
1598 .Sp
1599 Files in this directory allow a user to customize the configuration
1600 for a given system assembly, the format is the one described in the
1601 mono-config(5) page. 
1602 .TP
1603 .B ~/.config/.mono/keypairs, /usr/share/.mono/keypairs
1604 .Sp
1605 Contains Mono cryptographic keypairs for users / machine. They can be 
1606 accessed by using a CspParameters object with DSACryptoServiceProvider
1607 and RSACryptoServiceProvider classes.
1608 .TP
1609 .B ~/.config/.isolatedstorage, ~/.local/share/.isolatedstorage, /usr/share/.isolatedstorage
1610 .Sp
1611 Contains Mono isolated storage for non-roaming users, roaming users and 
1612 local machine. Isolated storage can be accessed using the classes from 
1613 the System.IO.IsolatedStorage namespace.
1614 .TP
1615 .B <assembly>.config
1616 .Sp
1617 Configuration information for individual assemblies is loaded by the
1618 runtime from side-by-side files with the .config files, see the
1619 http://www.mono-project.com/Config for more information.
1620 .TP
1621 .B Web.config, web.config
1622 .Sp
1623 ASP.NET applications are configured through these files, the
1624 configuration is done on a per-directory basis.  For more information
1625 on this subject see the http://www.mono-project.com/Config_system.web
1626 page. 
1627 .SH MAILING LISTS
1628 Mailing lists are listed at the
1629 http://www.mono-project.com/Mailing_Lists
1630 .SH WEB SITE
1631 http://www.mono-project.com
1632 .SH SEE ALSO
1633 .PP
1634 certmgr(1), csharp(1), mcs(1), mdb(1), monocov(1), monodis(1),
1635 mono-config(5), mozroots(1), pdb2mdb(1), xsp(1), mod_mono(8).
1636 .PP
1637 For more information on AOT:
1638 http://www.mono-project.com/AOT
1639 .PP
1640 For ASP.NET-related documentation, see the xsp(1) manual page