From 3719757cedb5018398192be11c0b7849b43c1b64 Mon Sep 17 00:00:00 2001 From: Oliver N Date: Thu, 29 Jul 2021 17:05:10 +0700 Subject: [PATCH] add diff legend --- .../components/FlameGraphRenderer.jsx | 19 +++++++++++++- webapp/sass/profile.scss | 26 +++++++++++++++++-- 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/webapp/javascript/components/FlameGraphRenderer.jsx b/webapp/javascript/components/FlameGraphRenderer.jsx index 3eb9182ba3..0e1b99e6fd 100644 --- a/webapp/javascript/components/FlameGraphRenderer.jsx +++ b/webapp/javascript/components/FlameGraphRenderer.jsx @@ -55,6 +55,8 @@ const unitsToFlamegraphTitle = { "samples": "CPU time per function", } +const diffLegend = [20, 10, 5, 3, 2, 1, 0, -1, -2, -3, -5, -10, -20]; + class FlameGraphRenderer extends React.Component { constructor(props) { super(); @@ -541,7 +543,22 @@ class FlameGraphRenderer extends React.Component { >
- Frame width represents {unitsToFlamegraphTitle[this.state.units]} +
+
+ Frame width represents {unitsToFlamegraphTitle[this.state.units]} +
+ { !this.state.viewDiff ? null : +
+
+ {diffLegend.map((v) => ( +
+ {v > 0 ? '+' : ''}{v}% +
+ ))} +
+
+ } +