@parca/profile 0.16.0 → 0.16.43

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 (98) hide show
  1. package/CHANGELOG.md +52 -25
  2. package/dist/Callgraph/Edge/index.d.ts +23 -0
  3. package/dist/Callgraph/Edge/index.js +30 -0
  4. package/dist/Callgraph/Node/index.d.ts +20 -0
  5. package/dist/Callgraph/Node/index.js +37 -0
  6. package/dist/Callgraph/index.d.ts +9 -0
  7. package/dist/Callgraph/index.js +137 -0
  8. package/dist/Callgraph/mockData/index.d.ts +148 -0
  9. package/dist/Callgraph/mockData/index.js +577 -0
  10. package/dist/Callgraph/utils.d.ts +19 -0
  11. package/dist/Callgraph/utils.js +82 -0
  12. package/dist/GraphTooltip/index.d.ts +20 -0
  13. package/dist/GraphTooltip/index.js +155 -0
  14. package/dist/IcicleGraph.d.ts +36 -0
  15. package/dist/IcicleGraph.js +158 -0
  16. package/dist/MatchersInput/index.d.ts +24 -0
  17. package/dist/MatchersInput/index.js +479 -0
  18. package/dist/MetricsCircle/index.d.ts +8 -0
  19. package/dist/MetricsCircle/index.js +18 -0
  20. package/dist/MetricsGraph/index.d.ts +36 -0
  21. package/dist/MetricsGraph/index.js +327 -0
  22. package/dist/MetricsSeries/index.d.ts +12 -0
  23. package/dist/MetricsSeries/index.js +21 -0
  24. package/dist/ProfileExplorer/ProfileExplorerCompare.d.ts +20 -0
  25. package/dist/ProfileExplorer/ProfileExplorerCompare.js +38 -0
  26. package/dist/ProfileExplorer/ProfileExplorerSingle.d.ts +16 -0
  27. package/dist/ProfileExplorer/ProfileExplorerSingle.js +19 -0
  28. package/dist/ProfileExplorer/index.d.ts +10 -0
  29. package/dist/ProfileExplorer/index.js +203 -0
  30. package/dist/ProfileIcicleGraph.d.ts +11 -0
  31. package/dist/ProfileIcicleGraph.js +28 -0
  32. package/dist/ProfileMetricsGraph/index.d.ts +23 -0
  33. package/dist/ProfileMetricsGraph/index.js +127 -0
  34. package/dist/ProfileSVG.module.css +3 -0
  35. package/dist/ProfileSelector/CompareButton.d.ts +6 -0
  36. package/dist/ProfileSelector/CompareButton.js +41 -0
  37. package/dist/ProfileSelector/MergeButton.d.ts +6 -0
  38. package/dist/ProfileSelector/MergeButton.js +41 -0
  39. package/dist/ProfileSelector/index.d.ts +30 -0
  40. package/dist/ProfileSelector/index.js +133 -0
  41. package/dist/ProfileSource.d.ts +89 -0
  42. package/dist/ProfileSource.js +239 -0
  43. package/dist/ProfileTypeSelector/index.d.ts +21 -0
  44. package/dist/ProfileTypeSelector/index.js +138 -0
  45. package/dist/ProfileView.d.ts +40 -0
  46. package/dist/ProfileView.js +111 -0
  47. package/dist/ProfileView.styles.css +3 -0
  48. package/dist/ProfileViewWithData.d.ts +12 -0
  49. package/dist/ProfileViewWithData.js +116 -0
  50. package/dist/TopTable.d.ts +10 -0
  51. package/dist/TopTable.js +140 -0
  52. package/dist/TopTable.styles.css +7 -0
  53. package/dist/components/DiffLegend.d.ts +3 -0
  54. package/dist/components/DiffLegend.js +62 -0
  55. package/dist/components/ProfileShareButton/ResultBox.d.ts +7 -0
  56. package/dist/components/ProfileShareButton/ResultBox.js +46 -0
  57. package/dist/components/ProfileShareButton/index.d.ts +8 -0
  58. package/dist/components/ProfileShareButton/index.js +119 -0
  59. package/dist/index.d.ts +13 -0
  60. package/dist/index.js +64 -0
  61. package/dist/stories/ProfileTypeSelector.stories.d.ts +5 -0
  62. package/dist/stories/ProfileTypeSelector.stories.js +77 -0
  63. package/dist/stories/ProfileView.stories.d.ts +5 -0
  64. package/dist/stories/ProfileView.stories.js +22 -0
  65. package/dist/stories/mockdata/flamegraphData.json +7960 -0
  66. package/dist/styles.css +1 -0
  67. package/dist/useDelayedLoader.d.ts +5 -0
  68. package/dist/useDelayedLoader.js +33 -0
  69. package/dist/useQuery.d.ts +13 -0
  70. package/dist/useQuery.js +41 -0
  71. package/dist/utils.d.ts +4 -0
  72. package/dist/utils.js +83 -0
  73. package/package.json +13 -8
  74. package/src/Callgraph/Edge/index.tsx +59 -0
  75. package/src/Callgraph/Node/index.tsx +66 -0
  76. package/src/Callgraph/index.tsx +169 -0
  77. package/src/Callgraph/mockData/index.ts +605 -0
  78. package/src/Callgraph/utils.ts +116 -0
  79. package/src/GraphTooltip/index.tsx +340 -0
  80. package/src/IcicleGraph.tsx +28 -8
  81. package/src/MatchersInput/index.tsx +698 -0
  82. package/src/MetricsCircle/index.tsx +28 -0
  83. package/src/MetricsGraph/index.tsx +589 -0
  84. package/src/MetricsSeries/index.tsx +38 -0
  85. package/src/ProfileExplorer/ProfileExplorerCompare.tsx +109 -0
  86. package/src/ProfileExplorer/ProfileExplorerSingle.tsx +72 -0
  87. package/src/ProfileExplorer/index.tsx +377 -0
  88. package/src/ProfileMetricsGraph/index.tsx +143 -0
  89. package/src/ProfileSelector/CompareButton.tsx +72 -0
  90. package/src/ProfileSelector/MergeButton.tsx +72 -0
  91. package/src/ProfileSelector/index.tsx +270 -0
  92. package/src/ProfileTypeSelector/index.tsx +180 -0
  93. package/src/ProfileView.tsx +2 -7
  94. package/src/index.tsx +11 -0
  95. package/src/useQuery.tsx +1 -0
  96. package/tailwind.config.js +8 -0
  97. package/tsconfig.json +7 -3
  98. package/typings.d.ts +14 -0
