stackMarkerToHumanReadable.tsx 647 B

12345678910111213141516171819202122
  1. import {t} from 'sentry/locale';
  2. // This is the formatter for the stack marker spec https://github.com/WICG/js-self-profiling/blob/main/markers.md
  3. export function stackMarkerToHumanReadable(marker: JSSelfProfiling.Marker): string {
  4. switch (marker) {
  5. case 'gc':
  6. return t('Garbage Collection');
  7. case 'style':
  8. return t('Style');
  9. case 'layout':
  10. return t('Layout');
  11. case 'paint':
  12. return t('Paint');
  13. case 'script':
  14. return t('Script');
  15. case 'other':
  16. return t('Other');
  17. default:
  18. // since spec is still in dev, just gracefully return whatever we received.
  19. return marker;
  20. }
  21. }