2008-04-17 Marek Habersack <mhabersack@novell.com>
[mono.git] / man / mono.1
index 1b9c184bd31d75e544eb0900519494681ca010a6..1f0f40ab61ad4f7bdc6968979eaf876c63d7abd5 100644 (file)
@@ -27,7 +27,7 @@ The code generator can operate in two modes: just in time compilation
 dynamically loaded, the runtime environment and the JIT are always
 present, even if code is compiled ahead of time.
 .PP
-The runtime loads ths specified
+The runtime loads the specified
 .I file
 and optionally passes
 the
@@ -37,12 +37,12 @@ to it.  The
 is an ECMA assembly.  They typically have a .exe or .dll extension.
 .PP
 The runtime provides a number of configuration options for running
-applications, for developping and debugging, and for testing and
+applications, for developing and debugging, and for testing and
 debugging the runtime itself.
 .SH PORTABILITY
 On Unix-based systems, Mono provides a mechanism to emulate the 
 Windows-style file access, this includes providing a case insensitive
-view of the file system, directory separator mapping (from \ to /) and
+view of the file system, directory separator mapping (from \\ to /) and
 stripping the drive letters.
 .PP
 This functionality is enabled by setting the 
@@ -79,7 +79,7 @@ code for use in multi-domain applications, consider using the
 .Sp
 This pre-compiles the methods, but the original assembly is still
 required to execute as this one contains the metadata and exception
-information which is not availble on the generated file.  When
+information which is not available on the generated file.  When
 precompiling code, you might want to compile with all optimizations
 (-O=all).  Pre-compiled code is position independent code.
 .Sp
@@ -88,6 +88,11 @@ code sharing across multiple mono processes and avoid just-in-time
 compilation program startup costs.  The original assembly must still
 be present, as the metadata is contained there.
 .Sp
+AOT code typically can not be moved from one computer to another
+(CPU-specific optimizations that are detected at runtime) so you
+should not try to move the pre-generated assemblies or package the
+pre-generated assemblies for deployment.    
+.Sp
 For more information about AOT, see: http://www.mono-project.com/AOT
 .TP
 .I "--config filename"
@@ -110,6 +115,10 @@ MODE is a comma separated list of optimizations.  They also allow
 optimizations to be turned off by prefixing the optimization name with
 a minus sign.
 .Sp
+In general, Mono has been tuned to use the default set of flags,
+before using these flags for a deployment setting, you might want to
+actually measure the benefits of using them.    
+.Sp
 The following optimizations are implemented:
 .nf
              all        Turn on all optimizations
@@ -121,18 +130,19 @@ The following optimizations are implemented:
              copyprop   Copy propagation
              deadce     Dead code elimination
              linears    Linear scan global reg allocation
-             cmov       Conditional moves
+             cmov       Conditional moves [arch-dependency]
              shared     Emit per-domain code
              sched      Instruction scheduling
              intrins    Intrinsic method implementations
              tailc      Tail recursion and tail calls
              loop       Loop related optimizations
-             fcmov      Fast x86 FP compares
+             fcmov      Fast x86 FP compares [arch-dependency]
              leaf       Leaf procedures optimizations
              aot        Usage of Ahead Of Time compiled code
              precomp    Precompile all methods before executing Main
              abcrem     Array bound checks removal
              ssapre     SSA based Partial Redundancy Elimination
+             sse2       SSE2 instructions on x86 [arch-dependency]
 .fi
 .Sp
 For example, to enable all the optimization but dead code
@@ -140,6 +150,11 @@ elimination and inlining, you can use:
 .nf
        -O=all,-deadce,-inline
 .fi
+.Sp
+The flags that are flagged with [arch-dependency] indicate that the
+given option if used in combination with Ahead of Time compilation
+(--aot flag) would produce pre-compiled code that will depend on the
+current CPU and might not be safely moved to another computer. 
 .TP
 .I "--runtime=VERSION"
 Mono supports different runtime versions. The version used depends on the program
@@ -152,18 +167,51 @@ running a 1.1 program on a 2.0 version:
          mono --runtime=v2.0.50727 program.exe
 .fi
 .TP
