From 96a121a899e9adf15ed831a81b0693ce20c2bccb Mon Sep 17 00:00:00 2001 From: novykh Date: Wed, 15 May 2024 12:32:48 +0300 Subject: [PATCH] v5.0.2 --- package.json | 2 +- src/helpers/units/all.js | 70 ++++-- src/helpers/units/conversableUnits.js | 110 ++++++++- src/helpers/units/index.js | 11 +- src/helpers/units/scalableUnits.js | 1 + .../unitConversion/getConversionUnits.js | 4 +- src/sdk/plugins/unitConversion/index.js | 2 - src/sdk/unitConversion/conversableUnits.js | 217 ----------------- src/sdk/unitConversion/index.js | 20 -- src/sdk/unitConversion/scalableUnits.js | 229 ------------------ 10 files changed, 164 insertions(+), 502 deletions(-) delete mode 100644 src/sdk/unitConversion/conversableUnits.js delete mode 100644 src/sdk/unitConversion/index.js delete mode 100644 src/sdk/unitConversion/scalableUnits.js diff --git a/package.json b/package.json index cb00b01ac..f6b1e9b97 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@netdata/charts", - "version": "5.0.1", + "version": "5.0.2", "description": "Netdata frontend SDK and chart utilities", "main": "dist/index.js", "module": "dist/es6/index.js", diff --git a/src/helpers/units/all.js b/src/helpers/units/all.js index 198881317..76773e37b 100644 --- a/src/helpers/units/all.js +++ b/src/helpers/units/all.js @@ -350,25 +350,27 @@ export default { }, Kibit: { symbol: "Kibit", - name: "kibibit", - print_symbol: "Kibit", + name: "kilobit", + print_symbol: "kb", is_metric: true, is_special: false, is_additive: true, - is_binary: true, + is_binary: false, + is_bit: true, base_unit: "bit", - prefix_symbol: "Ki", + prefix_symbol: "k", }, "Kibit/s": { symbol: "Kibit/s", - name: "kibibit per second", - print_symbol: "Kibit/s", + name: "kilobit per second", + print_symbol: "kb/s", is_metric: true, is_special: false, is_additive: true, - is_binary: true, + is_binary: false, + is_bit: true, base_unit: "bit/s", - prefix_symbol: "Ki", + prefix_symbol: "k", }, MHz: { symbol: "MHz", @@ -405,14 +407,15 @@ export default { }, "Mibit/s": { symbol: "Mibit/s", - name: "mebibit per second", - print_symbol: "Mibit/s", + name: "megabit per second", + print_symbol: "mb/s", is_metric: true, is_special: false, is_additive: true, - is_binary: true, + is_binary: false, + is_bit: true, base_unit: "bit/s", - prefix_symbol: "Mi", + prefix_symbol: "M", }, V: { symbol: "V", @@ -475,7 +478,8 @@ export default { is_metric: true, is_special: false, is_additive: true, - is_binary: true, + is_binary: false, + is_bit: true, }, "bit/s": { symbol: "bit/s", @@ -484,7 +488,8 @@ export default { is_metric: true, is_special: false, is_additive: true, - is_binary: true, + is_binary: false, + is_bit: true, }, "c[CPU]": { symbol: "c[CPU]", @@ -508,6 +513,33 @@ export default { base_unit: "B[mW]", prefix_symbol: "d", }, + d: { + symbol: "d", + name: "day", + print_symbol: "d", + is_metric: false, + is_special: false, + is_additive: true, + is_binary: false, + }, + mo: { + symbol: "mo", + name: "month", + print_symbol: "Mo", + is_metric: false, + is_special: false, + is_additive: true, + is_binary: false, + }, + a: { + symbol: "a", + name: "year", + print_symbol: "yr", + is_metric: false, + is_special: false, + is_additive: true, + is_binary: false, + }, h: { symbol: "h", name: "hour", @@ -517,6 +549,15 @@ export default { is_additive: true, is_binary: false, }, + wk: { + symbol: "wk", + name: "week", + print_symbol: "wk", + is_metric: false, + is_special: false, + is_additive: true, + is_binary: false, + }, "m[CPU]": { symbol: "m[CPU]", name: "milliCPU", @@ -3668,7 +3709,6 @@ export default { "keys/s": "{key}/s", "KiB/operation": "KiBy/{operation}", "KiB/s": "KiBy/s", - "Kibit/s": "Kibit/s", "kills/s": "{kill}/s", "kilobits/s": "Kibit/s", "listeners/s": "{listener}/s", diff --git a/src/helpers/units/conversableUnits.js b/src/helpers/units/conversableUnits.js index c633443aa..4c752225e 100644 --- a/src/helpers/units/conversableUnits.js +++ b/src/helpers/units/conversableUnits.js @@ -45,40 +45,126 @@ export default { convert: value => (value * 9) / 5 + 32, }, }, - s: { - nanoseconds: { - check: (chart, max) => chart.getAttribute("secondsAsTime") && max < 0.000001, - convert: twoFixed(1000_000_000), + ns: { + ns: { + check: (chart, max) => chart.getAttribute("secondsAsTime") && max < 1_000, + convert: function (nanoseconds) { + let tms = Math.round(nanoseconds * 10) + nanoseconds = Math.floor(tms / 10) + + tms -= nanoseconds * 10 + + return `${nanoseconds}.${zeropad(tms)}` + }, + }, + us: { + check: (chart, max) => + chart.getAttribute("secondsAsTime") && max >= 1_000 && max < 1_000 * 1_000, + convert: function (nanoseconds) { + nanoseconds = Math.round(nanoseconds) + + let microseconds = Math.floor(nanoseconds / 1_000) + nanoseconds -= microseconds * 1_000 + + nanoseconds = Math.round(nanoseconds / 10) + + return `${microseconds}.${zeropad(nanoseconds)}` + }, + }, + ms: { + check: (chart, max) => + chart.getAttribute("secondsAsTime") && max >= 1_000 * 1_000 && max < 1_000 * 1_000 * 1_000, + convert: function (nanoseconds) { + nanoseconds = Math.round(nanoseconds) + + let milliseconds = Math.floor(nanoseconds / 1_000 / 1_000) + nanoseconds -= milliseconds * 1_000 * 1_000 + + nanoseconds = Math.round(nanoseconds / 1_000 / 10) + + return `${milliseconds}.${zeropad(nanoseconds)}` + }, + }, + s: { + check: (chart, max) => chart.getAttribute("secondsAsTime") && max >= 1_000 * 1_000 * 1_000, + convert: nanoseconds => { + nanoseconds = Math.round(nanoseconds) + + let seconds = Math.floor(nanoseconds / 1_000 / 1_000 / 1_000) + nanoseconds -= seconds * 1_000 * 1_000 * 1_000 + + nanoseconds = Math.round(nanoseconds / 1_000 / 1_000 / 10) + + return `${seconds}.${zeropad(nanoseconds)}` + }, + }, + }, + ms: { + us: { + check: (chart, max) => chart.getAttribute("secondsAsTime") && max < 1, + convert: twoFixed(1_000), + }, + ms: { + check: (chart, max) => chart.getAttribute("secondsAsTime") && max >= 1 && max < 1_000, + convert: twoFixed(), + }, + s: { + check: (chart, max) => chart.getAttribute("secondsAsTime") && max >= 1_000 && max < 60_000, + convert: twoFixed(0.001), + }, + min: { + check: (chart, max) => + chart.getAttribute("secondsAsTime") && max >= 60_000 && max < 3_600_000, + convert: value => seconds2time(value / 1_000, "MINUTES"), + }, + h: { + check: (chart, max) => + chart.getAttribute("secondsAsTime") && max >= 3_600_000 && max < 86_400_000, + convert: value => seconds2time(value / 1_000, "HOURS"), }, - microseconds: { + d: { + check: (chart, max) => chart.getAttribute("secondsAsTime") && max >= 86_400_000, + convert: value => seconds2time(value / 1_000, "DAYS"), + }, + mo: { + check: (chart, max) => chart.getAttribute("secondsAsTime") && max >= 86_400_000 * 30, + convert: value => seconds2time(value, "DAYS"), + }, + a: { + check: (chart, max) => chart.getAttribute("secondsAsTime") && max >= 86_400_000 * 30 * 12, + convert: value => seconds2time(value, "DAYS"), + }, + }, + s: { + us: { check: (chart, max) => chart.getAttribute("secondsAsTime") && max < 0.001, convert: twoFixed(1000_000), }, - milliseconds: { + ms: { check: (chart, max) => chart.getAttribute("secondsAsTime") && max >= 0.001 && max < 1, convert: twoFixed(1000), }, - seconds: { + s: { check: (chart, max) => chart.getAttribute("secondsAsTime") && max >= 1 && max < 60, convert: twoFixed(1), }, - "duration (minutes, seconds)": { + min: { check: (chart, max) => chart.getAttribute("secondsAsTime") && max >= 60 && max < 3_600, convert: value => seconds2time(value, "MINUTES"), }, - "duration (hours, minutes)": { + h: { check: (chart, max) => chart.getAttribute("secondsAsTime") && max >= 3_600 && max < 86_400, convert: value => seconds2time(value, "HOURS"), }, - "duration (days, hours)": { + d: { check: (chart, max) => chart.getAttribute("secondsAsTime") && max >= 86_400, convert: value => seconds2time(value, "DAYS"), }, - "duration (months, days)": { + mo: { check: (chart, max) => chart.getAttribute("secondsAsTime") && max >= 86_400 * 30, convert: value => seconds2time(value, "DAYS"), }, - "duration (years, months)": { + a: { check: (chart, max) => chart.getAttribute("secondsAsTime") && max >= 86_400 * 30 * 12, convert: value => seconds2time(value, "DAYS"), }, diff --git a/src/helpers/units/index.js b/src/helpers/units/index.js index 3efd2a456..086a0843e 100644 --- a/src/helpers/units/index.js +++ b/src/helpers/units/index.js @@ -9,6 +9,7 @@ export const getUnitConfig = u => is_additive: true, is_metric: true, is_binary: false, + is_bit: false, } const findCurly = u => { @@ -29,26 +30,28 @@ export const isAdditive = u => typeof u === "string" ? getUnitConfig(u).is_additive : u.is_additive export const isMetric = u => (typeof u === "string" ? getUnitConfig(u).is_metric : u.is_metric) export const isBinary = u => (typeof u === "string" ? getUnitConfig(u).is_binary : u.is_binary) +export const isBit = u => (typeof u === "string" ? getUnitConfig(u).is_bit : u.is_bit) export const getScales = u => { if (!isAdditive(u)) return [[], {}] if (isBinary(u)) return [[...keys.binary], scalableUnits.binary] if (!isMetric(u)) return [[...keys.decimal], scalableUnits.decimal] + if (isBit(u)) return [[...keys.bit], scalableUnits.num] return [[...keys.num], scalableUnits.num] } const labelify = (base, config, long) => { if (!config || !base) return base - if (long) return config.name || base - return config.print_symbol || base + if (long) return typeof config.name === "undefined" ? base : config.name + return typeof config.print_symbol === "undefined" ? base : config.print_symbol } export const getUnitsString = (u, prefix = "", base = "", long) => { if (!isAdditive(u)) return base - if (isMetric(u) || isBinary(u)) - return `${labelify(prefix, allUnits.prefixes[prefix], long)}${isBinary(u) ? "" : " "}${labelify(base, u, long)}`.trim() + if (isMetric(u) || isBinary(u) || isBit(u)) + return `${labelify(prefix, allUnits.prefixes[prefix], long)}${isBinary(u) || isBit(u) ? "" : " "}${labelify(base, u, long)}`.trim() return `${labelify(prefix, allUnits.decimal_prefixes[prefix], long)} ${labelify(base, u, long)}`.trim() } diff --git a/src/helpers/units/scalableUnits.js b/src/helpers/units/scalableUnits.js index fc86143d9..02b356670 100644 --- a/src/helpers/units/scalableUnits.js +++ b/src/helpers/units/scalableUnits.js @@ -1,6 +1,7 @@ export const keys = { binary: ["Ki", "Mi", "Gi", "Ti"], decimal: ["K", "M", "B", "T"], + bit: ["k", "M", "G", "T", "P", "E", "Z", "Y"], num: [ "y", "z", diff --git a/src/sdk/plugins/unitConversion/getConversionUnits.js b/src/sdk/plugins/unitConversion/getConversionUnits.js index 0b16f50cc..a63939887 100644 --- a/src/sdk/plugins/unitConversion/getConversionUnits.js +++ b/src/sdk/plugins/unitConversion/getConversionUnits.js @@ -15,7 +15,7 @@ const scalable = (units, delta, desiredUnits) => { if (desiredScales) { return [ "adjust", - value => (value / (scaleByKey[prefix] || 1)) * (scaleByKey[desiredPrefix] || 1), + value => (value * (scaleByKey[prefix] || 1)) / (scaleByKey[desiredPrefix] || 1), desiredPrefix, desiredBase, ] @@ -27,7 +27,7 @@ const scalable = (units, delta, desiredUnits) => { return scale ? [ "adjust", - value => (value / (scaleByKey[prefix] || 1)) * (scaleByKey[scale] || 1), + value => (value * (scaleByKey[prefix] || 1)) / (scaleByKey[scale] || 1), scale, base, ] diff --git a/src/sdk/plugins/unitConversion/index.js b/src/sdk/plugins/unitConversion/index.js index a6677048b..178342a8b 100644 --- a/src/sdk/plugins/unitConversion/index.js +++ b/src/sdk/plugins/unitConversion/index.js @@ -19,8 +19,6 @@ const baseConvert = (chart, unitsKey = "units", min, max) => { const unitsStsByContext = chart.getAttribute(`${unitsKey}StsByContext`) - console.log(unitsStsByContext) - chart.updateAttribute( `${unitsKey}ByContext`, Object.keys(unitsStsByContext).reduce((h, ctx) => { diff --git a/src/sdk/unitConversion/conversableUnits.js b/src/sdk/unitConversion/conversableUnits.js deleted file mode 100644 index 65cabf1fd..000000000 --- a/src/sdk/unitConversion/conversableUnits.js +++ /dev/null @@ -1,217 +0,0 @@ -import zeropad from "@/helpers/zeropad" - -export const makeConversableKey = (unit, scale) => `${unit}-${scale}` - -const fahrenheit = { - check: chart => chart.getAttribute("temperature") === "fahrenheit", - convert: value => (value * 9) / 5 + 32, -} - -const seconds2time = (seconds, maxTimeUnit, minTimeUnit = "MS") => { - // todo maybe we should resign from MS, if we're only showing zeroes. we just need to properly - // annotate units in this case (not to show "HH:MM:SS.ms") - let secondsReturn = Math.abs(seconds) - - const days = Math.floor(secondsReturn / 86_400) - const daysString = maxTimeUnit === "DAYS" ? `${days}d` : "" - - secondsReturn -= days * 86_400 - - const hours = Math.floor(secondsReturn / 3_600) - const hoursString = zeropad(hours) - - if (maxTimeUnit === "DAYS") return `${daysString}:${hoursString}` - - secondsReturn -= hours * 3_600 - - const minutes = Math.floor(secondsReturn / 60) - const minutesString = zeropad(minutes) - - if (maxTimeUnit === "HOURS") return `${hoursString}:${minutesString}` - - secondsReturn -= minutes * 60 - - const secondsString = zeropad( - minTimeUnit === "MS" ? secondsReturn.toFixed(2) : Math.round(secondsReturn) - ) - - return `${minutesString}:${secondsString}` -} - -const twoFixed = - (multiplier = 1) => - value => - (value * multiplier).toFixed(2) - -export default { - Celsius: { - Fahrenheit: fahrenheit, - }, - celsius: { - fahrenheit: fahrenheit, - }, - milliseconds: { - microseconds: { - check: (chart, max) => chart.getAttribute("secondsAsTime") && max < 1, - convert: twoFixed(1_000), - }, - milliseconds: { - check: (chart, max) => chart.getAttribute("secondsAsTime") && max >= 1 && max < 1_000, - convert: twoFixed(), - }, - seconds: { - check: (chart, max) => chart.getAttribute("secondsAsTime") && max >= 1_000 && max < 60_000, - convert: twoFixed(0.001), - }, - "duration (minutes, seconds)": { - check: (chart, max) => - chart.getAttribute("secondsAsTime") && max >= 60_000 && max < 3_600_000, - convert: value => seconds2time(value / 1_000, "MINUTES"), - }, - "duration (hours, minutes)": { - check: (chart, max) => - chart.getAttribute("secondsAsTime") && max >= 3_600_000 && max < 86_400_000, - convert: value => seconds2time(value / 1_000, "HOURS"), - }, - "duration (days, hours)": { - check: (chart, max) => chart.getAttribute("secondsAsTime") && max >= 86_400_000, - convert: value => seconds2time(value / 1_000, "DAYS"), - }, - "duration (months, days)": { - check: (chart, max) => chart.getAttribute("secondsAsTime") && max >= 86_400_000 * 30, - convert: value => seconds2time(value, "DAYS"), - }, - "duration (years, months)": { - check: (chart, max) => chart.getAttribute("secondsAsTime") && max >= 86_400_000 * 30 * 12, - convert: value => seconds2time(value, "DAYS"), - }, - }, - ms: { - microseconds: { - check: (chart, max) => chart.getAttribute("secondsAsTime") && max < 1, - convert: twoFixed(1_000), - }, - milliseconds: { - check: (chart, max) => chart.getAttribute("secondsAsTime") && max >= 1 && max < 1_000, - convert: twoFixed(), - }, - seconds: { - check: (chart, max) => chart.getAttribute("secondsAsTime") && max >= 1_000 && max < 60_000, - convert: twoFixed(0.001), - }, - "duration (minutes, seconds)": { - check: (chart, max) => - chart.getAttribute("secondsAsTime") && max >= 60_000 && max < 3_600_000, - convert: value => seconds2time(value / 1_000, "MINUTES"), - }, - "duration (hours, minutes)": { - check: (chart, max) => - chart.getAttribute("secondsAsTime") && max >= 3_600_000 && max < 86_400_000, - convert: value => seconds2time(value / 1_000, "HOURS"), - }, - "duration (days, hours)": { - check: (chart, max) => chart.getAttribute("secondsAsTime") && max >= 86_400_000, - convert: value => seconds2time(value / 1_000, "DAYS"), - }, - "duration (months, days)": { - check: (chart, max) => chart.getAttribute("secondsAsTime") && max >= 86_400_000 * 30, - convert: value => seconds2time(value, "DAYS"), - }, - "duration (years, months)": { - check: (chart, max) => chart.getAttribute("secondsAsTime") && max >= 86_400_000 * 30 * 12, - convert: value => seconds2time(value, "DAYS"), - }, - }, - seconds: { - microseconds: { - check: (chart, max) => chart.getAttribute("secondsAsTime") && max < 0.001, - convert: twoFixed(1000_000), - }, - milliseconds: { - check: (chart, max) => chart.getAttribute("secondsAsTime") && max >= 0.001 && max < 1, - convert: twoFixed(1000), - }, - seconds: { - check: (chart, max) => chart.getAttribute("secondsAsTime") && max >= 1 && max < 60, - convert: twoFixed(1), - }, - "duration (minutes, seconds)": { - check: (chart, max) => chart.getAttribute("secondsAsTime") && max >= 60 && max < 3_600, - convert: value => seconds2time(value, "MINUTES"), - }, - "duration (hours, minutes)": { - check: (chart, max) => chart.getAttribute("secondsAsTime") && max >= 3_600 && max < 86_400, - convert: value => seconds2time(value, "HOURS"), - }, - "duration (days, hours)": { - check: (chart, max) => chart.getAttribute("secondsAsTime") && max >= 86_400, - convert: value => seconds2time(value, "DAYS"), - }, - "duration (months, days)": { - check: (chart, max) => chart.getAttribute("secondsAsTime") && max >= 86_400 * 30, - convert: value => seconds2time(value, "DAYS"), - }, - "duration (years, months)": { - check: (chart, max) => chart.getAttribute("secondsAsTime") && max >= 86_400 * 30 * 12, - convert: value => seconds2time(value, "DAYS"), - }, - "dHH:MM:ss": { - check: () => false, // only accepting desiredUnits - convert: value => seconds2time(value, "DAYS", "SECONDS"), - }, - }, - nanoseconds: { - nanoseconds: { - check: (chart, max) => chart.getAttribute("secondsAsTime") && max < 1_000, - convert: function (nanoseconds) { - let tms = Math.round(nanoseconds * 10) - nanoseconds = Math.floor(tms / 10) - - tms -= nanoseconds * 10 - - return `${nanoseconds}.${zeropad(tms)}` - }, - }, - microseconds: { - check: (chart, max) => - chart.getAttribute("secondsAsTime") && max >= 1_000 && max < 1_000 * 1_000, - convert: function (nanoseconds) { - nanoseconds = Math.round(nanoseconds) - - let microseconds = Math.floor(nanoseconds / 1_000) - nanoseconds -= microseconds * 1_000 - - nanoseconds = Math.round(nanoseconds / 10) - - return `${microseconds}.${zeropad(nanoseconds)}` - }, - }, - milliseconds: { - check: (chart, max) => - chart.getAttribute("secondsAsTime") && max >= 1_000 * 1_000 && max < 1_000 * 1_000 * 1_000, - convert: function (nanoseconds) { - nanoseconds = Math.round(nanoseconds) - - let milliseconds = Math.floor(nanoseconds / 1_000 / 1_000) - nanoseconds -= milliseconds * 1_000 * 1_000 - - nanoseconds = Math.round(nanoseconds / 1_000 / 10) - - return `${milliseconds}.${zeropad(nanoseconds)}` - }, - }, - seconds: { - check: (chart, max) => chart.getAttribute("secondsAsTime") && max >= 1_000 * 1_000 * 1_000, - convert: nanoseconds => { - nanoseconds = Math.round(nanoseconds) - - let seconds = Math.floor(nanoseconds / 1_000 / 1_000 / 1_000) - nanoseconds -= seconds * 1_000 * 1_000 * 1_000 - - nanoseconds = Math.round(nanoseconds / 1_000 / 1_000 / 10) - - return `${seconds}.${zeropad(nanoseconds)}` - }, - }, - }, -} diff --git a/src/sdk/unitConversion/index.js b/src/sdk/unitConversion/index.js deleted file mode 100644 index 7b3ff3c3b..000000000 --- a/src/sdk/unitConversion/index.js +++ /dev/null @@ -1,20 +0,0 @@ -import conversableUnits, { makeConversableKey } from "./conversableUnits" - -const converts = Object.keys(conversableUnits).reduce((acc, unit) => { - Object.keys(conversableUnits[unit]).forEach(scale => { - acc[makeConversableKey(unit, scale)] = (chart, value) => - conversableUnits[unit][scale].convert(value, chart) - }) - return acc -}, {}) - -const byMethod = { - ...converts, - original: (chart, value) => value, - divide: (chart, value, divider) => value / divider, -} - -export default (chart, method, value, divider) => { - const func = byMethod[method] || byMethod.original - return func(chart, value, divider) -} diff --git a/src/sdk/unitConversion/scalableUnits.js b/src/sdk/unitConversion/scalableUnits.js deleted file mode 100644 index 226c942c3..000000000 --- a/src/sdk/unitConversion/scalableUnits.js +++ /dev/null @@ -1,229 +0,0 @@ -export default { - "packets/s": { - pps: 1, - Kpps: 1000, - Mpps: 1000 * 1000, - Gpps: 1000 * 1000 * 1000, - Tpps: 1000 * 1000 * 1000 * 1000, - Ppps: 1000 * 1000 * 1000 * 1000 * 1000, - Epps: 1000 * 1000 * 1000 * 1000 * 1000 * 1000, - }, - pps: { - pps: 1, - Kpps: 1000, - Mpps: 1000 * 1000, - Gpps: 1000 * 1000 * 1000, - Tpps: 1000 * 1000 * 1000 * 1000, - Ppps: 1000 * 1000 * 1000 * 1000 * 1000, - Epps: 1000 * 1000 * 1000 * 1000 * 1000 * 1000, - }, - "kilobits/s": { - "bits/s": 1 / 1000, - "kilobits/s": 1, - "megabits/s": 1000, - "gigabits/s": 1000 * 1000, - "terabits/s": 1000 * 1000 * 1000, - "petabits/s": 1000 * 1000 * 1000 * 1000, - "exabits/s": 1000 * 1000 * 1000 * 1000, - }, - "bytes/s": { - "bytes/s": 1, - "kilobytes/s": 1024, - "megabytes/s": 1024 * 1024, - "gigabytes/s": 1024 * 1024 * 1024, - "terabytes/s": 1024 * 1024 * 1024 * 1024, - "petabits/s": 1024 * 1024 * 1024 * 1024 * 1024, - "exabits/s": 1024 * 1024 * 1024 * 1024 * 1024 * 1024, - }, - "kilobytes/s": { - "bytes/s": 1 / 1024, - "kilobytes/s": 1, - "megabytes/s": 1024, - "gigabytes/s": 1024 * 1024, - "terabytes/s": 1024 * 1024 * 1024, - "petabits/s": 1024 * 1024 * 1024 * 1024, - "exabits/s": 1024 * 1024 * 1024 * 1024 * 1024, - }, - "B/s": { - "B/s": 1, - "KiB/s": 1024, - "MiB/s": 1024 * 1024, - "GiB/s": 1024 * 1024 * 1024, - "TiB/s": 1024 * 1024 * 1024 * 1024, - "PiB/s": 1024 * 1024 * 1024 * 1024 * 1024, - "EiB/s": 1024 * 1024 * 1024 * 1024 * 1024 * 1024, - }, - "KB/s": { - "B/s": 1 / 1024, - "KB/s": 1, - "MB/s": 1024, - "GB/s": 1024 * 1024, - "TB/s": 1024 * 1024 * 1024, - "PB/s": 1024 * 1024 * 1024 * 1024, - "EB/s": 1024 * 1024 * 1024 * 1024 * 1024, - }, - "KiB/s": { - "B/s": 1 / 1024, - "KiB/s": 1, - "MiB/s": 1024, - "GiB/s": 1024 * 1024, - "TiB/s": 1024 * 1024 * 1024, - "PiB/s": 1024 * 1024 * 1024 * 1024, - "EiB/s": 1024 * 1024 * 1024 * 1024 * 1024, - }, - bytes: { - bytes: 1, - kilobytes: 1024, - megabytes: 1024 * 1024, - gigabytes: 1024 * 1024 * 1024, - terabytes: 1024 * 1024 * 1024 * 1024, - petabytes: 1024 * 1024 * 1024 * 1024 * 1024, - exabytes: 1024 * 1024 * 1024 * 1024 * 1024 * 1024, - }, - B: { - B: 1, - KiB: 1024, - MiB: 1024 * 1024, - GiB: 1024 * 1024 * 1024, - TiB: 1024 * 1024 * 1024 * 1024, - PiB: 1024 * 1024 * 1024 * 1024 * 1024, - EiB: 1024 * 1024 * 1024 * 1024 * 1024 * 1024, - }, - KB: { - B: 1 / 1024, - KB: 1, - MB: 1024, - GB: 1024 * 1024, - TB: 1024 * 1024 * 1024, - PB: 1024 * 1024 * 1024 * 1024, - EB: 1024 * 1024 * 1024 * 1024 * 1024, - }, - KiB: { - B: 1 / 1024, - KiB: 1, - MiB: 1024, - GiB: 1024 * 1024, - TiB: 1024 * 1024 * 1024, - PiB: 1024 * 1024 * 1024 * 1024, - EiB: 1024 * 1024 * 1024 * 1024 * 1024, - }, - MB: { - B: 1 / (1024 * 1024), - KB: 1 / 1024, - MB: 1, - GB: 1024, - TB: 1024 * 1024, - PB: 1024 * 1024 * 1024, - EB: 1024 * 1024 * 1024 * 1024, - }, - MiB: { - B: 1 / (1024 * 1024), - KiB: 1 / 1024, - MiB: 1, - GiB: 1024, - TiB: 1024 * 1024, - PiB: 1024 * 1024 * 1024, - EiB: 1024 * 1024 * 1024 * 1024, - }, - GB: { - B: 1 / (1024 * 1024 * 1024), - KB: 1 / (1024 * 1024), - MB: 1 / 1024, - GB: 1, - }, - GiB: { - B: 1 / (1024 * 1024 * 1024), - KiB: 1 / (1024 * 1024), - MiB: 1 / 1024, - GiB: 1, - TiB: 1024, - PiB: 1024 * 1024, - EiB: 1024 * 1024 * 1024, - }, - "[CPU]": { - "m[CPU]": 1 / 1000, - "c[CPU]": 1 / 100, - "[CPU]": 1, - }, - "c[CPU]": { - "m[CPU]": 1 / 10, - "c[CPU]": 1, - "[CPU]": 1 * 100, - }, - "m[CPU]": { - "m[CPU]": 1, - "c[CPU]": 1 * 10, - "[CPU]": 1 * 1000, - }, - HZ: { - HZ: 1, - MHz: 1 * 1000, - GHz: 1 * 1000 * 1000, - }, - MHz: { - HZ: 1 / 1000, - MHz: 1, - GHz: 1 * 1000, - }, - GHz: { - HZ: 1 / (1000 * 1000), - MHz: 1 / 1000, - GHz: 1, - }, - "By/s": { - "By/s": 1, - "KiBy/s": 1024, - "MiBy/s": 1024 * 1024, - "GiBy/s": 1024 * 1024 * 1024, - }, - "KiBy/s": { - "By/s": 1 / 1024, - "KiBy/s": 1, - "MiBy/s": 1024, - "GiBy/s": 1024 * 1024, - }, - By: { - By: 1, - KiBy: 1024, - MiBy: 1024 * 1024, - GiBy: 1024 * 1024 * 1024, - }, - KiBy: { - By: 1 / 1024, - KiBy: 1, - MiBy: 1024, - GiBy: 1024 * 1024, - }, - MiBy: { - By: 1 / (1024 * 1024), - KiBy: 1 / 1024, - MiBy: 1, - GiBy: 1024, - }, - GiBy: { - By: 1 / (1024 * 1024 * 1024), - KiBy: 1 / (1024 * 1024), - MiBy: 1 / 1024, - GiBy: 1, - TB: 1024, - PB: 1024 * 1024, - EB: 1024 * 1024 * 1024, - }, - num: { - "num (f)": 1 / (1000 * 1000 * 1000 * 1000 * 1000), - "num (p)": 1 / (1000 * 1000 * 1000 * 1000), - "num (n)": 1 / (1000 * 1000 * 1000), - "num (μ)": 1 / (1000 * 1000), - "num (m)": 1 / 1000, - // "num (c)": 1 / 100, - "num (A)": 1, - "num (k)": 1000, - "num (M)": 1000 * 1000, - "num (G)": 1000 * 1000 * 1000, - "num (T)": 1000 * 1000 * 1000 * 1000, - "num (P)": 1000 * 1000 * 1000 * 1000 * 1000, - "num (E)": 1000 * 1000 * 1000 * 1000 * 1000 * 1000, - "num (Z)": 1000 * 1000 * 1000 * 1000 * 1000 * 1000 * 1000, - "num (Y)": 1000 * 1000 * 1000 * 1000 * 1000 * 1000 * 1000 * 1000, - }, -}