From c6aeda96f4795b1046d1d84c210cb2410542223c Mon Sep 17 00:00:00 2001 From: Everett Pompeii Date: Sun, 12 May 2024 21:35:37 -0400 Subject: [PATCH] file_size --- .../explanation/adapters/bmf-example.mdx | 11 ------ .../explanation/adapters/bmf-schema.mdx | 19 ---------- .../explanation/adapters/en/file-size.mdx | 19 ++++------ .../chunks/explanation/adapters/en/json.mdx | 3 -- .../explanation/adapters/file-cmd-example.mdx | 3 -- .../adapters/file-no-cmd-example.mdx | 3 -- .../how_to/custom-benchmarks/en/example.mdx | 5 ++- .../custom-benchmarks/en/results-file.mdx | 4 +- .../file-size/cmd-example.mdx} | 0 .../chunks/how_to/file-size/en/example.mdx | 38 +++++++++++++++++++ .../src/chunks/how_to/file-size/en/intro.mdx | 15 ++++++++ .../chunks/how_to/file-size/json-example.mdx | 9 +++++ .../file-size/no-cmd-example.mdx} | 0 .../src/content/how_to/en/file-size.mdx | 22 +++++++++++ .../src/content/how_to/en/github-app.mdx | 2 +- 15 files changed, 97 insertions(+), 56 deletions(-) delete mode 100644 services/console/src/chunks/explanation/adapters/bmf-example.mdx delete mode 100644 services/console/src/chunks/explanation/adapters/bmf-schema.mdx delete mode 100644 services/console/src/chunks/explanation/adapters/file-cmd-example.mdx delete mode 100644 services/console/src/chunks/explanation/adapters/file-no-cmd-example.mdx rename services/console/src/chunks/{explanation/adapters/file-size-cmd-example.mdx => how_to/file-size/cmd-example.mdx} (100%) create mode 100644 services/console/src/chunks/how_to/file-size/en/example.mdx create mode 100644 services/console/src/chunks/how_to/file-size/en/intro.mdx create mode 100644 services/console/src/chunks/how_to/file-size/json-example.mdx rename services/console/src/chunks/{explanation/adapters/file-size-no-cmd-example.mdx => how_to/file-size/no-cmd-example.mdx} (100%) create mode 100644 services/console/src/content/how_to/en/file-size.mdx diff --git a/services/console/src/chunks/explanation/adapters/bmf-example.mdx b/services/console/src/chunks/explanation/adapters/bmf-example.mdx deleted file mode 100644 index bec079406..000000000 --- a/services/console/src/chunks/explanation/adapters/bmf-example.mdx +++ /dev/null @@ -1,11 +0,0 @@ -```json -{ - "benchmark_name": { - "latency": { - "value": 88.0, - "lower_value": 87.42, - "upper_value": 88.88 - } - } -} -``` \ No newline at end of file diff --git a/services/console/src/chunks/explanation/adapters/bmf-schema.mdx b/services/console/src/chunks/explanation/adapters/bmf-schema.mdx deleted file mode 100644 index 5bbc93f41..000000000 --- a/services/console/src/chunks/explanation/adapters/bmf-schema.mdx +++ /dev/null @@ -1,19 +0,0 @@ -```yml -description: Benchmark Name -type: object -additionalProperties: - description: Measure Name, Slug, or UUID - type: object - properties: - value: - type: number - format: float - lower_value: - type: number - format: float - required: false - upper_value: - type: number - required: - - value -``` \ No newline at end of file diff --git a/services/console/src/chunks/explanation/adapters/en/file-size.mdx b/services/console/src/chunks/explanation/adapters/en/file-size.mdx index 734a39528..42f437b68 100644 --- a/services/console/src/chunks/explanation/adapters/en/file-size.mdx +++ b/services/console/src/chunks/explanation/adapters/en/file-size.mdx @@ -1,20 +1,12 @@ -import FileSizeCmdExample from "../file-size-cmd-example.mdx"; -import FileSizeNoCmdExample from "../file-size-no-cmd-example.mdx"; - ### ⚖️ File Size The bencher run CLI subcommand can be used to track the file size (ie binary size) of your deliverables with the `--file-size` option. The `--file-size` option expects a file path to the file who's size will be measured. Under the hood, bencher run -outputs the results as [Bencher Metric Format (BMF) JSON][json]. -It is therefore good practice to explicitly use the `json` adapter. - -With a command: - - -Without a command: - +outputs the results as[Bencher Metric Format (BMF) JSON][bmf]. +It is therefore good practice to explicitly use [the `json` adapter][json]. +For more details see [how to track file size][file size]. The `file-size` Measure (ie `bytes (B)`) is gathered. Only the file size value (ie `value`) is available. @@ -22,4 +14,7 @@ Neither `lower_value` nor `upper_value` are collected. The `file-size` Measure is not created by default for all Projects. However, when you use the `--file-size` option, this Measures will be automatically created for your Project. -[json]: #-json \ No newline at end of file +[json]: #-json + +[bmf]: /docs/reference/bencher-metric-format/ +[file size]: /docs/how-to/file-size/ diff --git a/services/console/src/chunks/explanation/adapters/en/json.mdx b/services/console/src/chunks/explanation/adapters/en/json.mdx index 966153e86..cc7aab959 100644 --- a/services/console/src/chunks/explanation/adapters/en/json.mdx +++ b/services/console/src/chunks/explanation/adapters/en/json.mdx @@ -1,6 +1,3 @@ -import FileCmdExample from "../file-cmd-example.mdx"; -import FileNoCmdExample from "../file-no-cmd-example.mdx"; - ## \{...\} JSON The JSON Adapter (`json`) expects [Bencher Metric Format (BMF) JSON][bmf]. diff --git a/services/console/src/chunks/explanation/adapters/file-cmd-example.mdx b/services/console/src/chunks/explanation/adapters/file-cmd-example.mdx deleted file mode 100644 index 7bd9f8407..000000000 --- a/services/console/src/chunks/explanation/adapters/file-cmd-example.mdx +++ /dev/null @@ -1,3 +0,0 @@ -```shell -bencher run --file results.json --adapter json "bencher mock > results.json" -``` diff --git a/services/console/src/chunks/explanation/adapters/file-no-cmd-example.mdx b/services/console/src/chunks/explanation/adapters/file-no-cmd-example.mdx deleted file mode 100644 index 676c9d95e..000000000 --- a/services/console/src/chunks/explanation/adapters/file-no-cmd-example.mdx +++ /dev/null @@ -1,3 +0,0 @@ -```shell -bencher mock > results.json && bencher run --file results.json --adapter json -``` diff --git a/services/console/src/chunks/how_to/custom-benchmarks/en/example.mdx b/services/console/src/chunks/how_to/custom-benchmarks/en/example.mdx index 7de5d9569..5a239cb03 100644 --- a/services/console/src/chunks/how_to/custom-benchmarks/en/example.mdx +++ b/services/console/src/chunks/how_to/custom-benchmarks/en/example.mdx @@ -6,8 +6,9 @@ This is an example of BMF JSON: In this example, the key `benchmark_name` would be the name of a [Benchmark][benchmark]. Benchmark names can be any non-empty string up to 1024 characters. -The `benchmark_name` object can contain [Measure][measure] names, slugs, or UUIDs as keys. -If the value specified is a name or slug and the Measure does not already exist, it will be created for you. However, if the value specified is a UUID then the Measure must already exist. +The `benchmark_name` object can contain multiple [Measure][measure] names, slugs, or UUIDs as keys. +If the value specified is a name or slug and the Measure does not already exist, it will be created for you. +However, if the value specified is a UUID then the Measure must already exist. In this example, `latency` is the slug for the built-in Latency Measure. Each Project by default has a Latency (ie `latency`) and Throughput (ie `throughput`) Measure, which are measured in `nanosecond (ns)` and `operations / second (ops/s)` respectively. diff --git a/services/console/src/chunks/how_to/custom-benchmarks/en/results-file.mdx b/services/console/src/chunks/how_to/custom-benchmarks/en/results-file.mdx index 92a558f94..a277d93c6 100644 --- a/services/console/src/chunks/how_to/custom-benchmarks/en/results-file.mdx +++ b/services/console/src/chunks/how_to/custom-benchmarks/en/results-file.mdx @@ -5,10 +5,10 @@ If your results were instead stored in a file named `results.json`, then you could use the `--file` option to specify the file path. This works both with [a benchmark command][bencher run] and without one. -With a command: +With a benchmark command: -Without a command: +Without a benchmark command: [bencher run]: /docs/explanation/bencher-run/#benchmark-command \ No newline at end of file diff --git a/services/console/src/chunks/explanation/adapters/file-size-cmd-example.mdx b/services/console/src/chunks/how_to/file-size/cmd-example.mdx similarity index 100% rename from services/console/src/chunks/explanation/adapters/file-size-cmd-example.mdx rename to services/console/src/chunks/how_to/file-size/cmd-example.mdx diff --git a/services/console/src/chunks/how_to/file-size/en/example.mdx b/services/console/src/chunks/how_to/file-size/en/example.mdx new file mode 100644 index 000000000..0a2d188cd --- /dev/null +++ b/services/console/src/chunks/how_to/file-size/en/example.mdx @@ -0,0 +1,38 @@ +import CmdExample from "../cmd-example.mdx"; +import NoCmdExample from "../no-cmd-example.mdx"; +import JsonExample from "../json-example.mdx"; + +If you had a script located at `./my_build_script.sh` that built your binary +at the path `./path/to/my_binary`, +then you could track the size of this binary file with +bencher run +and [the `json` adapter][json adapter]. +This would work both with [a benchmark command][bencher run] and without one. + +With a benchmark command: + + +Without a benchmark command: + + +In either case, the generated BMF JSON would look like this, +if `my_binary` had a size of `42` bytes: + + + +In this example, the key `my_binary` is the binary file name. +It is used as the name of the [Benchmark][benchmark]. +The `my_binary` object contains the `file-size` key. +`file-size` is the slug for the built-in File Size [Measure][measure]. +The File Size Measure is not created by default for all Projects. +However, when you use the File Size Measure, +it will be automatically created for your Project. +The File Size Measure object contains a [Metric][metric] +with the file size `value` in bytes, `42.0`. + +[json adapter]: /docs/explanation/adapters/#-json +[bencher run]: /docs/explanation/bencher-run/#benchmark-command + +[benchmark]: /docs/explanation/benchmarking/#benchmarks +[measure]: /docs/explanation/benchmarking/#measures +[metric]: /docs/explanation/benchmarking/#metrics \ No newline at end of file diff --git a/services/console/src/chunks/how_to/file-size/en/intro.mdx b/services/console/src/chunks/how_to/file-size/en/intro.mdx new file mode 100644 index 000000000..6e7641101 --- /dev/null +++ b/services/console/src/chunks/how_to/file-size/en/intro.mdx @@ -0,0 +1,15 @@ +Bencher supports [the most popular benchmarking harnesses][adapters] out-of-the-box. +Sometimes though, you want to measure the size of your deliverables themselves, +such as the binary size of your executable. +Lucky for you, Bencher also supports tracking file size. +The easiest way to track file size is to use the +bencher run CLI subcommand +with the `--file-size` option. +The `--file-size` option expects a file path to the file who's size will be measured. +Under the hood, bencher run +outputs the results as [Bencher Metric Format (BMF) JSON][bmf]. +It is therefore good practice to explicitly use [the `json` adapter][json adapter]. + +[adapters]: /docs/explanation/adapters/ +[bmf]: /docs/reference/bencher-metric-format/ +[json adapter]: /docs/explanation/adapters/#-json diff --git a/services/console/src/chunks/how_to/file-size/json-example.mdx b/services/console/src/chunks/how_to/file-size/json-example.mdx new file mode 100644 index 000000000..f91e7eeb3 --- /dev/null +++ b/services/console/src/chunks/how_to/file-size/json-example.mdx @@ -0,0 +1,9 @@ +```json +{ + "my_binary": { + "file-size": { + "value": 42.0, + } + } +} +``` \ No newline at end of file diff --git a/services/console/src/chunks/explanation/adapters/file-size-no-cmd-example.mdx b/services/console/src/chunks/how_to/file-size/no-cmd-example.mdx similarity index 100% rename from services/console/src/chunks/explanation/adapters/file-size-no-cmd-example.mdx rename to services/console/src/chunks/how_to/file-size/no-cmd-example.mdx diff --git a/services/console/src/content/how_to/en/file-size.mdx b/services/console/src/content/how_to/en/file-size.mdx new file mode 100644 index 000000000..2a145ef3d --- /dev/null +++ b/services/console/src/content/how_to/en/file-size.mdx @@ -0,0 +1,22 @@ +--- +title: "Track File Size" +description: "How to track file size and binary size as a part of Continuous Benchmarking" +heading: "How to Track File Size with Bencher" +published: "2024-05-13T07:14:00Z" +modified: "2024-05-13T07:14:00Z" +sortOrder: 6 +--- + +import Intro from "../../../chunks/how_to/file-size/en/intro.mdx"; +import Example from "../../../chunks/how_to/file-size/en/example.mdx"; + + + + +
+ +> 🐰 Congrats! You have learned how to track your file size! 🎉 + +
+ +

Keep Going: Benchmarking Overview ➡

diff --git a/services/console/src/content/how_to/en/github-app.mdx b/services/console/src/content/how_to/en/github-app.mdx index c3893cf75..c70124b70 100644 --- a/services/console/src/content/how_to/en/github-app.mdx +++ b/services/console/src/content/how_to/en/github-app.mdx @@ -4,7 +4,7 @@ description: "Create a GitHub App to allow Bencher Self-Hosted to authenticate w heading: "How to Create a Self-Hosted GitHub App" published: "2023-08-12T16:07:00Z" modified: "2024-04-01T07:00:00Z" -sortOrder: 6 +sortOrder: 7 --- If you are using Bencher Cloud, then you can simply [sign up](/auth/signup) or [log in](/auth/login)