Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "[wasm] browser profiler (#77449)" #77759

Merged
merged 1 commit into from
Nov 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@
<PlatformManifestFileEntry Include="libmono-icall-table.a" IsNative="true" />
<PlatformManifestFileEntry Include="libmono-ilgen.a" IsNative="true" />
<PlatformManifestFileEntry Include="libmono-profiler-aot.a" IsNative="true" />
<PlatformManifestFileEntry Include="libmono-profiler-browser.a" IsNative="true" />
<PlatformManifestFileEntry Include="libmono-wasm-eh-js.a" IsNative="true" />
<PlatformManifestFileEntry Include="libmono-wasm-eh-wasm.a" IsNative="true" />
<PlatformManifestFileEntry Include="dotnet.js" IsNative="true" />
Expand Down
3 changes: 0 additions & 3 deletions src/mono/mono.proj
Original file line number Diff line number Diff line change
Expand Up @@ -905,9 +905,6 @@
<_MonoRuntimeArtifacts Condition="'$(TargetsBrowser)' == 'true' and '$(BuildMonoAOTCrossCompilerOnly)' != 'true'" Include="$(MonoObjDir)out\lib\libmono-profiler-aot.a">
<Destination>$(RuntimeBinDir)libmono-profiler-aot.a</Destination>
</_MonoRuntimeArtifacts>
<_MonoRuntimeArtifacts Condition="'$(TargetsBrowser)' == 'true' and '$(BuildMonoAOTCrossCompilerOnly)' != 'true'" Include="$(MonoObjDir)out\lib\libmono-profiler-browser.a">
<Destination>$(RuntimeBinDir)libmono-profiler-browser.a</Destination>
</_MonoRuntimeArtifacts>
<_MonoRuntimeArtifacts Condition="'$(TargetsBrowser)' == 'true' and '$(BuildMonoAOTCrossCompilerOnly)' != 'true'" Include="$(MonoObjDir)out\lib\libmono-wasm-eh-js.a">
<Destination>$(RuntimeBinDir)libmono-wasm-eh-js.a</Destination>
</_MonoRuntimeArtifacts>
Expand Down
16 changes: 0 additions & 16 deletions src/mono/mono/metadata/profiler.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ typedef void (*MonoProfilerInitializer) (const char *);
#define OLD_INITIALIZER_NAME "mono_profiler_startup"
#define NEW_INITIALIZER_NAME "mono_profiler_init"

#if defined(TARGET_WASM) && defined(MONO_CROSS_COMPILE)
MONO_API void mono_profiler_init_browser (const char *desc);
#endif

