-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[wasm-ep] Minimal diagnostic tracing configuration and sample #69158
Conversation
if threading is enabled for the runtime internally, but disabled for user code, throw PNSE
change the sample to do some work asynchronously using setTimeout instead of blocking
Binds enable, start, disable methods defaulting to non-streaming FILE mode
overlapped io events
Tagging subscribers to 'arch-wasm': @lewing Issue Details
|
/cc @kg @lateralusX |
/cc @pavelsavara |
two ways of retreiving the collected traces instead of exposing the emscripten VFS directly. Probably the Blob one is enough. Is there any reason to also provide a data URI? update the sample to use URL.createObjectURL (session.getTraceBlob()) to create the download link
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The EventPipe bits looks good, just a couple of small comments/thoughts.
Any other feedback? |
/azp run runtime-wasm |
Azure Pipelines successfully started running 1 pipeline(s). |
globalThis.MONO = MONO; | ||
console.log('after createDotnetRuntime') | ||
|
||
const startWork = BINDING.bind_static_method("[Wasm.Browser.EventPipe.Sample] Sample.Test:StartAsyncWork"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we rely on the non-Main methods in the sample maybe just put a single line comment in Program.cs's Main to indicate that the reader should look in main.js for the juicy bits
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/mono/wasm/runtime/memory.ts
Outdated
@@ -114,3 +115,33 @@ export function getF32(offset: _MemOffset): number { | |||
export function getF64(offset: _MemOffset): number { | |||
return Module.HEAPF64[<any>offset >>> 3]; | |||
} | |||
|
|||
export function getCU64(offset: _MemOffset): cuint64.CUInt64 { | |||
const lo = getI32(offset); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these actually be signed? It seems like they should be unsigned.
export declare type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can also use ArrayBufferView in place of this, though it has the downside of that interface inexplicably not having .length. Just an FYI, I'm fine with us defining a TypedArray alias (do the bigint arrays need to go in here too?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't change anything here. I think eslint just added or removed a newline.
/azp run runtime-wasm |
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adds a
/p:WasmEnablePerfTracing=true
configuration.In this configuration the runtime is built with threading (
MonoWasmThreads
property is true), but C# code is not allowed to start threads and doesn't use the portable thradpool (MonoWasmThreadsNoUser
property is also true).The upshot is that EventPipe can start threads but user code is still single-threaded.
Adds a
MONO.diagnostics
interface in JavaScript. There's a single method for nowcreateEventPipeSession
which creates a session that can save a trace to a file on the virtual file system. JS code (or a user in a dev console) needs to callstart()
andstop()
on the session object to begin collecting samples. For now there's no way to specify any configuration options other than the destination VFS file path for the trace file.Adds a sample that runs an async task for five seconds and collects samples and then triggers a
click()
to download the trace file out of the browser.