@parca/profile 0.16.455 → 0.16.457

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/MetricsGraphStrips/index.d.ts +1 -0
  3. package/dist/MetricsGraphStrips/index.d.ts.map +1 -1
  4. package/dist/MetricsGraphStrips/index.js +3 -3
  5. package/dist/ProfileIcicleGraph/IcicleGraph/index.js +1 -1
  6. package/dist/ProfileIcicleGraph/IcicleGraphArrow/IcicleChartRootNode.d.ts +9 -0
  7. package/dist/ProfileIcicleGraph/IcicleGraphArrow/IcicleChartRootNode.d.ts.map +1 -0
  8. package/dist/ProfileIcicleGraph/IcicleGraphArrow/IcicleChartRootNode.js +51 -0
  9. package/dist/ProfileIcicleGraph/IcicleGraphArrow/IcicleGraphNodes.d.ts +10 -1
  10. package/dist/ProfileIcicleGraph/IcicleGraphArrow/IcicleGraphNodes.d.ts.map +1 -1
  11. package/dist/ProfileIcicleGraph/IcicleGraphArrow/IcicleGraphNodes.js +4 -3
  12. package/dist/ProfileIcicleGraph/IcicleGraphArrow/TextWithEllipsis.d.ts +9 -0
  13. package/dist/ProfileIcicleGraph/IcicleGraphArrow/TextWithEllipsis.d.ts.map +1 -0
  14. package/dist/ProfileIcicleGraph/IcicleGraphArrow/TextWithEllipsis.js +62 -0
  15. package/dist/ProfileIcicleGraph/IcicleGraphArrow/index.d.ts +5 -0
  16. package/dist/ProfileIcicleGraph/IcicleGraphArrow/index.d.ts.map +1 -1
  17. package/dist/ProfileIcicleGraph/IcicleGraphArrow/index.js +9 -1
  18. package/dist/ProfileIcicleGraph/IcicleGraphArrow/utils.d.ts +3 -0
  19. package/dist/ProfileIcicleGraph/IcicleGraphArrow/utils.d.ts.map +1 -1
  20. package/dist/ProfileIcicleGraph/IcicleGraphArrow/utils.js +18 -0
  21. package/dist/ProfileIcicleGraph/index.d.ts +4 -1
  22. package/dist/ProfileIcicleGraph/index.d.ts.map +1 -1
  23. package/dist/ProfileIcicleGraph/index.js +6 -4
  24. package/dist/ProfileView/components/DashboardItems/index.d.ts +2 -1
  25. package/dist/ProfileView/components/DashboardItems/index.d.ts.map +1 -1
  26. package/dist/ProfileView/components/DashboardItems/index.js +7 -1
  27. package/dist/ProfileView/components/Toolbars/index.js +1 -1
  28. package/dist/ProfileView/components/ViewSelector/index.d.ts.map +1 -1
  29. package/dist/ProfileView/components/ViewSelector/index.js +4 -1
  30. package/dist/ProfileView/index.d.ts +1 -1
  31. package/dist/ProfileView/index.d.ts.map +1 -1
  32. package/dist/ProfileView/index.js +3 -2
  33. package/dist/ProfileView/types/visualization.d.ts +2 -4
  34. package/dist/ProfileView/types/visualization.d.ts.map +1 -1
  35. package/dist/ProfileViewWithData.d.ts +1 -4
  36. package/dist/ProfileViewWithData.d.ts.map +1 -1
  37. package/dist/ProfileViewWithData.js +30 -7
  38. package/dist/TimelineGuide/index.d.ts +4 -3
  39. package/dist/TimelineGuide/index.d.ts.map +1 -1
  40. package/dist/TimelineGuide/index.js +9 -7
  41. package/dist/styles.css +1 -1
  42. package/dist/utils.d.ts +1 -0
  43. package/dist/utils.d.ts.map +1 -1
  44. package/package.json +7 -7
  45. package/src/MetricsGraphStrips/index.tsx +3 -3
  46. package/src/ProfileIcicleGraph/IcicleGraph/index.tsx +1 -1
  47. package/src/ProfileIcicleGraph/IcicleGraphArrow/IcicleChartRootNode.tsx +157 -0
  48. package/src/ProfileIcicleGraph/IcicleGraphArrow/IcicleGraphNodes.tsx +10 -6
  49. package/src/ProfileIcicleGraph/IcicleGraphArrow/TextWithEllipsis.tsx +91 -0
  50. package/src/ProfileIcicleGraph/IcicleGraphArrow/index.tsx +58 -0
  51. package/src/ProfileIcicleGraph/IcicleGraphArrow/utils.ts +29 -1
  52. package/src/ProfileIcicleGraph/index.tsx +16 -6
  53. package/src/ProfileView/components/DashboardItems/index.tsx +27 -0
  54. package/src/ProfileView/components/Toolbars/index.tsx +1 -1
  55. package/src/ProfileView/components/ViewSelector/index.tsx +5 -1
  56. package/src/ProfileView/index.tsx +3 -3
  57. package/src/ProfileView/types/visualization.ts +2 -4
  58. package/src/ProfileViewWithData.tsx +36 -11
  59. package/src/TimelineGuide/index.tsx +41 -31
  60. package/src/utils.ts +1 -0
