(profile: JSSelfProfile)
| 557 | } |
| 558 | |
| 559 | function isValidProfile(profile: JSSelfProfile): profile is JSSelfProfile & { profile_id: string } { |
| 560 | if (profile.samples.length < 2) { |
| 561 | if (DEBUG_BUILD) { |
| 562 | // Log a warning if the profile has less than 2 samples so users can know why |
| 563 | // they are not seeing any profiling data and we cant avoid the back and forth |
| 564 | // of asking them to provide us with a dump of the profile data. |
| 565 | debug.log('[Profiling] Discarding profile because it contains less than 2 samples'); |
| 566 | } |
| 567 | return false; |
| 568 | } |
| 569 | |
| 570 | if (!profile.frames.length) { |
| 571 | if (DEBUG_BUILD) { |
| 572 | debug.log('[Profiling] Discarding profile because it contains no frames'); |
| 573 | } |
| 574 | return false; |
| 575 | } |
| 576 | |
| 577 | return true; |
| 578 | } |
| 579 | |
| 580 | // Keep a flag value to avoid re-initializing the profiler constructor. If it fails |
| 581 | // once, it will always fail and this allows us to early return. |
no test coverage detected