-.I "--security"
-Activate the security manager (experimental feature in 1.1). This allows 
-mono to support declarative security attributes (e.g. execution of, CAS 
-or non-CAS, security demands). The security manager is OFF by default 
-(experimental).
+.I "--security", "--security=mode"
+Activate the security manager, a currently experimental feature in
+Mono and it is OFF by default. The new code verifier can be enabled
+with this option as well.
+.RS
+.ne 8
+.PP
+Using security without parameters is equivalent as calling it with the
+"cas" parameter.  
+.PP
+The following modes are supported:
+.TP
+.I cas
+This allows mono to support declarative security attributes,
+e.g. execution of Code Access Security (CAS) or non-CAS demands.
+.TP 
+.I core-clr
+Enables the core-clr security system, typically used for
+Moonlight/Silverlight applications.  It provides a much simpler
+security system than CAS, see http://www.mono-project.com/Moonlight
+for more details and links to the descriptions of this new system. 
+.TP
+.I validil
+Enables the new verifier and performs basic verification for code
+validity.  In this mode, unsafe code and P/Invoke are allowed. This
+mode provides a better safety guarantee but it is still possible
+for managed code to crash Mono. 
+.TP
+.I verifiable
+Enables the new verifier and performs full verification of the code
+being executed.  It only allows verifiable code to be executed.
+Unsafe code is not allowed but P/Invoke is.  This mode should
+not allow managed code to crash mono.  The verification is not as
+strict as ECMA 335 standard in order to stay compatible with the MS
+runtime.
+.ne
+.RE
 .TP
 .I "--server"
 Configures the virtual machine to be better suited for server
-operations.  
+operations (currently, a no-op).
 .TP
 .I "-V", "--version"
-Prints JIT version information.
+Prints JIT version information (system configuration, release number
+and branch names if available). 
 
 
 .SH DEVELOPMENT OPTIONS
@@ -174,6 +222,11 @@ Turns on the debugging mode in the runtime.  If an assembly was
 compiled with debugging information, it will produce line number
 information for stack traces. 
 .TP
+.I "--debug=casts"
+Produces a detailed error when throwing a InvalidCastException.  This
+option is turned off by default as it generates much larger code at
+runtime.
+.TP
 .I "--profile[=profiler[:profiler_args]]"
 Turns on profiling.  For more information about profiling applications
 and code coverage see the sections "PROFILING" and "CODE COVERAGE"
@@ -209,7 +262,7 @@ calls to the System.String class, use:
 
 .fi
 And individual methods are referenced with the M: prefix, and the
-standar method notation:
+standard method notation:
 .nf
 
        mono --trace=M:System.Console:WriteLine app.exe
@@ -414,6 +467,96 @@ use it, use:
 The output of this profile can be fed back into Mono's AOT compiler to
 order the functions on the disk to produce precompiled images that
 have methods in sequential pages.
+.PP
+The
+.I logging profiler
+will eventually replace the default one. It is a
+"general purpose" profiler, which can report method execution time,
+allocations, jit time, and can also work in statistical mode. You invoke
+it with:
+.nf
+       mono --profile=logging program.exe
+.fi
+Its main characteristic is that it does not print the profiling data
+at the end of the program execution, and in fact it does not elaborate
+the events at all; instead, it logs them into a file periodically
+during the program execution. The file is binary, and encoded as packed
+as possible, so to see the data you must use a decoder program, which
+you can find in svn in the "Mono.Profiler" module.
+.PP
+Some examples: to use the statistical profiler:
+.nf
+       mono --profile=logging:s program.exe
+.fi
+To profile method enter-exit and allocations:
+.nf
+       mono --profile=logging:c,a program.exe
+.fi
+To profile method enter-exit and jit time, and write the data to "mydata.mprof":
+.nf
+       mono --profile=logging:c,j,o=mydata.mprof program.exe
+.fi
+Then you would need to invoke the decoder on "mydata.mprof" to see the
+profiling results.
+.PP
+In its current state, this profiler can also perform heap analysis (like
+heap-shot), and the decoder is already able to read the data, however
+the user interface for this feature has not yet been written (which means
+that the data is not printed by the decoder).
+.PP
+More explanations are provided here: "http://www.mono-project.com/LoggingProfiler".
+.PP
+The whole set of options accepted by the logging profiler is the following:
+.TP
+.I output
+(or "out" or "o", default "o=profiler-log.prof"): the name of the output file.
+.TP
+.I jit
+(or "j"): collect information about time spent jitting methods.
+.TP
+.I allocations
+(or "alloc" or "a"): collect information about each allocation (object class
+and size).
+.TP
+.I enter-leave
+(or "calls" or "c"): measure the time spent inside each method call.
+.TP
+.I statistical
+(or "stat" or "s"): do statistical profiling. 
+.TP
+.I unreachable
+(or "free" or "f"): enable garbage collection profiling in its lightweight
+form (at each collection, the list if unreachable objects is dumped, and
+for each object the class and size is provided, which together with the
+basic allocation information allows to compute the heap size broken down
+by class).
+.TP
+.I heap-shot
+(or "heap" or "h"): enable full heap profiling, in this case at each
+collection a full heap snapshot is dumped to disk.
+.TP
+.I gc-commands
+(or "gc-c" or "gcc", default none, file name required): the name of the
+file that controls the heap snapshot dumps.
+.TP
+.I gc-dumps
+(or "gc-d" or "gcd", default "gcd=0"): the initial number of heap
+snapshots to dump (if the control file is not used). 
+.TP
+.I per-thread-buffer-size
+(or "tbs", default "tbs=10000"): the number of events that a thread buffer
+can hold, when it's full it is written to disk (the writing thread is the
+one that filled its buffer).
+.TP
+.I statistical-thread-buffer-size
+(or "sbs", default "sbs=10000"): the number of statistical samples that
+are hold in memory before they are dumped to disk (the system does
+double-buffering and the statistical samples are written by a helper
+thread).
+.TP
+.I write-buffer-size
+(or "wbs", default "wbs=1024"): size in bytes of the internal write
+buffers. 
 .SH CUSTOM PROFILERS
 Mono provides a mechanism for loading other profiling modules which in
 the form of shared libraries.  These profiling modules can hook up to