@@ -13,19 +13,20 @@
13
13
 
14
14
  import {Fragment} from 'react';
15
15
 
16
- import * as d3 from 'd3';
16
+ import {scaleLinear, valueFormatter} from '@parca/utilities';
17
17
 
18
- import {NumberDuo} from '../utils';
18
+ import {BigIntDuo} from '../utils';
19
19
 
20
20
  interface Props {
21
21
  width: number;
22
22
  height: number;
23
23
  margin: number;
24
- bounds: NumberDuo;
24
+ bounds: BigIntDuo;
25
25
  ticks?: number;
26
+ timeUnit?: string;
26
27
  }
27
28
 
28
- const alignBeforeAxisCorrection = (val: number): number => {
29
+ const alignBeforeAxisCorrection = (val: bigint): number => {
29
30
  if (val < 10000) {
30
31
  return -24;
31
32
  }
@@ -36,11 +37,18 @@ const alignBeforeAxisCorrection = (val: number): number => {
36
37
  return 0;
37
38
  };
38
39
 
39
- export const TimelineGuide = ({bounds, width, height, margin, ticks}: Props): JSX.Element => {
40
- const xScale = d3.scaleLinear().domain(bounds).range([0, width]);
40
+ export const TimelineGuide = ({
41
+ bounds,
42
+ width,
43
+ height,
44
+ margin,
45
+ ticks,
46
+ timeUnit = 'milliseconds',
47
+ }: Props): JSX.Element => {
48
+ const xScale = scaleLinear(bounds, [0, width]);
41
49
 
42
50
  return (
43
- <div className="relative h-4">
51
+ <div className="relative h-5">
44
52
  <div className="absolute" style={{width, height}}>
45
53
  <svg style={{width: '100%', height: '100%'}} className="z-[5]">
46
54
  <g
@@ -50,30 +58,32 @@ export const TimelineGuide = ({bounds, width, height, margin, ticks}: Props): JS
50
58
  textAnchor="middle"
51
59
  transform={`translate(0,${height - margin})`}
52
60
  >
53
- {xScale.ticks(ticks).map((d, i) => (
54
- <Fragment key={`${i.toString()}-${d.toString()}`}>
55
- <g
56
- key={`tick-${i}`}
57
- className="tick"
58
- /* eslint-disable-next-line @typescript-eslint/restrict-template-expressions */
59
- transform={`translate(${xScale(d) + alignBeforeAxisCorrection(d)}, ${-height})`}
60
- >
61
- {/* <line y2={6} className="stroke-gray-300 dark:stroke-gray-500" /> */}
62
- <text fill="currentColor" dy=".71em" y={9}>
63
- {d} ms
64
- </text>
65
- </g>
66
- <g key={`grid-${i}`}>
67
- <line
68
- className="stroke-gray-300 dark:stroke-gray-500"
69
- x1={xScale(d)}
70
- x2={xScale(d)}
71
- y1={0}
72
- y2={-height + margin}
73
- />
74
- </g>
75
- </Fragment>
76
- ))}
61
+ {xScale.ticks(ticks).map((d, i) => {
62
+ return (
63
+ <Fragment key={`${i.toString()}-${d.toString()}`}>
64
+ <g
65
+ key={`tick-${i}`}
66
+ className="tick"
67
+ /* eslint-disable-next-line @typescript-eslint/restrict-template-expressions */
68
+ transform={`translate(${xScale(d) + alignBeforeAxisCorrection(d)}, ${-height})`}
69
+ >
70
+ {/* <line y2={6} className="stroke-gray-300 dark:stroke-gray-500" /> */}
71
+ <text fill="currentColor" dy=".71em" y={9}>
72
+ {valueFormatter(d - bounds[0], timeUnit, 2, true).toString()}
73
+ </text>
74
+ </g>
75
+ <g key={`grid-${i}`}>
76
+ <line
77
+ className="stroke-gray-300 dark:stroke-gray-500"
78
+ x1={xScale(d)}
79
+ x2={xScale(d)}
80
+ y1={0}
81
+ y2={-height + margin}
82
+ />
83
+ </g>
84
+ </Fragment>
85
+ );
86
+ })}
77
87
  <line
78
88
  className="stroke-gray-300 dark:stroke-gray-500"
79
89
  x1={0}
package/src/utils.ts CHANGED
@@ -61,3 +61,4 @@ export const truncateStringReverse = (str: string, num: number): string => {
61
61
  };
62
62
 
63
63
  export type NumberDuo = [number, number];
64
+ export type BigIntDuo = [bigint, bigint];