profiling.d.ts 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. declare namespace Profiling {
  2. interface RawProfileBase {
  3. endValue: number;
  4. startValue: number;
  5. name: string;
  6. threadID: number;
  7. unit: string;
  8. spans?: Span[];
  9. threadID: number;
  10. }
  11. // Android traces follow this format
  12. interface EventedProfile extends RawProfileBase {
  13. events: ReadonlyArray<Event>;
  14. type: 'evented';
  15. }
  16. // iOS traces follow this format
  17. interface SampledProfile extends RawProfileBase {
  18. weights: number[];
  19. samples: number[][];
  20. type: 'sampled';
  21. }
  22. type Event = {at: number; frame: number; type: 'O' | 'C'};
  23. type Span = {
  24. duration_ms: number;
  25. name: string;
  26. queue_label: string;
  27. relative_start_ms: number;
  28. thread_id: number;
  29. children?: Span[];
  30. };
  31. type FrameInfo = {
  32. key: string | number;
  33. name: string;
  34. file?: string;
  35. line?: number;
  36. column?: number;
  37. is_application?: boolean;
  38. image?: string;
  39. resource?: string;
  40. threadId?: number;
  41. };
  42. type ProfileTypes = EventedProfile | SampledProfile | JSSelfProfiling.Trace;
  43. type ImportedProfiles = {
  44. name: string;
  45. traceID: string;
  46. activeProfileIndex: number;
  47. profiles: ProfileTypes[];
  48. };
  49. // This extends speedscope's schema - we are keeping this as is, but we are likely to diverge as we add more
  50. // sentry related features to the flamegraphs. This should happen after the MVP integration
  51. type Schema = {
  52. durationNS: number;
  53. platform: string;
  54. profileID: string;
  55. profiles: ReadonlyArray<ProfileTypes>;
  56. projectID: number;
  57. shared: {
  58. frames: ReadonlyArray<Omit<FrameInfo, 'key'>>;
  59. };
  60. transactionName: string;
  61. version: string;
  62. activeProfileIndex?: number;
  63. androidClock?: 'Global' | 'Dual' | 'Wall' | 'Cpu';
  64. };
  65. }