@@ -0,0 +1 @@
1
+ /*! tailwindcss v3.1.8 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}html{-webkit-text-size-adjust:100%;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{color:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.absolute{position:absolute}.relative{position:relative}.left-0{left:0}.right-0{right:0}.z-50{z-index:50}.z-10{z-index:10}.m-auto{margin:auto}.m-0{margin:0}.m-2{margin:.5rem}.my-2{margin-bottom:.5rem;margin-top:.5rem}.my-20{margin-bottom:5rem;margin-top:5rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mr-3{margin-right:.75rem}.ml-auto{margin-left:auto}.ml-2{margin-left:.5rem}.mr-6{margin-right:1.5rem}.mt-2{margin-top:.5rem}.mt-1{margin-top:.25rem}.mb-2{margin-bottom:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-8{margin-top:2rem}.block{display:block}.inline-block{display:inline-block}.flex{display:flex}.table{display:table}.grid{display:grid}.h-36{height:9rem}.h-1{height:.25rem}.h-4{height:1rem}.max-h-\[400px\]{max-height:400px}.w-full{width:100%}.w-2\/5{width:40%}.w-auto{width:auto}.w-1\/2{width:50%}.w-\[150px\]{width:150px}.w-1\/5{width:20%}.w-4\/5{width:80%}.w-fit{width:-moz-fit-content;width:fit-content}.w-1\/4{width:25%}.w-3\/4{width:75%}.w-40{width:10rem}.w-8{width:2rem}.w-16{width:4rem}.w-\[420px\]{width:420px}.max-w-md{max-width:28rem}.flex-1{flex:1 1 0%}.flex-grow{flex-grow:1}.table-auto{table-layout:auto}.table-fixed{table-layout:fixed}.translate-y-1{--tw-translate-y:0.25rem}.translate-y-0,.translate-y-1{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-0{--tw-translate-y:0px}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.cursor-pointer{cursor:pointer}.cursor-not-allowed{cursor:not-allowed}.cursor-default{cursor:default}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.flex-row{flex-direction:row}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(1rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(1rem*var(--tw-space-x-reverse))}.space-x-1>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.25rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.25rem*var(--tw-space-x-reverse))}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.5rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.5rem*var(--tw-space-x-reverse))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse:0;border-bottom-width:calc(1px*var(--tw-divide-y-reverse));border-top-width:calc(1px*(1 - var(--tw-divide-y-reverse)))}.divide-gray-200>:not([hidden])~:not([hidden]){--tw-divide-opacity:1;border-color:rgb(229 231 235/var(--tw-divide-opacity))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-scroll{overflow-x:scroll}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.break-all{word-break:break-all}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded{border-radius:.25rem}.rounded-none{border-radius:0}.rounded-l{border-bottom-left-radius:.25rem;border-top-left-radius:.25rem}.rounded-r{border-bottom-right-radius:.25rem;border-top-right-radius:.25rem}.rounded-tr-none{border-top-right-radius:0}.rounded-br-none{border-bottom-right-radius:0}.rounded-tl-none{border-top-left-radius:0}.rounded-bl-none{border-bottom-left-radius:0}.border{border-width:1px}.border-l-0{border-left-width:0}.border-r-0{border-right-width:0}.border-b{border-bottom-width:1px}.border-gray-300{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity))}.border-red-400{--tw-border-opacity:1;border-color:rgb(248 113 113/var(--tw-border-opacity))}.bg-gray-200{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.bg-gray-50{--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity))}.bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.bg-indigo-600{--tw-bg-opacity:1;background-color:rgb(79 70 229/var(--tw-bg-opacity))}.bg-transparent{background-color:transparent}.bg-red-100{--tw-bg-opacity:1;background-color:rgb(254 226 226/var(--tw-bg-opacity))}.bg-black{--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity))}.bg-inherit{background-color:inherit}.fill-\[\#161616\]{fill:#161616}.fill-transparent{fill:transparent}.fill-current{fill:currentColor}.p-10{padding:2.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.px-2{padding-left:.5rem;padding-right:.5rem}.py-1{padding-bottom:.25rem;padding-top:.25rem}.py-3{padding-bottom:.75rem;padding-top:.75rem}.px-8{padding-left:2rem;padding-right:2rem}.py-1\.5{padding-bottom:.375rem;padding-top:.375rem}.py-2{padding-bottom:.5rem;padding-top:.5rem}.px-4{padding-left:1rem;padding-right:1rem}.py-20{padding-bottom:5rem;padding-top:5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-1{padding-left:.25rem;padding-right:.25rem}.pt-2{padding-top:.5rem}.pb-2{padding-bottom:.5rem}.pl-2{padding-left:.5rem}.pr-2{padding-right:.5rem}.pb-4{padding-bottom:1rem}.pl-3{padding-left:.75rem}.pr-9{padding-right:2.25rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-middle{vertical-align:middle}.text-xs{font-size:.75rem;line-height:1rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-base{font-size:1rem;line-height:1.5rem}.font-bold{font-weight:700}.font-semibold{font-weight:600}.text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity))}.text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity))}.text-gray-100{--tw-text-opacity:1;color:rgb(243 244 246/var(--tw-text-opacity))}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.text-red-700{--tw-text-opacity:1;color:rgb(185 28 28/var(--tw-text-opacity))}.text-black{--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity))}.\!text-indigo-600{--tw-text-opacity:1!important;color:rgb(79 70 229/var(--tw-text-opacity))!important}.opacity-90{opacity:.9}.opacity-100{opacity:1}.opacity-0{opacity:0}.shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.ring-1{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.ring-black{--tw-ring-opacity:1;--tw-ring-color:rgb(0 0 0/var(--tw-ring-opacity))}.ring-opacity-5{--tw-ring-opacity:0.05}.blur{--tw-blur:blur(8px)}.blur,.invert{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.invert{--tw-invert:invert(100%)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}.duration-100{transition-duration:.1s}.duration-200{transition-duration:.2s}.duration-150{transition-duration:.15s}.ease-in{transition-timing-function:cubic-bezier(.4,0,1,1)}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}.hover\:bg-\[\#62626212\]:hover{background-color:#62626212}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-indigo-800:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(55 48 163/var(--tw-ring-opacity))}.dark .dark\:divide-gray-700>:not([hidden])~:not([hidden]){--tw-divide-opacity:1;border-color:rgb(55 65 81/var(--tw-divide-opacity))}.dark .dark\:border-gray-500{--tw-border-opacity:1;border-color:rgb(107 114 128/var(--tw-border-opacity))}.dark .dark\:border-gray-600{--tw-border-opacity:1;border-color:rgb(75 85 99/var(--tw-border-opacity))}.dark .dark\:bg-gray-700{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity))}.dark .dark\:bg-gray-800{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity))}.dark .dark\:bg-gray-900{--tw-bg-opacity:1;background-color:rgb(17 24 39/var(--tw-bg-opacity))}.dark .dark\:fill-\[\#ffffff\]{fill:#fff}.dark .dark\:text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity))}.dark .dark\:text-gray-300{--tw-text-opacity:1;color:rgb(209 213 219/var(--tw-text-opacity))}.dark .dark\:text-gray-50{--tw-text-opacity:1;color:rgb(249 250 251/var(--tw-text-opacity))}.dark .dark\:\!text-indigo-400{--tw-text-opacity:1!important;color:rgb(129 140 248/var(--tw-text-opacity))!important}.dark .dark\:hover\:bg-\[\#ffffff12\]:hover{background-color:#ffffff12}@media (min-width:640px){.sm\:inline{display:inline}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}}
@@ -0,0 +1,5 @@
1
+ interface DelayedLoaderOptions {
2
+ delay?: number;
3
+ }
4
+ declare const useDelayedLoader: (isLoading?: boolean, options?: DelayedLoaderOptions) => boolean;
5
+ export default useDelayedLoader;
@@ -0,0 +1,33 @@
1
+ // Copyright 2022 The Parca Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ import { useEffect, useState } from 'react';
14
+ var useDelayedLoader = function (isLoading, options) {
15
+ if (isLoading === void 0) { isLoading = false; }
16
+ var _a = (options !== null && options !== void 0 ? options : {}).delay, delay = _a === void 0 ? 500 : _a;
17
+ var _b = useState(false), isLoaderVisible = _b[0], setIsLoaderVisible = _b[1];
18
+ useEffect(function () {
19
+ var showLoaderTimeout;
20
+ if (isLoading && !isLoaderVisible) {
21
+ // if the request takes longer than half a second, show the loading icon
22
+ showLoaderTimeout = setTimeout(function () {
23
+ setIsLoaderVisible(true);
24
+ }, delay);
25
+ }
26
+ else if (!isLoading && isLoaderVisible) {
27
+ setIsLoaderVisible(false);
28
+ }
29
+ return function () { return clearTimeout(showLoaderTimeout); };
30
+ }, [isLoading, isLoaderVisible, delay]);
31
+ return isLoaderVisible;
32
+ };
33
+ export default useDelayedLoader;
@@ -0,0 +1,13 @@
1
+ import { QueryServiceClient, QueryResponse, QueryRequest_ReportType } from '@parca/client';
2
+ import { RpcError } from '@protobuf-ts/runtime-rpc';
3
+ import { ProfileSource } from './ProfileSource';
4
+ export interface IQueryResult {
5
+ response: QueryResponse | null;
6
+ error: RpcError | null;
7
+ isLoading: boolean;
8
+ }
9
+ interface UseQueryOptions {
10
+ skip?: boolean;
11
+ }
12
+ export declare const useQuery: (client: QueryServiceClient, profileSource: ProfileSource, reportType: QueryRequest_ReportType, options?: UseQueryOptions) => IQueryResult;
13
+ export {};
@@ -0,0 +1,41 @@
1
+ // Copyright 2022 The Parca Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ import { useEffect, useState } from 'react';
14
+ import { useGrpcMetadata } from '@parca/components';
15
+ export var useQuery = function (client, profileSource, reportType, options) {
16
+ var _a = (options !== null && options !== void 0 ? options : {}).skip, skip = _a === void 0 ? false : _a;
17
+ var _b = useState({
18
+ response: null,
19
+ error: null,
20
+ isLoading: false,
21
+ }), result = _b[0], setResult = _b[1];
22
+ var metadata = useGrpcMetadata();
23
+ useEffect(function () {
24
+ if (skip) {
25
+ return;
26
+ }
27
+ setResult({
28
+ response: null,
29
+ error: null,
30
+ isLoading: true,
31
+ });
32
+ var req = profileSource.QueryRequest();
33
+ console.log('req', req);
34
+ req.reportType = reportType;
35
+ var call = client.query(req, { meta: metadata });
36
+ call.response
37
+ .then(function (response) { return setResult({ response: response, error: null, isLoading: false }); })
38
+ .catch(function (error) { return setResult({ error: error, response: null, isLoading: false }); });
39
+ }, [skip, client, profileSource, metadata, reportType]);
40
+ return result;
41
+ };
@@ -0,0 +1,4 @@
1
+ import { QueryRequest, QueryServiceClient } from '@parca/client';
2
+ import { RpcMetadata } from '@protobuf-ts/runtime-rpc';
3
+ export declare const hexifyAddress: (address?: string) => string;
4
+ export declare const downloadPprof: (request: QueryRequest, queryClient: QueryServiceClient, metadata: RpcMetadata) => Promise<Blob>;
package/dist/utils.js ADDED
@@ -0,0 +1,83 @@
1
+ // Copyright 2022 The Parca Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ var __assign = (this && this.__assign) || function () {
14
+ __assign = Object.assign || function(t) {
15
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
16
+ s = arguments[i];
17
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
18
+ t[p] = s[p];
19
+ }
20
+ return t;
21
+ };
22
+ return __assign.apply(this, arguments);
23
+ };
24
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
25
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
26
+ return new (P || (P = Promise))(function (resolve, reject) {
27
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
28
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
29
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
30
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
31
+ });
32
+ };
33
+ var __generator = (this && this.__generator) || function (thisArg, body) {
34
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
35
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
36
+ function verb(n) { return function (v) { return step([n, v]); }; }
37
+ function step(op) {
38
+ if (f) throw new TypeError("Generator is already executing.");
39
+ while (_) try {
40
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
41
+ if (y = 0, t) op = [op[0] & 2, t.value];
42
+ switch (op[0]) {
43
+ case 0: case 1: t = op; break;
44
+ case 4: _.label++; return { value: op[1], done: false };
45
+ case 5: _.label++; y = op[1]; op = [0]; continue;
46
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
47
+ default:
48
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
49
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
50
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
51
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
52
+ if (t[2]) _.ops.pop();
53
+ _.trys.pop(); continue;
54
+ }
55
+ op = body.call(thisArg, _);
56
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
57
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
58
+ }
59
+ };
60
+ import { QueryRequest_ReportType } from '@parca/client';
61
+ export var hexifyAddress = function (address) {
62
+ if (address == null) {
63
+ return '';
64
+ }
65
+ return "0x".concat(parseInt(address, 10).toString(16));
66
+ };
67
+ export var downloadPprof = function (request, queryClient, metadata) { return __awaiter(void 0, void 0, void 0, function () {
68
+ var req, response, blob;
69
+ return __generator(this, function (_a) {
70
+ switch (_a.label) {
71
+ case 0:
72
+ req = __assign(__assign({}, request), { reportType: QueryRequest_ReportType.PPROF });
73
+ return [4 /*yield*/, queryClient.query(req, { meta: metadata })];
74
+ case 1:
75
+ response = (_a.sent()).response;
76
+ if (response.report.oneofKind !== 'pprof') {
77
+ throw new Error("Expected pprof report, got: ".concat(response.report.oneofKind !== undefined ? response.report.oneofKind : 'undefined'));
78
+ }
79
+ blob = new Blob([response.report.pprof], { type: 'application/octet-stream' });
80
+ return [2 /*return*/, blob];
81
+ }
82
+ });
83
+ }); };
package/package.json CHANGED
@@ -1,13 +1,15 @@
1
1
  {
2
2
  "name": "@parca/profile",
3
- "version": "0.16.0",
3
+ "version": "0.16.43",
4
4
  "description": "Profile viewing libraries",
5
5
  "dependencies": {
6
6
  "@iconify/react": "^3.2.2",
7
- "@parca/client": "^0.16.0",
8
- "@parca/dynamicsize": "^0.16.0",
9
- "@parca/functions": "^0.16.0",
10
- "@parca/parser": "^0.16.0",
7
+ "@parca/client": "^0.16.22",
8
+ "@parca/components": "^0.16.43",
9
+ "@parca/dynamicsize": "^0.16.22",
10
+ "@parca/functions": "^0.16.22",
11
+ "@parca/parser": "^0.16.22",
12
+ "@parca/store": "^0.16.22",
11
13
  "d3-scale": "^4.0.2",
12
14
  "d3-selection": "3.0.0",
13
15
  "react-copy-to-clipboard": "^5.1.0"
@@ -15,9 +17,12 @@
15
17
  "devDependencies": {
16
18
  "@types/react-copy-to-clipboard": "5.0.4"
17
19
  },
18
- "main": "src/index.tsx",
20
+ "main": "dist/index.js",
19
21
  "scripts": {
20
- "test": "jest --coverage --config ../../../jest.config.js ./src/*"
22
+ "test": "jest --coverage --config ../../../jest.config.js ./src/*",
23
+ "prepublish": "yarn build",
24
+ "build": "tsc && tailwindcss -o dist/styles.css --minify && cp src/*.css ./dist/",
25
+ "watch": "tsc-watch --onSuccess 'tailwindcss -o dist/styles.css --minify'"
21
26
  },
22
27
  "keywords": [],
23
28
  "author": "",
@@ -26,5 +31,5 @@
26
31
  "access": "public",
27
32
  "registry": "https://registry.npmjs.org/"
28
33
  },
29
- "gitHead": "63fa76520f8a8b4c51b645f23117dde72bf0504d"
34
+ "gitHead": "6abe2900480e4d043611fb7587b898c12f4f1518"
30
35
  }
