-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Profiling] renaming CPU incl and CPU excl (#154560)
<img width="410" alt="Screenshot 2023-04-06 at 9 28 13 AM" src="https://user-images.githubusercontent.com/55978943/230401728-fcdcb1ec-164e-4375-acae-12d3a4e2caaf.png"> <img width="610" alt="Screenshot 2023-04-06 at 9 28 23 AM" src="https://user-images.githubusercontent.com/55978943/230401731-84a45fd2-bce2-4de8-8a3a-7f7fffa7f404.png"> <img width="295" alt="Screenshot 2023-04-06 at 9 38 57 AM" src="https://user-images.githubusercontent.com/55978943/230401732-edb11b8d-c8fb-4401-a021-4a80a17830a4.png">
- Loading branch information
1 parent
1f8dc16
commit 5c759a1
Showing
9 changed files
with
106 additions
and
66 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
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
66 changes: 66 additions & 0 deletions
66
x-pack/plugins/profiling/public/components/shared/cpu_label_with_hint/index.tsx
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,66 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
import React from 'react'; | ||
import { | ||
EuiFlexGroup, | ||
EuiFlexItem, | ||
EuiIcon, | ||
EuiIconProps, | ||
EuiText, | ||
EuiTextProps, | ||
EuiToolTip, | ||
} from '@elastic/eui'; | ||
import { i18n } from '@kbn/i18n'; | ||
|
||
type CPUType = 'self' | 'total'; | ||
|
||
interface Props { | ||
type: CPUType; | ||
labelSize?: EuiTextProps['size']; | ||
labelStyle?: EuiTextProps['style']; | ||
iconSize?: EuiIconProps['size']; | ||
} | ||
|
||
const CPULabelHintMap: Record<CPUType, { label: string; hint: string }> = { | ||
self: { | ||
label: i18n.translate('xpack.profiling.cpu.self.label', { | ||
defaultMessage: 'Self CPU', | ||
}), | ||
hint: i18n.translate('xpack.profiling.cpu.self.hint', { | ||
defaultMessage: | ||
'Indicates how much CPU time was spent by the code in the function body, excluding the work done by functions that were called by it', | ||
}), | ||
}, | ||
total: { | ||
label: i18n.translate('xpack.profiling.cpu.total.label', { | ||
defaultMessage: 'Total CPU', | ||
}), | ||
hint: i18n.translate('xpack.profiling.cpu.total.hint', { | ||
defaultMessage: | ||
'Indicates how much CPU time was spent by the function and any functions called by it', | ||
}), | ||
}, | ||
}; | ||
|
||
export function CPULabelWithHint({ iconSize, labelSize, labelStyle, type }: Props) { | ||
const { label, hint } = CPULabelHintMap[type]; | ||
|
||
return ( | ||
<EuiFlexGroup gutterSize="xs" style={{ flexGrow: 0 }}> | ||
<EuiFlexItem grow={false}> | ||
<EuiText size={labelSize} style={labelStyle}> | ||
{label} | ||
</EuiText> | ||
</EuiFlexItem> | ||
<EuiFlexItem grow={false}> | ||
<EuiToolTip content={hint}> | ||
<EuiIcon type="questionInCircle" size={iconSize} /> | ||
</EuiToolTip> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
); | ||
} |
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