@@ -493,10 +636,20 @@ It is possible to obtain a stack trace of all the active threads in
 Mono by sending the QUIT signal to Mono, you can do this from the
 command line, like this:
 .nf
+
        kill -QUIT pid
+
 .fi
 Where pid is the Process ID of the Mono process you want to examine.
-The process will continue running afterwards.
+The process will continue running afterwards, but its state is not
+guaranteed.
+.PP
+.B Important:
+this is a last-resort mechanism for debugging applications and should
+not be used to monitor or probe a production application.  The
+integrity of the runtime after sending this signal is not guaranteed
+and the application might crash or terminate at any given point
+afterwards.   
 .PP
 You can use the MONO_LOG_LEVEL and MONO_LOG_MASK environment variables
 to get verbose debugging output about the execution of your
@@ -533,7 +686,7 @@ The following is a common use to track down problems with P/Invoke:
 .PP
 .SH SERIALIZATION
 Mono's XML serialization engine by default will use a reflection-based
-approach to serialize which might be slow for continous processing
+approach to serialize which might be slow for continuous processing
 (web service applications).  The serialization engine will determine
 when a class must use a hand-tuned serializer based on a few
 parameters and if needed it will produce a customized C# serializer
@@ -569,6 +722,12 @@ assemblies on demand and store the result into a cache in
 If set, this variable overrides the default system configuration directory
 ($PREFIX/etc). It's used to locate machine.config file.
 .TP
+.I "MONO_COM"
+Sets the style of COM interop.  If the value of this variable is "MS"
+Mono will use string marhsalling routines from the liboleaut32 for the
+BSTR type library, any other values will use the mono-builtin BSTR
+string marshalling.
+.TP
 .I "MONO_CONFIG"
 If set, this variable overrides the default runtime configuration file
 ($PREFIX/etc/mono/config). The --config command line options overrides the
@@ -594,7 +753,7 @@ given point.  This only displays the stack trace of a single thread.
 .I "keep-delegates"
 This option will leak delegate trampolines that are no longer
 referenced as to present the user with more information about a
-delegate missuse.  Basically a delegate instance might be created,
+delegate misuse.  Basically a delegate instance might be created,
 passed to unmanaged code, and no references kept in managed code,
 which will garbage collect the code.  With this option it is possible
 to track down the source of the problems. 
@@ -633,7 +792,7 @@ Possible values are:
 .Sp
 Persists event logs and entries to the local file system.
 .Sp
-The directory in which to persit the event logs, event sources and entries
+The directory in which to persist the event logs, event sources and entries
 can be specified as part of the value.
 .Sp
 If the path is not explicitly set, it defaults to "/var/lib/mono/eventlog"
