Skip to content

feat(types): Add missing Profiling types (macho debug image, profile measurements, stack frame properties) #9277

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

Merged
merged 12 commits into from
Oct 19, 2023
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
10 changes: 9 additions & 1 deletion packages/types/src/debugMeta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export interface DebugMeta {
images?: Array<DebugImage>;
}

export type DebugImage = WasmDebugImage | SourceMapDebugImage;
export type DebugImage = WasmDebugImage | SourceMapDebugImage | MachoDebugImage;

interface WasmDebugImage {
type: 'wasm';
Expand All @@ -20,3 +20,11 @@ interface SourceMapDebugImage {
code_file: string; // filename
debug_id: string; // uuid
}

interface MachoDebugImage {
type: 'macho';
debug_id: string;
image_addr: string;
image_size?: number;
code_file?: string;
}
19 changes: 18 additions & 1 deletion packages/types/src/profiling.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,29 @@
import type { DebugImage } from './debugMeta';
import type { MeasurementUnit } from './measurement';

export type ThreadId = string;
export type FrameId = number;
export type StackId = number;

export interface ThreadCpuSample {
stack_id: StackId;
thread_id: ThreadId;
queue_address?: string;
elapsed_since_start_ns: string;
}

export type ThreadCpuStack = FrameId[];

export type ThreadCpuFrame = {
function: string;
function?: string;
file?: string;
lineno?: number;
colno?: number;
abs_path?: string;
platform?: string;
instruction_addr?: string;
module?: string;
in_app?: boolean;
};

export interface ThreadCpuProfile {
Expand Down Expand Up @@ -68,4 +75,14 @@ export interface Profile {
relative_start_ns: string;
relative_end_ns: string;
}[];
measurements?: Record<
string,
{
unit: MeasurementUnit;
values: {
elapsed_since_start_ns: number;
value: number;
}[];
}
>;
}