Re: [Automated-testing] KCIDB: Support non-binary test outputs V3

Nikolai Kondrashov <[email protected]>
Newsgroups dev.linux.lists.kernelci
Message-ID <[email protected]>
On 8/16/24 7:43 PM, Tim Bird wrote:
>> -----Original Message-----
>> From: [email protected] <[email protected]> On Behalf Of Nikolai Kondrashov
>> On 8/16/24 1:03 PM, Nikolai Kondrashov wrote:
>>
>>     "number": {
>>         "type": "object",
>>         "properties": {
>>             "value": {"type": "number"},
>>             "unit": {"type": "string"},
>>             "prefix": {
>>                 "type": "string",
>>                 "enum": ["metric", "binary"],
> 
> What is the purpose of the metric/binary enum?  Is it to disambiguate the meaning
> of K and M in unit prefixes?  Is it only for display?

Yep! Only for display. For those people who prefer **real** kilobytes :D

Taking the previous example:

    "value": 5.12e5,
    "unit": "B",
    "prefix": "binary",
    # Display: 500 KiB

And changing the prefix to "metric", produces this:

    "value": 5.12e5,
    "unit": "B",
    "prefix": "metric",
    # Display: 512 KB

Which could make some old-school people feel robbed.

>> And the rewritten examples:
>>
>>     "value": 42,
>>     # Display: 42
>>
>>     "value": 3.14159,
>>     # Display: 3.14159
>>
>>     "value": 720,
>>     "unit": "KB",
>>     # Display: 720 KB
>>
>>     "value": 145000,
>>     "prefix": "metric"
>>     # Display: 145 K
>>
>>     "value": 1.6e-7,
>>     "unit": "s",
>>     "prefix": "metric",
>>     # Display: 160 ns
>>
>>     "value": 5.12e5,
>>     "unit": "B",
>>     "prefix": "binary",
>>     # Display: 500 KiB
> 
> 
> Looks good to me!!

Awesome!

Thanks, Tim.
Nick
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.