@@ -712,10 +871,16 @@ directive, like this:
 .fi
 .TP
 .I "MONO_MANAGED_WATCHER"
-If set to any value, System.IO.FileSystemWatcher will use the default
-managed implementation (slow). If unset, mono will try to use FAM under
-Unix systems and native API calls on Windows, falling back to the
-managed implementation on error.
+If set to "disabled", System.IO.FileSystemWatcher will use a file watcher 
+implementation which silently ignores all the watching requests.
+If set to any other value, System.IO.FileSystemWatcher will use the default
+managed implementation (slow). If unset, mono will try to use inotify, FAM, 
+Gamin, kevent under Unix systems and native API calls on Windows, falling 
+back to the managed implementation on error.
+.TP
+.I "MONO_NO_SMP"
+If set causes the mono process to be bound to a single processor. This may be
+useful when debugging or working around race conditions.
 .TP
 .I "MONO_PATH"
 Provides a search path to the runtime where to look for library
@@ -737,7 +902,7 @@ http://www.mono-project.com/Guidelines:Application_Deployment page.
 .I "MONO_RTC"
 Experimental RTC support in the statistical profiler: if the user has
 the permission, more accurate statistics are gathered.  The MONO_RTC
-value must be restricted to what the linux rtc allows: power of two
+value must be restricted to what the Linux rtc allows: power of two
 from 64 to 8192 Hz. To enable higher frequencies like 4096 Hz, run as root:
 .nf
 
@@ -776,12 +941,30 @@ home directories that might be shared over the network.
 If set, extra checks are made during IO operations.  Currently, this
 includes only advisory locks around file writes.
 .TP
+.I "MONO_DISABLE_SHM"
+If set, disables the shared memory files used for cross-process
+handles: process have only private handles.  This means that process
+and thread handles are not available to other processes, and named
+mutexes, named events and named semaphores are not visible between
+processes.
+.Sp
+This is can also be enabled by default by passing the
+"--disable-shared-handles" option to configure.
+.TP
 .I "MONO_THEME"
 The name of the theme to be used by Windows.Forms.   Available themes today
 include "clearlooks", "nice" and "win32".
 .Sp
 The default is "win32".  
 .TP
+.I "MONO_TLS_SESSION_CACHE_TIMEOUT"
+The time, in seconds, that the SSL/TLS session cache will keep it's entry to
+avoid a new negotiation between the client and a server. Negotiation are very
+CPU intensive so an application-specific custom value may prove useful for 
+small embedded systems.
+.Sp
+The default is 180 seconds.
+.TP
 .I "MONO_THREADS_PER_CPU"
 The maximum number of threads in the general threadpool will be
 20 + (MONO_THREADS_PER_CPU * number of CPUs). The default value for this
@@ -799,6 +982,16 @@ the a custom serializer will be produced on the 50th use.
 Set this value to 1 to prevent the serializer from removing the
 temporary files that are created for fast serialization;  This might
 be useful when debugging.
+.TP
+.I "MONO_ASPNET_INHIBIT_SETTINGSMAP"
+Mono contains a feature which allows modifying settings in the .config files shipped
+with Mono by using config section mappers. The mappers and the mapping rules are
+defined in the $prefix/etc/mono/2.0/settings.map file and, optionally, in the
+settings.map file found in the top-level directory of your ASP.NET application.
+Both files are read by System.Web on application startup, if they are found at the
+above locations. If you don't want the mapping to be performed you can set this
+variable in your environment before starting the application and no action will
+be taken.
 .SH ENVIRONMENT VARIABLES FOR DEBUGGING
 .TP
 .I "MONO_ASPNET_NODELETE"
@@ -856,6 +1049,14 @@ with the X11 backend.  This is used to debug problems in Windows.Forms
 as it forces all of the commands send to X11 server to be done
 synchronously.   The default mode of operation is asynchronous which
 makes it hard to isolate the root of certain problems.
+.TP
+.I "MONO_GENERIC_SHARING"
+This environment variable is completely unsupported, don't use it.
+This controls for which classes to enable generic code sharing in
+principle.  Permissible values are "all", "corlib" and "none".  The
+default is "corlib", meaning that sharing can only happen for corlib
+classes.  Note that to enable generation of shared code the "gshared"
+compiler option has to be set as well.
 .SH VALGRIND
 If you want to use Valgrind, you will find the file `mono.supp'
 useful, it contains the suppressions for the GC which trigger