@@ -0,0 +1,59 @@
1
+ // Copyright 2022 The Parca Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+
14
+ import {Arrow} from 'react-konva';
15
+ import {parseEdgePos} from '../utils';
16
+
17
+ export interface IEdge {
18
+ source: number;
19
+ target: number;
20
+ color: string;
21
+ points: string;
22
+ }
23
+ interface Props {
24
+ edge: IEdge;
25
+ sourceNode: {x: number; y: number};
26
+ targetNode: {x: number; y: number};
27
+ xScale: (x: number) => number;
28
+ yScale: (y: number) => number;
29
+ nodeRadius: number;
30
+ }
31
+
32
+ const Edge = ({edge, sourceNode, targetNode, xScale, yScale, nodeRadius}: Props): JSX.Element => {
33
+ const {points, color, source, target} = edge;
34
+
35
+ const scaledPoints = parseEdgePos({
36
+ pos: points,
37
+ xScale,
38
+ yScale,
39
+ source: [sourceNode.x, sourceNode.y],
40
+ target: [targetNode.x, targetNode.y],
41
+ nodeRadius,
42
+ isSelfLoop: source === target,
43
+ });
44
+
45
+ return (
46
+ <Arrow
47
+ points={scaledPoints}
48
+ bezier={true}
49
+ stroke={color}
50
+ strokeWidth={3}
51
+ pointerLength={10}
52
+ pointerWidth={10}
53
+ fill={color}
54
+ opacity={0.8}
55
+ />
56
+ );
57
+ };
58
+
59
+ export default Edge;
@@ -0,0 +1,66 @@
1
+ // Copyright 2022 The Parca Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+
14
+ import {Circle} from 'react-konva';
15
+
16
+ export interface INode {
17
+ id: number;
18
+ x: number;
19
+ y: number;
20
+ data: {id: string};
21
+ color: string;
22
+ mouseX?: number;
23
+ mouseY?: number;
24
+ }
25
+
26
+ interface Props {
27
+ node: INode;
28
+ hoveredNode: INode | null;
29
+ setHoveredNode: (node: INode | null) => void;
30
+ nodeRadius: number;
31
+ }
32
+
33
+ const Node = ({
34
+ node,
35
+ hoveredNode,
36
+ setHoveredNode,
37
+ nodeRadius: defaultRadius,
38
+ }: Props): JSX.Element => {
39
+ const {
40
+ data: {id},
41
+ x,
42
+ y,
43
+ color,
44
+ } = node;
45
+
46
+ const hoverRadius = defaultRadius + 3;
47
+ const isHovered = Boolean(hoveredNode) && hoveredNode?.data.id === id;
48
+
49
+ return (
50
+ <Circle
51
+ x={+x}
52
+ y={+y}
53
+ draggable
54
+ radius={isHovered ? hoverRadius : defaultRadius}
55
+ fill={color}
56
+ onMouseOver={() => {
57
+ setHoveredNode({...node, mouseX: x, mouseY: y});
58
+ }}
59
+ onMouseOut={() => {
60
+ setHoveredNode(null);
61
+ }}
62
+ />
63
+ );
64
+ };
65
+
66
+ export default Node;
@@ -0,0 +1,169 @@
1
+ // Copyright 2022 The Parca Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+
14
+ import {useState, useEffect, useRef} from 'react';
15
+ import graphviz from 'graphviz-wasm';
16
+ import * as d3 from 'd3';
17
+ import {Stage, Layer} from 'react-konva';
18
+ import Tooltip from '../GraphTooltip';
19
+ import {CallgraphNode, CallgraphEdge, Callgraph as CallgraphType} from '@parca/client';
20
+ import {jsonToDot} from './utils';
21
+ import Node, {INode} from './Node';
22
+ import Edge, {IEdge} from './Edge';
23
+ import type {HoveringNode} from '../GraphTooltip';
24
+
25
+ export interface Props {
26
+ graph: CallgraphType;
27
+ sampleUnit: string;
28
+ width: number;
29
+ }
30
+
31
+ interface graphvizObject extends CallgraphNode {
32
+ _gvid: number;
33
+ name: string;
34
+ pos: string;
35
+ }
36
+
37
+ interface graphvizEdge extends CallgraphEdge {
38
+ _gvid: number;
39
+ tail: number;
40
+ head: number;
41
+ pos: string;
42
+ }
43
+
44
+ interface graphvizType {
45
+ edges: graphvizEdge[];
46
+ objects: graphvizObject[];
47
+ bb: string;
48
+ }
49
+
50
+ const Callgraph = ({graph, sampleUnit, width}: Props): JSX.Element => {
51
+ const containerRef = useRef<HTMLDivElement>(null);
52
+ const [graphData, setGraphData] = useState<string | null>(null);
53
+ const [hoveredNode, setHoveredNode] = useState<INode | null>(null);
54
+ const {nodes: rawNodes, cumulative: total} = graph;
55
+ const nodeRadius = 12;
56
+
57
+ useEffect(() => {
58
+ const getDataWithPositions = async (): Promise<void> => {
59
+ // 1. Translate JSON to 'dot' graph string
60
+ const dataAsDot = jsonToDot({graph, width, nodeRadius});
61
+
62
+ // 2. Use Graphviz-WASM to translate the 'dot' graph to a 'JSON' graph
63
+ await graphviz.loadWASM(); // need to load the WASM instance and wait for it
64
+
65
+ const jsonGraph = graphviz.layout(dataAsDot, 'json', 'dot');
66
+
67
+ setGraphData(jsonGraph);
68
+ };
69
+
70
+ if (width !== null) {
71
+ void getDataWithPositions();
72
+ }
73
+ }, [graph, width]);
74
+
75
+ // 3. Render the graph with calculated layout in Canvas container
76
+ if (width == null || graphData == null) return <></>;
77
+
78
+ const height = width;
79
+ const {objects, edges: gvizEdges, bb: boundingBox} = JSON.parse(graphData) as graphvizType;
80
+
81
+ const cumulatives: string[] = objects
82
+ .filter(node => node !== undefined)
83
+ .map(node => node.cumulative);
84
+ if (cumulatives.length === 0) {
85
+ cumulatives.push('0');
86
+ }
87
+
88
+ const valueRange = (d3.extent(cumulatives) as [string, string]).map(value => parseInt(value));
89
+
90
+ const colorScale = d3
91
+ .scaleSequentialLog(d3.interpolateRdGy)
92
+ .domain(valueRange)
93
+ .range(['lightgrey', 'red']);
94
+ const graphBB = boundingBox.split(',');
95
+ const xScale = d3
96
+ .scaleLinear()
97
+ .domain([0, Number(graphBB[2])])
98
+ .range([0, width]);
99
+ const yScale = d3
100
+ .scaleLinear()
101
+ .domain([0, Number(graphBB[3])])
102
+ .range([0, height]);
103
+
104
+ const nodes: INode[] = objects.map(object => {
105
+ const pos = object.pos.split(',');
106
+ return {
107
+ ...object,
108
+ id: object._gvid,
109
+ x: xScale(parseInt(pos[0])),
110
+ y: yScale(parseInt(pos[1])),
111
+ color: colorScale(Number(object.cumulative)),
112
+ data: rawNodes.find(n => n.id === object.name) ?? {id: 'n0'},
113
+ };
114
+ });
115
+
116
+ const edges: IEdge[] = gvizEdges.map(edge => ({
117
+ ...edge,
118
+ source: edge.head,
119
+ target: edge.tail,
120
+ points: edge.pos,
121
+ color: colorScale(+edge.cumulative),
122
+ }));
123
+
124
+ return (
125
+ <div className="relative">
126
+ <div className={`w-[${width}px] h-[${height}px]`} ref={containerRef}>
127
+ <Stage width={width} height={height}>
128
+ <Layer>
129
+ {edges.map(edge => {
130
+ const sourceNode = nodes.find(n => n.id === edge.source) ?? {x: 0, y: 0};
131
+ const targetNode = nodes.find(n => n.id === edge.target) ?? {x: 0, y: 0};
132
+ return (
133
+ <Edge
134
+ key={`edge-${edge.source}-${edge.target}`}
135
+ edge={edge}
136
+ xScale={xScale}
137
+ yScale={yScale}
138
+ sourceNode={sourceNode}
139
+ targetNode={targetNode}
140
+ nodeRadius={nodeRadius}
141
+ />
142
+ );
143
+ })}
144
+ {nodes.map(node => (
145
+ <Node
146
+ key={`node-${node.data.id}`}
147
+ node={node}
148
+ hoveredNode={hoveredNode}
149
+ setHoveredNode={setHoveredNode}
150
+ nodeRadius={nodeRadius}
151
+ />
152
+ ))}
153
+ </Layer>
154
+ </Stage>
155
+ <Tooltip
156
+ hoveringNode={rawNodes.find(n => n.id === hoveredNode?.data.id) as HoveringNode}
157
+ unit={sampleUnit}
158
+ total={+total}
159
+ isFixed={false}
160
+ x={hoveredNode?.mouseX ?? 0}
161
+ y={hoveredNode?.mouseY ?? 0}
162
+ contextElement={containerRef.current}
163
+ />
164
+ </div>
165
+ </div>
166
+ );
167
+ };
168
+
169
+ export default Callgraph;