Skip to content

Commit 69fb4fe

Browse files
authored
[browser][event-pipe] EventPipe diagnostic server TypeScript for CoreCLR (#126830)
1 parent 6f9c8fc commit 69fb4fe

41 files changed

Lines changed: 1207 additions & 50 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/mono/browser/runtime/cwraps.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const fn_signatures: SigLine[] = [
4141
[true, "mono_wasm_parse_runtime_options", null, ["number", "number"]],
4242
[true, "mono_wasm_strdup", "number", ["string"]],
4343
[true, "mono_background_exec", null, []],
44-
[true, "mono_wasm_ds_exec", null, []],
44+
[true, "SystemJS_ExecuteDiagnosticServerCallback", null, []],
4545
[true, "mono_wasm_execute_timer", null, []],
4646
[true, "wasm_load_icu_data", "number", ["number"]],
4747
[false, "mono_wasm_add_assembly", "number", ["string", "number", "number"]],
@@ -168,7 +168,7 @@ export interface t_Cwraps {
168168
mono_wasm_strdup(value: string): number;
169169
mono_wasm_parse_runtime_options(length: number, argv: VoidPtr): void;
170170
mono_background_exec(): void;
171-
mono_wasm_ds_exec(): void;
171+
SystemJS_ExecuteDiagnosticServerCallback(): void;
172172
mono_wasm_execute_timer(): void;
173173
wasm_load_icu_data(offset: VoidPtr): number;
174174
mono_wasm_add_assembly(name: string, data: VoidPtr, size: number): number;

src/mono/browser/runtime/diagnostics/client-commands.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export function commandGcHeapDump (options:DiagnosticCommandOptions) {
6666
// GC_KEYWORD 0x0000001
6767
],
6868
logLevel: 5,
69-
provider_name: "Microsoft-Windows-DotNETRuntime",
69+
providerName: "Microsoft-Windows-DotNETRuntime",
7070
arguments: null
7171
},
7272
...options.extraProviders || [],
@@ -89,7 +89,7 @@ export function commandCounters (options:DiagnosticCommandOptions) {
8989
{
9090
keywords: [0, Keywords.GCHandle],
9191
logLevel: 4,
92-
provider_name: "System.Diagnostics.Metrics",
92+
providerName: "System.Diagnostics.Metrics",
9393
arguments: `SessionId=SHARED;Metrics=System.Runtime;RefreshInterval=${options.intervalSeconds || 1};MaxTimeSeries=1000;MaxHistograms=10;ClientId=${uuidv4()};`,
9494
},
9595
...options.extraProviders || [],
@@ -109,7 +109,7 @@ export function commandSampleProfiler (options:DiagnosticCommandOptions) {
109109
0x0000_0000,
110110
],
111111
logLevel: 4,
112-
provider_name: "Microsoft-DotNETCore-SampleProfiler",
112+
providerName: "Microsoft-DotNETCore-SampleProfiler",
113113
arguments: null
114114
},
115115
...options.extraProviders || [],
@@ -130,7 +130,7 @@ function commandCollectTracing2 (payload2:PayloadV2) {
130130
for (const provider of payload2.providers) {
131131
message.push(...serializeUint64(provider.keywords));
132132
message.push(...serializeUint32(provider.logLevel));
133-
message.push(...serializeString(provider.provider_name));
133+
message.push(...serializeString(provider.providerName));
134134
message.push(...serializeString(provider.arguments));
135135
}
136136
return Uint8Array.from(message);
@@ -199,7 +199,7 @@ const enum Keywords {
199199
Exception = 0x8000,
200200
//
201201
// Summary:
202-
// Log events associated with the threadpoo, and other threading events.
202+
// Log events associated with the threadpool, and other threading events.
203203
Threading = 0x10000,
204204
//
205205
// Summary:
@@ -259,7 +259,7 @@ const enum Keywords {
259259
// This suppresses NGEN events on V4.0 (where you have NGEN PDBs), but not on V2.0
260260
// (which does not know about this bit and also does not have NGEN PDBS).
261261
// eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values
262-
SupressNGen = 0x40000,
262+
SuppressNGen = 0x40000,
263263
//
264264
// Summary:
265265
// TODO document
@@ -427,7 +427,7 @@ function computeCollectTracing2PayloadByteLength (payload2:PayloadV2) {
427427
for (const provider of payload2.providers) {
428428
len += 8; // keywords
429429
len += 4; // level
430-
len += computeStringByteLength(provider.provider_name);
430+
len += computeStringByteLength(provider.providerName);
431431
len += computeStringByteLength(provider.arguments);
432432
}
433433
return len;
@@ -436,7 +436,7 @@ function computeCollectTracing2PayloadByteLength (payload2:PayloadV2) {
436436
type ProviderV2 ={
437437
keywords: [ number, Keywords ],
438438
logLevel: number,
439-
provider_name: string,
439+
providerName: string,
440440
arguments: string|null
441441
}
442442

src/mono/browser/runtime/diagnostics/common.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export function diagnosticServerEventLoop () {
1616
if (loaderHelpers.is_runtime_running()) {
1717
try {
1818
runtimeHelpers.mono_background_exec();// give GC chance to run
19-
runtimeHelpers.mono_wasm_ds_exec();
19+
runtimeHelpers.SystemJS_ExecuteDiagnosticServerCallback();
2020
scheduleDiagnosticServerEventLoop(100);
2121
} catch (ex) {
2222
loaderHelpers.mono_exit(1, ex);

src/mono/browser/runtime/diagnostics/diagnostics-ws.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class DiagnosticConnectionWS extends DiagnosticConnectionBase implements IDiagno
2727
};
2828
ws.addEventListener("open", () => {
2929
for (const data of this.messagesToSend) {
30-
ws.send(data);
30+
ws.send(data as any);
3131
}
3232
this.messagesToSend = [];
3333
diagnosticServerEventLoop();
@@ -49,7 +49,7 @@ class DiagnosticConnectionWS extends DiagnosticConnectionBase implements IDiagno
4949
return super.store(message);
5050
}
5151

52-
this.ws!.send(message);
52+
this.ws!.send(message as any);
5353

5454
return message.length;
5555
}

src/mono/browser/runtime/dotnet.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ type DiagnosticsAPIType = {
718718
type DiagnosticCommandProviderV2 = {
719719
keywords: [number, number];
720720
logLevel: number;
721-
provider_name: string;
721+
providerName: string;
722722
arguments: string | null;
723723
};
724724
type DiagnosticCommandOptions = {

src/mono/browser/runtime/exports.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function initializeExports (globalObjects: GlobalObjects): RuntimeAPI {
4444
utf8ToString,
4545
SystemJS_GetCurrentProcessId,
4646
mono_background_exec: () => tcwraps.mono_background_exec(),
47-
mono_wasm_ds_exec: () => tcwraps.mono_wasm_ds_exec(),
47+
SystemJS_ExecuteDiagnosticServerCallback: () => tcwraps.SystemJS_ExecuteDiagnosticServerCallback(),
4848
};
4949
if (WasmEnableThreads) {
5050
rh.dumpThreads = mono_wasm_dump_threads;

src/mono/browser/runtime/types/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ export type DiagnosticsAPIType = {
703703
export type DiagnosticCommandProviderV2 = {
704704
keywords: [ number, number ],
705705
logLevel: number,
706-
provider_name: string,
706+
providerName: string,
707707
arguments: string|null
708708
}
709709

src/mono/browser/runtime/types/internal.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ export type RuntimeHelpers = {
240240
mono_wasm_print_thread_dump: () => void,
241241
utf8ToString: (ptr: CharPtr) => string,
242242
mono_background_exec: () => void,
243-
mono_wasm_ds_exec: () => void,
243+
SystemJS_ExecuteDiagnosticServerCallback: () => void,
244244
SystemJS_GetCurrentProcessId: () => number,
245245
}
246246

src/mono/mono/eventpipe/ep-rt-mono.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,7 +1011,7 @@ ep_rt_queue_job (
10111011
// see if it's done or needs to be scheduled again
10121012
if (!done) {
10131013
// self schedule again
1014-
mono_schedule_ds_job (cb, params);
1014+
SystemJS_DiagnosticServerQueueJob (cb, params);
10151015
}
10161016

10171017
return true;
@@ -1045,7 +1045,7 @@ ep_rt_thread_sleep (uint64_t ns)
10451045
g_usleep ((gulong)(ns / 1000));
10461046
MONO_EXIT_GC_SAFE;
10471047
}
1048-
#endif
1048+
#endif // PERFTRACING_DISABLE_THREADS
10491049
}
10501050

10511051
static

src/mono/mono/mini/mini-wasm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ G_BEGIN_DECLS
453453
#ifdef DISABLE_THREADS
454454
EMSCRIPTEN_KEEPALIVE void mono_wasm_execute_timer (void);
455455
EMSCRIPTEN_KEEPALIVE void mono_background_exec (void);
456-
EMSCRIPTEN_KEEPALIVE void mono_wasm_ds_exec (void);
456+
EMSCRIPTEN_KEEPALIVE void SystemJS_ExecuteDiagnosticServerCallback (void);
457457
extern void SystemJS_ScheduleTimerImpl (int shortestDueTimeMs);
458458
#else
459459
extern void SystemJS_ScheduleSynchronizationContext(MonoNativeThreadId target_thread);

0 commit comments

Comments
 (0)