static gboolean
load_profiler (MonoDl *module, const char *name, const char *desc)
{
Expand Down Expand Up @@ -152,9 +148,6 @@ load_profiler_from_installation (const char *libname, const char *name, const ch
*
* This function may \b only be called by embedders prior to running managed
* code.
*
* This could could be triggered by \c MONO_PROFILE env variable in normal mono process or
* by \c --profile=foo argument to mono-aot-cross.exe command line.
*/
void
mono_profiler_load (const char *desc)
Expand All @@ -178,15 +171,6 @@ mono_profiler_load (const char *desc)
mname = g_strdup (desc);
}

#if defined(TARGET_WASM) && defined(MONO_CROSS_COMPILE)
// this code could be running as part of mono-aot-cross.exe
// in case of WASM we staticaly link in the browser.c profiler plugin
if(strcmp (mname, "browser") == 0) {
mono_profiler_init_browser (desc);
goto done;
}
#endif

if (load_profiler_from_executable (mname, desc))
goto done;

Expand Down
8 changes: 1 addition & 7 deletions src/mono/mono/mini/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -325,13 +325,7 @@ else()
set(llvm_runtime_sources)
endif()

if(TARGET_WASM AND MONO_CROSS_COMPILE)
set(profiler_sources ../profiler/browser.c)
else()
set(profiler_sources "")
endif()

set(mini_sources "main-core.c;${mini_common_sources};${arch_sources};${os_sources};${mini_interp_sources};${llvm_sources};${debugger_sources};${profiler_sources};${llvm_runtime_sources}")
set(mini_sources "main-core.c;${mini_common_sources};${arch_sources};${os_sources};${mini_interp_sources};${llvm_sources};${debugger_sources};${llvm_runtime_sources}")

if(LLVM_INCLUDEDIR)
include_directories(BEFORE SYSTEM "${LLVM_INCLUDEDIR}")
Expand Down
7 changes: 0 additions & 7 deletions src/mono/mono/profiler/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,4 @@ if(NOT DISABLE_LIBS)
set_target_properties(mono-profiler-aot-static PROPERTIES OUTPUT_NAME mono-profiler-aot)
install(TARGETS mono-profiler-aot-static LIBRARY)
endif()

if(HOST_WASM)
add_library(mono-profiler-browser-static STATIC browser.c)
target_link_libraries(mono-profiler-browser-static monoapi)
set_target_properties(mono-profiler-browser-static PROPERTIES OUTPUT_NAME mono-profiler-browser)
install(TARGETS mono-profiler-browser-static LIBRARY)
endif()
endif()
107 changes: 0 additions & 107 deletions src/mono/mono/profiler/browser.c

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
<EmccExtraLDFlags> -s USE_CLOSURE_COMPILER=1 -s LEGACY_GL_EMULATION=1 -lGL -lSDL -lidbfs.js</EmccExtraLDFlags>
<!-- just to prove we don't do JS eval() -->
<_ServeHeaders>$(_ServeHeaders) -h &quot;Content-Security-Policy: default-src 'self' 'wasm-unsafe-eval'&quot;</_ServeHeaders>
<!-- enable reporting to profiler in browser dev tools -->
<WasmProfilers>browser;</WasmProfilers>
</PropertyGroup>
<ItemGroup>
<!-- add export GL object from Module -->
Expand Down
3 changes: 1 addition & 2 deletions src/mono/sample/wasm/browser-advanced/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ try {
// This is called during emscripten `dotnet.wasm` instantiation, after we fetched config.
console.log('user code Module.onConfigLoaded');
// config is loaded and could be tweaked before the rest of the runtime startup sequence
config.environmentVariables["MONO_LOG_LEVEL"] = "debug";
config.browserProfilerOptions = {};
config.environmentVariables["MONO_LOG_LEVEL"] = "debug"
},
preInit: () => { console.log('user code Module.preInit'); },
preRun: () => { console.log('user code Module.preRun'); },
Expand Down
2 changes: 1 addition & 1 deletion src/mono/sample/wasm/browser-profile/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ TOP=../../../../..
include ../wasm.mk

PROJECT_NAME=Wasm.BrowserProfile.Sample.csproj
BUILD_ARGS=/p:WasmBuildNative=true
BUILD_ARGS=/p:WasmBuildNative=true /p:EnableProfiler=true
BUILD_PROFILED_ARGS=/p:RunAOTCompilation=true /p:AOTProfilePath=$(PROFILE_PATH)

run: run-browser
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
<WasmMainJSPath>main.js</WasmMainJSPath>
<WasmProfilers>aot;</WasmProfilers>
<WasmBuildNative>true</WasmBuildNative>
<WasmNativeStrip>false</WasmNativeStrip>
</PropertyGroup>

<ItemGroup>
<WasmExtraConfig Include="enableProfiler" Value="true" />
<WasmExtraFilesToDeploy Include="index.html" />
</ItemGroup>

Expand Down
2 changes: 0 additions & 2 deletions src/mono/wasm/build/WasmApp.Native.targets
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@
<_EmccCFlags Include="-DINVARIANT_GLOBALIZATION=1" Condition="'$(InvariantGlobalization)' == 'true'" />
<_EmccCFlags Include="-DLINK_ICALLS=1" Condition="'$(WasmLinkIcalls)' == 'true'" />
<_EmccCFlags Include="-DENABLE_AOT_PROFILER=1" Condition="$(WasmProfilers.Contains('aot'))" />
<_EmccCFlags Include="-DENABLE_BROWSER_PROFILER=1" Condition="$(WasmProfilers.Contains('browser'))" />
<_EmccCFlags Include="-DCORE_BINDINGS" />
<_EmccCFlags Include="-DGEN_PINVOKE=1" />
<_EmccCFlags Include="-emit-llvm" />
Expand Down Expand Up @@ -599,7 +598,6 @@
AOTProfilePath="$(AOTProfilePath)"
AotModulesTablePath="$(_DriverGenCPath)"
UseLLVM="true"
Profilers="$(WasmProfilers)"
DisableParallelAot="$(DisableParallelAot)"
DedupAssembly="$(_WasmDedupAssembly)"
CacheFilePath="$(_AOTCompilerCacheFile)"
Expand Down
2 changes: 1 addition & 1 deletion src/mono/wasm/build/WasmApp.targets
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
- @(WasmNativeAsset) - Native files to be added to `NativeAssets` in the bundle.

- @(WasmExtraConfig) - json elements to add to `mono-config.json`
Eg. <WasmExtraConfig Include="xxx" Value="true" />
Eg. <WasmExtraConfig Include="enableProfiler" Value="true" />

- Value attribute can have a number, bool, quoted string, or json string

Expand Down
1 change: 0 additions & 1 deletion src/mono/wasm/runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ target_link_libraries(dotnet
${MONO_ARTIFACTS_DIR}/libmono-icall-table.a
${MONO_ARTIFACTS_DIR}/libmono-wasm-eh-js.a
${MONO_ARTIFACTS_DIR}/libmono-profiler-aot.a
${MONO_ARTIFACTS_DIR}/libmono-profiler-browser.a
${NATIVE_BIN_DIR}/libSystem.Native.a
${NATIVE_BIN_DIR}/libSystem.IO.Compression.Native.a)

Expand Down
3 changes: 0 additions & 3 deletions src/mono/wasm/runtime/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { mono_wasm_load_icu_data } from "./icu";
import { ENVIRONMENT_IS_NODE, ENVIRONMENT_IS_SHELL, ENVIRONMENT_IS_WEB, Module, runtimeHelpers } from "./imports";
import { mono_wasm_load_bytes_into_heap } from "./memory";
import { MONO } from "./net6-legacy/imports";
import { endMeasure, MeasuredBlock, startMeasure } from "./profiler";
import { createPromiseController, PromiseAndController } from "./promise-controller";
import { delay } from "./promise-utils";
import { abort_startup, beforeOnRuntimeInitialized } from "./startup";
Expand Down Expand Up @@ -347,7 +346,6 @@ function download_resource(request: ResourceRequest): LoadingResource {
function _instantiate_asset(asset: AssetEntry, url: string, bytes: Uint8Array) {
if (runtimeHelpers.diagnosticTracing)
console.debug(`MONO_WASM: Loaded:${asset.name} as ${asset.behavior} size ${bytes.length} from ${url}`);
const mark = startMeasure();

const virtualName: string = typeof (asset.virtualPath) === "string"
? asset.virtualPath
Expand Down Expand Up @@ -424,7 +422,6 @@ function _instantiate_asset(asset: AssetEntry, url: string, bytes: Uint8Array) {
else if (asset.behavior === "resource") {
cwraps.mono_wasm_add_satellite_assembly(virtualName, asset.culture!, offset!, bytes.length);
}
endMeasure(mark, MeasuredBlock.instantiateAsset, asset.name);
++actual_instantiated_assets_count;
}

Expand Down
8 changes: 2 additions & 6 deletions src/mono/wasm/runtime/cwraps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ const fn_signatures: SigLine[] = [
[true, "mono_wasm_getenv", "number", ["string"]],
[true, "mono_wasm_set_main_args", "void", ["number", "number"]],
[false, "mono_wasm_enable_on_demand_gc", "void", ["number"]],
[false, "mono_wasm_profiler_init_aot", "void", ["number"]],
[false, "mono_wasm_profiler_init_browser", "void", ["number"]],
[false, "mono_profiler_init_aot", "void", ["number"]],
[false, "mono_wasm_exec_regression", "number", ["number", "string"]],
[false, "mono_wasm_invoke_method_bound", "number", ["number", "number"]],
[true, "mono_wasm_write_managed_pointer_unsafe", "void", ["number", "number"]],
Expand All @@ -94,7 +93,6 @@ const fn_signatures: SigLine[] = [
[true, "mono_wasm_u52_to_f64", "number", ["number", "number"]],
[true, "mono_wasm_f64_to_i52", "number", ["number", "number"]],
[true, "mono_wasm_f64_to_u52", "number", ["number", "number"]],
[true, "mono_wasm_method_get_name", "number", ["number"]],
];

export interface t_Cwraps {
Expand Down Expand Up @@ -195,8 +193,7 @@ export interface t_Cwraps {
mono_wasm_getenv(name: string): CharPtr;
mono_wasm_enable_on_demand_gc(enable: number): void;
mono_wasm_set_main_args(argc: number, argv: VoidPtr): void;
mono_wasm_profiler_init_aot(desc: string): void;
mono_wasm_profiler_init_browser(desc: string): void;
mono_profiler_init_aot(desc: string): void;
mono_wasm_exec_regression(verbose_level: number, image: string): number;
mono_wasm_invoke_method_bound(method: MonoMethod, args: JSMarshalerArguments): MonoString;
mono_wasm_write_managed_pointer_unsafe(destination: VoidPtr | MonoObjectRef, pointer: ManagedPointer): void;
Expand All @@ -206,7 +203,6 @@ export interface t_Cwraps {
mono_wasm_f64_to_i52(destination: VoidPtr, value: number): I52Error;
mono_wasm_f64_to_u52(destination: VoidPtr, value: number): I52Error;
mono_wasm_runtime_run_module_cctor(assembly: MonoAssembly): void;
mono_wasm_method_get_name(method: MonoMethod): CharPtr;
}

const wrapped_c_functions: t_Cwraps = <any>{};
Expand Down
19 changes: 1 addition & 18 deletions src/mono/wasm/runtime/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ int32_t monoeg_g_hasenv(const char *variable);
void mono_free (void*);
int32_t mini_parse_debug_option (const char *option);
char *mono_method_get_full_name (MonoMethod *method);
char *mono_method_full_name (MonoMethod *method, int signature);

static void mono_wasm_init_finalizer_thread (void);

Expand Down Expand Up @@ -1400,25 +1399,13 @@ mono_wasm_copy_managed_pointer (PPVOLATILE(MonoObject) destination, PPVOLATILE(M
void mono_profiler_init_aot (const char *desc);

EMSCRIPTEN_KEEPALIVE void
mono_wasm_profiler_init_aot (const char *desc)
mono_wasm_load_profiler_aot (const char *desc)
{
mono_profiler_init_aot (desc);
}

#endif

#ifdef ENABLE_BROWSER_PROFILER

void mono_profiler_init_browser (const char *desc);

EMSCRIPTEN_KEEPALIVE void
mono_wasm_profiler_init_browser (const char *desc)
{
mono_profiler_init_browser (desc);
}

#endif

static void
mono_wasm_init_finalizer_thread (void)
{
Expand Down Expand Up @@ -1480,7 +1467,3 @@ EMSCRIPTEN_KEEPALIVE int mono_wasm_f64_to_i52 (int64_t *destination, double valu
*destination = (int64_t)value;
return I52_ERROR_NONE;
}

EMSCRIPTEN_KEEPALIVE const char* mono_wasm_method_get_name (MonoMethod *method) {
return mono_method_full_name(method, 0);
}
4 changes: 0 additions & 4 deletions src/mono/wasm/runtime/es6/dotnet.es6.lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,6 @@ const linked_functions = [
// mono-threads-wasm.c
"schedule_background_exec",

// interp.c
"mono_wasm_profiler_enter",
"mono_wasm_profiler_leave",

// driver.c
"mono_wasm_invoke_js_blazor",
"mono_wasm_trace_logger",
Expand Down
6 changes: 2 additions & 4 deletions src/mono/wasm/runtime/exports-internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ export function export_internal(): any {
// tests
mono_wasm_exit: (exit_code: number) => { Module.printErr("MONO_WASM: early exit " + exit_code); },
mono_wasm_enable_on_demand_gc: cwraps.mono_wasm_enable_on_demand_gc,
mono_wasm_profiler_init_aot: cwraps.mono_wasm_profiler_init_aot,
mono_wasm_profiler_init_browser: cwraps.mono_wasm_profiler_init_browser,
mono_profiler_init_aot: cwraps.mono_profiler_init_aot,
mono_wasm_exec_regression: cwraps.mono_wasm_exec_regression,
mono_method_resolve,//MarshalTests.cs
mono_intern_string,// MarshalTests.cs
Expand Down Expand Up @@ -82,8 +81,7 @@ export function cwraps_internal(internal: any): void {
Object.assign(internal, {
mono_wasm_exit: cwraps.mono_wasm_exit,
mono_wasm_enable_on_demand_gc: cwraps.mono_wasm_enable_on_demand_gc,
mono_wasm_profiler_init_aot: cwraps.mono_wasm_profiler_init_aot,
mono_wasm_profiler_init_browser: cwraps.mono_wasm_profiler_init_browser,
mono_profiler_init_aot: cwraps.mono_profiler_init_aot,
mono_wasm_exec_regression: cwraps.mono_wasm_exec_regression,
});
}
Loading