Add a --enable-minimal=eventpipe configure option. Disable eventpipe on wasm. (#38991)
authorZoltan Varga <vargaz@gmail.com>
Fri, 17 Jul 2020 16:28:21 +0000 (12:28 -0400)
committerGitHub <noreply@github.com>
Fri, 17 Jul 2020 16:28:21 +0000 (12:28 -0400)
* Add a --enable-minimal=eventpipe configure option. Disable eventpipe on wasm.

* Address review comments.

* Disable FeaturePerfTracing for wasm.

* Disable calls to ep_init()/ep_cleanup() as well.

src/mono/configure.ac
src/mono/mono.proj
src/mono/mono/metadata/icall-eventpipe.c
src/mono/mono/mini/mini-runtime.c
src/mono/netcore/System.Private.CoreLib/System.Private.CoreLib.csproj

index d324c29..1b95d75 100644 (file)
@@ -950,16 +950,6 @@ if test x$with_core = xonly; then
 fi
 AM_CONDITIONAL(ENABLE_NETCORE, test x$with_core = xonly)
 
-if test x$with_core = xonly; then
-       if test -f $srcdir/mono/eventpipe/ep.h; then
-               enable_perftracing=yes
-       fi
-       if test x$enable_perftracing = xyes; then
-               AC_DEFINE(ENABLE_PERFTRACING,1,[Enables support for eventpipe library])
-       fi
-fi
-AM_CONDITIONAL(ENABLE_PERFTRACING, test x$enable_perftracing = xyes)
-
 #
 # A sanity check to catch cases where the package was unpacked
 # with an ancient tar program (Solaris)
@@ -1795,7 +1785,7 @@ AM_CONDITIONAL(ENABLE_STATIC_GCC_LIBS, test "x$enable_static_gcc_libs" = "xyes")
 AC_ARG_ENABLE(minimal, [  --enable-minimal=LIST      drop support for LIST subsystems.
      LIST is a comma-separated list from: aot, profiler, decimal, pinvoke, debug, appdomains, verifier, dllmap,
      reflection_emit, reflection_emit_save, large_code, logging, com, ssa, generics, attach, jit, interpreter, simd, soft_debug, perfcounters, normalization, desktop_loader, shared_perfcounters, remoting,
-        security, lldb, mdb, assert_messages, config, cfgdir_config, cleanup, sgen_marksweep_conc, sgen_split_nursery, sgen_gc_bridge, sgen_debug_helpers, sockets, gac, threads, processes.],
+        security, lldb, mdb, assert_messages, config, cfgdir_config, cleanup, sgen_marksweep_conc, sgen_split_nursery, sgen_gc_bridge, sgen_debug_helpers, sockets, gac, threads, processes, eventpipe.],
 [
        for feature in `echo "$enable_minimal" | sed -e "s/,/ /g"`; do
                eval "mono_feature_disable_$feature='yes'"
@@ -1991,7 +1981,6 @@ if test "x$mono_feature_disable_sgen_marksweep_conc" = "xyes"; then
        AC_MSG_NOTICE([Disabled concurrent gc support in SGEN.])
 fi
 
-
 if test "x$mono_feature_disable_sgen_split_nursery" = "xyes"; then
        AC_DEFINE(DISABLE_SGEN_SPLIT_NURSERY, 1, [Disable minor=split support in SGEN.])
        AC_MSG_NOTICE([Disabled minor=split support in SGEN.])
@@ -2032,6 +2021,22 @@ if test "x$mono_feature_disable_processes" = "xyes"; then
        AC_MSG_NOTICE([Disabled process support])
 fi
 
+if test "x$mono_feature_disable_eventpipe" = "xyes"; then
+       AC_DEFINE(DISABLE_EVENTPIPE, 1, [Disable EventPipe support])
+       AC_MSG_NOTICE([Disabled EventPipe support])
+       enable_perftracing=no
+fi
+
+if test x$enable_perftracing = x -a x$with_core = xonly; then
+       if test -f $srcdir/mono/eventpipe/ep.h; then
+               enable_perftracing=yes
+       fi
+fi
+if test x$enable_perftracing = xyes; then
+       AC_DEFINE(ENABLE_PERFTRACING,1,[Enables support for eventpipe library])
+fi
+AM_CONDITIONAL(ENABLE_PERFTRACING, test x$enable_perftracing = xyes)
+
 AC_ARG_ENABLE(executables, [  --disable-executables disable the build of the runtime executables], enable_executables=$enableval, enable_executables=yes)
 AM_CONDITIONAL(DISABLE_EXECUTABLES, test x$enable_executables = xno)
 
index 502e217..08c5c1e 100644 (file)
       <_MonoConfigureParams Include="--disable-crash-reporting"/>
       <_MonoConfigureParams Include="--with-bitcode=yes"/>
       <_MonoConfigureParams Include="--with-static-icu=yes"/>
-      <_MonoConfigureParams Include="--enable-minimal=ssa,com,jit,reflection_emit_save,portability,assembly_remapping,attach,verifier,full_messages,appdomains,shadowcopy,security,sgen_marksweep_conc,sgen_split_nursery,sgen_gc_bridge,logging,remoting,shared_perfcounters,sgen_debug_helpers,soft_debug,interpreter,assert_messages,cleanup,mdb,gac,threads,$(_MonoEnableMinimal)"/>
+      <_MonoConfigureParams Include="--enable-minimal=ssa,com,jit,reflection_emit_save,portability,assembly_remapping,attach,verifier,full_messages,appdomains,shadowcopy,security,sgen_marksweep_conc,sgen_split_nursery,sgen_gc_bridge,logging,remoting,shared_perfcounters,sgen_debug_helpers,soft_debug,interpreter,assert_messages,cleanup,mdb,gac,threads,eventpipe,$(_MonoEnableMinimal)"/>
       <_MonoCFLAGS Include="-fexceptions" />
       <_MonoCFLAGS Include="-I$(PkgMicrosoft_NETCore_Runtime_ICU_Transport)/runtimes/browser-wasm/native/include" />
       <_MonoCXXFLAGS Include="-fexceptions" />
index 6ee7bdb..4222ffb 100644 (file)
@@ -5,7 +5,7 @@
 #ifdef ENABLE_NETCORE
 #include <mono/metadata/icall-decl.h>
 
-#ifdef ENABLE_PERFTRACING
+#if defined(ENABLE_PERFTRACING) && !defined(DISABLE_EVENTPIPE)
 #include <mono/eventpipe/ep-rt-config.h>
 #include <mono/eventpipe/ep.h>
 #include <mono/eventpipe/ep-event.h>
index 94a7292..c180d30 100644 (file)
@@ -4540,7 +4540,7 @@ mini_init (const char *filename, const char *runtime_version)
        else
                domain = mono_init_from_assembly (filename, filename);
 
-#ifdef ENABLE_PERFTRACING
+#if defined(ENABLE_PERFTRACING) && !defined(DISABLE_EVENTPIPE)
        ep_init ();
 #endif
 
@@ -4987,7 +4987,7 @@ mini_cleanup (MonoDomain *domain)
        jit_stats_cleanup ();
        mono_jit_dump_cleanup ();
        mini_get_interp_callbacks ()->cleanup ();
-#ifdef ENABLE_PERFTRACING
+#if defined(ENABLE_PERFTRACING) && !defined(DISABLE_EVENTPIPE)
        ep_shutdown ();
 #endif
 }
index 62c8e53..95e1e72 100644 (file)
     <FeatureManagedEtw>true</FeatureManagedEtw>
     <FeaturePortableTimer Condition="'$(TargetsBrowser)' != 'true'">true</FeaturePortableTimer>
     <FeaturePortableThreadPool Condition="'$(TargetsBrowser)' != 'true'">true</FeaturePortableThreadPool>
-    <FeaturePerfTracing>true</FeaturePerfTracing>
+    <FeaturePerfTracing Condition="'$(TargetsBrowser)' != 'true'">true</FeaturePerfTracing>
     <FeatureDefaultInterfaces>true</FeatureDefaultInterfaces>
   </PropertyGroup>