forked from firefox-devtools/profiler
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a tooltip for samples in the thread activity graph
- Loading branch information
Showing
16 changed files
with
274 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
/** | ||
* This class should be used to create a small color swatch to describe a | ||
* category. It is a global css class as it can be used across the project. | ||
*/ | ||
.category-swatch { | ||
display: inline-block; | ||
box-sizing: border-box; | ||
width: 9px; | ||
height: 9px; | ||
border: 0.5px solid rgba(0, 0, 0, 0.1); | ||
margin-right: 3px; | ||
} | ||
|
||
.category-swatch.category-color-transparent { | ||
background-color: transparent; | ||
} | ||
|
||
.category-swatch.category-color-purple { | ||
background-color: var(--purple-70); | ||
} | ||
|
||
.category-swatch.category-color-green { | ||
background-color: var(--green-60); | ||
} | ||
|
||
.category-swatch.category-color-orange { | ||
background-color: var(--orange-50); | ||
} | ||
|
||
.category-swatch.category-color-yellow { | ||
background-color: var(--yellow-50); | ||
} | ||
|
||
.category-swatch.category-color-lightblue { | ||
background-color: var(--blue-40); | ||
} | ||
|
||
.category-swatch.category-color-grey { | ||
background-color: var(--grey-30); | ||
} | ||
|
||
.category-swatch.category-color-blue { | ||
background-color: var(--blue-60); | ||
} | ||
|
||
.category-swatch.category-color-brown { | ||
background-color: var(--magenta-60); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
.backtrace { | ||
--max-height: 30em; | ||
--gradient-height: calc(var(--max-height) - 5em); | ||
|
||
margin: 5px; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
// @flow | ||
|
||
import * as React from 'react'; | ||
import type { | ||
IndexIntoSamplesTable, | ||
CategoryList, | ||
Thread, | ||
} from '../../types/profile'; | ||
import Backtrace from './Backtrace'; | ||
|
||
type Props = {| | ||
+sampleIndex: IndexIntoSamplesTable, | ||
+categories: CategoryList, | ||
+fullThread: Thread, | ||
|}; | ||
|
||
/** | ||
* This class displays the tooltip contents for a given sample. Typically the user | ||
* will want to know what the function is, and its category. | ||
*/ | ||
export default class SampleTooltipContents extends React.PureComponent<Props> { | ||
render() { | ||
const { sampleIndex, fullThread, categories } = this.props; | ||
const { samples, stackTable } = fullThread; | ||
const stackIndex = samples.stack[sampleIndex]; | ||
if (stackIndex === null) { | ||
return 'No stack information'; | ||
} | ||
const categoryIndex = stackTable.category[stackIndex]; | ||
const category = categories[categoryIndex]; | ||
|
||
return ( | ||
<> | ||
<div className="tooltipDetails"> | ||
<div className="tooltipLabel">Category:</div> | ||
<div> | ||
<span | ||
className={`category-swatch category-color-${category.color}`} | ||
/> | ||
{category.name} | ||
</div> | ||
</div> | ||
<div className="tooltipDetails"> | ||
<div className="tooltipLabel">Stack:</div> | ||
</div> | ||
<Backtrace | ||
maxHeight="9.2em" | ||
stackIndex={stackIndex} | ||
thread={fullThread} | ||
implementationFilter="combined" | ||
/> | ||
</> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.