Skip to content

Conversation

@henrikingo
Copy link

Hi

A customer uses time a lot to time database queries, so added a parser for it.

@coderabbitai
Copy link

coderabbitai bot commented Jan 30, 2026

📝 Walkthrough

Walkthrough

Adds support for the "time" CLI utility benchmarking tool to the github-action-benchmark action. Changes include workflow configuration, tool registration, parsing logic for time command output, test coverage, and documentation.

Changes

Cohort / File(s) Summary
Configuration & Type Support
action-types.yml, action.yml, src/config.ts
Registers "time" as a valid tool option in action types, input descriptions, and configuration constants.
Parsing & Extraction Logic
src/extract.ts
Implements parseTimeOutput and extractTimeBenchmarkResult functions to parse time command output (real/user/sys) into BenchmarkResult entries; integrates new extractor into switch case.
Write Logic
src/write.ts
Adds "time" case to biggerIsBetter switch, setting value to false (time is not better when higher).
Documentation
README.md, examples/time/README.md
Documents time tool support in README summary and adds example workflow with YAML configuration and usage guidance.
Workflow & Tests
.github/workflows/time.yml, test/data/extract/time_output.txt, test/extract.spec.ts
Adds time-based benchmark workflow pipeline with GitHub Actions and corresponding test data/cases.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title directly describes the main change: adding support for the time CLI utility as a benchmark tool option.
Description check ✅ Passed The description explains the business motivation (customer needs) and clearly relates to the changeset (adding a parser for the time CLI utility).

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 13

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
README.md (1)

387-388: ⚠️ Potential issue | 🟡 Minor

Update tool list to include "time".

The tool description on line 388 lists all valid tools but omits "time", which was added in this PR. This is inconsistent with the actual valid tools defined in action.yml (line 14) and src/config.ts.

📝 Proposed fix
 Tool for running benchmark. The value must be one of `"cargo"`, `"go"`, `"benchmarkjs"`, `"pytest"`,
-`"googlecpp"`, `"catch2"`, `"julia"`, `"jmh"`, `"benchmarkdotnet"`,`"benchmarkluau"`, `"customBiggerIsBetter"`, `"customSmallerIsBetter"`.
+`"googlecpp"`, `"catch2"`, `"julia"`, `"jmh"`, `"benchmarkdotnet"`, `"benchmarkluau"`, `"time"`, `"customBiggerIsBetter"`, `"customSmallerIsBetter"`.
🤖 Fix all issues with AI agents
In @.github/workflows/time.yml:
- Line 20: Update the GitHub Actions checkout step to use the newer
actions/checkout@v4 instead of actions/checkout@v3; locate the workflow step
that currently contains the string "uses: actions/checkout@v3" and change it to
"uses: actions/checkout@v4" to pick up Node.js 20 support and performance
improvements.
- Line 22: Replace the blocking entropy source in the workflow run command:
update the run step that currently invokes (time (head --bytes=1000000000
/dev/random >/dev/null)) 2>&1 | tee output.txt to use /dev/urandom instead of
/dev/random so the head --bytes invocation is non-blocking and yields consistent
benchmark timing.
- Line 36: The YAML value for the key alert-comment-cc-users is invalid because
it's written as a comma-separated string ('@ktrz','@henrikingo'); change it to a
proper YAML sequence or a multiline string supported by the action. Replace the
current value with either a YAML array (e.g., alert-comment-cc-users: ["@ktrz",
"@henrikingo"]) or a pipe-delimited block (alert-comment-cc-users: | followed by
each user on its own line) so actionlint will parse the workflow correctly.
- Line 50: The YAML entry for alert-comment-cc-users is using invalid syntax
("'@ktrz','@henrikingo'"); update the alert-comment-cc-users value to a proper
YAML sequence such as alert-comment-cc-users: ['@ktrz', '@henrikingo'] or a
block list (- '@ktrz' / - '@henrikingo') so the workflow parser accepts it; edit
the alert-comment-cc-users line in the time.yml workflow to use one of these
valid list formats.

In `@action.yml`:
- Line 14: Update the description string for the action (the description key in
action.yml) to include the missing valid tool names "jmh" and "benchmarkluau" so
the full list of allowed tools reflects all supported options; simply add "jmh"
and "benchmarkluau" into the quoted comma-separated list in the existing
description value.

In `@examples/time/README.md`:
- Line 24: The sentence "Note the `2>&1` too capture also stderr output."
contains a typo: replace "too" with "to" in that sentence (the line containing
"Note the `2>&1` too capture also stderr output.") so it reads "Note the `2>&1`
to capture also stderr output." and commit the corrected README entry.
- Line 29: The README line "Store the benchmark results with step using the
action. Please set `cargo` to `tool` input." incorrectly references `cargo`;
update the documentation to instruct users to set the action's tool input to
`time` (i.e., replace `cargo` with `time`) so the example and explanation use
the correct tool name mentioned in the README phrase.
- Around line 8-9: The README line currently describes using
github-action-benchmark with "cargo bench" (a Rust tool) by mistake; update that
sentence to describe using the time CLI utility instead: replace the phrase
"with [`cargo
bench`](https://doc.rust-lang.org/cargo/commands/cargo-bench.html)" with wording
like "with the `time` CLI utility" and point the link to the appropriate time
documentation (e.g., the `time` man page or project page), keeping the reference
to [`github-action-benchmark`] intact so the sentence accurately describes using
github-action-benchmark with the time tool.
- Line 5: The README link points to the "Rust Example" workflow by mistake;
update the markdown link in examples/time/README.md to reference the "time
Example" workflow by replacing workflow%3A%22Rust+Example%22 with
workflow%3A%22time+Example%22 in the URL (and change the link text if it
currently says "Rust Example" to "time Example") so the Action log opens the
correct workflow.

In `@README.md`:
- Line 55: The table row for "Time (CLI utility)" is malformed — add the missing
third column (Example Project) and the trailing pipe to restore table alignment;
update the row containing "Time (CLI utility)" and the link
[`time`][time-workflow-example] so it has a third column (can be an example
project name or an empty cell) and ends with a final pipe.

In `@src/extract.ts`:
- Around line 696-705: The parseTimeOutput function is incorrectly using
tparts[1].substring(-1) which returns the whole string (including the trailing
's') and causes parseFloat to yield NaN; update parseTimeOutput to remove the
trailing 's' using tparts[1].slice(0, -1) before calling parseFloat (and ensure
you still guard for undefined t and tparts[1] as currently done).
- Around line 746-751: The three benchmark results all use the literal name
values ('real', 'user', 'sys'), losing per-command context; update the
results.push calls (the objects constructed in the results.push in this snippet)
to include the command identifier from the existing extra/name variable in the
benchmark name (e.g. combine the command name variable "name" with the metric
label so the name field becomes commandName + '-real' (and similarly '-user' and
'-sys')), and ensure you make the same change for the other two pushes that
produce 'user' and 'sys' entries.
- Around line 728-781: The parsing of time outputs in extractTimeBenchmarkResult
(which calls parseTimeOutput) fails for locales using commas as decimal
separators (e.g., "0m0,100s"); update parseTimeOutput to normalize locale
decimals by replacing a single comma in the fractional part with a dot (and
strip any thousands separators) before calling parseFloat, ensuring lines like
"0m0,100s" and "0m0.100s" both parse correctly; adjust parseTimeOutput
(referenced by extractTimeBenchmarkResult) to perform this normalization and add
tests for comma and dot decimals.

name: Run Some silly benchmark under `time`
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

Consider updating to actions/checkout@v4.

v3 is still functional but v4 is the current recommended version with Node.js 20 support and performance improvements.

🔧 Proposed fix
-      - uses: actions/checkout@v3
+      - uses: actions/checkout@v4
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- uses: actions/checkout@v3
- uses: actions/checkout@v4
🤖 Prompt for AI Agents
In @.github/workflows/time.yml at line 20, Update the GitHub Actions checkout
step to use the newer actions/checkout@v4 instead of actions/checkout@v3; locate
the workflow step that currently contains the string "uses: actions/checkout@v3"
and change it to "uses: actions/checkout@v4" to pick up Node.js 20 support and
performance improvements.

steps:
- uses: actions/checkout@v3
- name: Run some silly benchmark with time
run: (time (head --bytes=1000000000 /dev/random >/dev/null)) 2>&1 | tee output.txt
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Use /dev/urandom instead of /dev/random.

/dev/random blocks when the entropy pool is exhausted, which can cause inconsistent benchmark times. /dev/urandom is non-blocking and sufficient for this use case.

🔧 Proposed fix
-        run: (time (head --bytes=1000000000 /dev/random  >/dev/null)) 2>&1 | tee output.txt
+        run: (time (head --bytes=1000000000 /dev/urandom  >/dev/null)) 2>&1 | tee output.txt
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
run: (time (head --bytes=1000000000 /dev/random >/dev/null)) 2>&1 | tee output.txt
run: (time (head --bytes=1000000000 /dev/urandom >/dev/null)) 2>&1 | tee output.txt
🤖 Prompt for AI Agents
In @.github/workflows/time.yml at line 22, Replace the blocking entropy source
in the workflow run command: update the run step that currently invokes (time
(head --bytes=1000000000 /dev/random >/dev/null)) 2>&1 | tee output.txt to use
/dev/urandom instead of /dev/random so the head --bytes invocation is
non-blocking and yields consistent benchmark timing.

alert-threshold: '200%'
comment-on-alert: true
fail-on-alert: true
alert-comment-cc-users: '@ktrz','@henrikingo'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Invalid YAML syntax for alert-comment-cc-users.

The value '@ktrz','@henrikingo' is not valid YAML. This is causing the actionlint parsing error. Use proper YAML array syntax:

🔧 Proposed fix
-          alert-comment-cc-users: '@ktrz','@henrikingo'
+          alert-comment-cc-users: '@ktrz,`@henrikingo`'

Or as an explicit YAML list if the action supports it:

          alert-comment-cc-users: |
            `@ktrz`
            `@henrikingo`
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
alert-comment-cc-users: '@ktrz','@henrikingo'
alert-comment-cc-users: '@ktrz,`@henrikingo`'
🤖 Prompt for AI Agents
In @.github/workflows/time.yml at line 36, The YAML value for the key
alert-comment-cc-users is invalid because it's written as a comma-separated
string ('@ktrz','@henrikingo'); change it to a proper YAML sequence or a
multiline string supported by the action. Replace the current value with either
a YAML array (e.g., alert-comment-cc-users: ["@ktrz", "@henrikingo"]) or a
pipe-delimited block (alert-comment-cc-users: | followed by each user on its own
line) so actionlint will parse the workflow correctly.

alert-threshold: '200%'
comment-on-alert: true
fail-on-alert: true
alert-comment-cc-users: '@ktrz','@henrikingo'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Same YAML syntax issue as Line 36.

🔧 Proposed fix
-          alert-comment-cc-users: '@ktrz','@henrikingo'
+          alert-comment-cc-users: '@ktrz,`@henrikingo`'
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
alert-comment-cc-users: '@ktrz','@henrikingo'
alert-comment-cc-users: '@ktrz,`@henrikingo`'
🤖 Prompt for AI Agents
In @.github/workflows/time.yml at line 50, The YAML entry for
alert-comment-cc-users is using invalid syntax ("'@ktrz','@henrikingo'"); update
the alert-comment-cc-users value to a proper YAML sequence such as
alert-comment-cc-users: ['@ktrz', '@henrikingo'] or a block list (- '@ktrz' / -
'@henrikingo') so the workflow parser accepts it; edit the
alert-comment-cc-users line in the time.yml workflow to use one of these valid
list formats.

default: 'Benchmark'
tool:
description: 'Tool to use get benchmark output. One of "cargo", "go", "benchmarkjs", "pytest", "googlecpp", "catch2", "julia", "benchmarkdotnet", "customBiggerIsBetter", "customSmallerIsBetter"'
description: 'Tool to use get benchmark output. One of "cargo", "go", "benchmarkjs", "pytest", "googlecpp", "catch2", "julia", "benchmarkdotnet", "time", "customBiggerIsBetter", "customSmallerIsBetter"'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Tool description is incomplete.

The description is missing "jmh" and "benchmarkluau" from the list of valid tools. While this appears to be a pre-existing issue, it would be good to fix it for completeness since you're already updating this line.

📝 Proposed fix
-    description: 'Tool to use get benchmark output. One of "cargo", "go", "benchmarkjs", "pytest", "googlecpp", "catch2", "julia", "benchmarkdotnet", "time", "customBiggerIsBetter", "customSmallerIsBetter"'
+    description: 'Tool to use get benchmark output. One of "cargo", "go", "benchmarkjs", "pytest", "googlecpp", "catch2", "julia", "jmh", "benchmarkdotnet", "benchmarkluau", "time", "customBiggerIsBetter", "customSmallerIsBetter"'
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
description: 'Tool to use get benchmark output. One of "cargo", "go", "benchmarkjs", "pytest", "googlecpp", "catch2", "julia", "benchmarkdotnet", "time", "customBiggerIsBetter", "customSmallerIsBetter"'
description: 'Tool to use get benchmark output. One of "cargo", "go", "benchmarkjs", "pytest", "googlecpp", "catch2", "julia", "jmh", "benchmarkdotnet", "benchmarkluau", "time", "customBiggerIsBetter", "customSmallerIsBetter"'
🤖 Prompt for AI Agents
In `@action.yml` at line 14, Update the description string for the action (the
description key in action.yml) to include the missing valid tool names "jmh" and
"benchmarkluau" so the full list of allowed tools reflects all supported
options; simply add "jmh" and "benchmarkluau" into the quoted comma-separated
list in the existing description value.


## Process benchmark results

Store the benchmark results with step using the action. Please set `cargo` to `tool` input.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Incorrect tool reference - says cargo instead of time.

The text incorrectly instructs users to set cargo as the tool input.

📝 Proposed fix
-Store the benchmark results with step using the action. Please set `cargo` to `tool` input.
+Store the benchmark results with step using the action. Please set `time` to `tool` input.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Store the benchmark results with step using the action. Please set `cargo` to `tool` input.
Store the benchmark results with step using the action. Please set `time` to `tool` input.
🤖 Prompt for AI Agents
In `@examples/time/README.md` at line 29, The README line "Store the benchmark
results with step using the action. Please set `cargo` to `tool` input."
incorrectly references `cargo`; update the documentation to instruct users to
set the action's tool input to `time` (i.e., replace `cargo` with `time`) so the
example and explanation use the correct tool name mentioned in the README
phrase.

| .Net | [![C# Benchmark.Net Example Workflow][benchmarkdotnet-badge]][benchmarkdotnet-workflow-example] | [examples/benchmarkdotnet](./examples/benchmarkdotnet) |
| Java | [![Java Example Workflow][java-badge]][java-workflow-example] | [examples/java](./examples/java) |
| Luau | Coming soon | Coming soon |
| Time (CLI utility) | [`time`][time-workflow-example]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Malformed table row - missing column and trailing pipe.

The table row for "Time (CLI utility)" is missing the third column (Example Project) and the trailing pipe character, which breaks the table structure.

📝 Proposed fix
-| Time (CLI utility) | [`time`][time-workflow-example]
+| Time (CLI utility) | [`time`][time-workflow-example] | [examples/time](./examples/time) |
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
| Time (CLI utility) | [`time`][time-workflow-example]
| Time (CLI utility) | [`time`][time-workflow-example] | [examples/time](./examples/time) |
🧰 Tools
🪛 markdownlint-cli2 (0.20.0)

[warning] 55-55: Table pipe style
Expected: leading_and_trailing; Actual: leading_only; Missing trailing pipe

(MD055, table-pipe-style)


[warning] 55-55: Table column count
Expected: 3; Actual: 2; Too few cells, row will be missing data

(MD056, table-column-count)


[warning] 55-55: Table column style
Table pipe does not align with header for style "aligned"

(MD060, table-column-style)

🤖 Prompt for AI Agents
In `@README.md` at line 55, The table row for "Time (CLI utility)" is malformed —
add the missing third column (Example Project) and the trailing pipe to restore
table alignment; update the row containing "Time (CLI utility)" and the link
[`time`][time-workflow-example] so it has a third column (can be an example
project name or an empty cell) and ends with a final pipe.

Comment on lines +696 to +705
function parseTimeOutput(line: string): number | undefined {
core.debug(`parse time ${line}`);
const t = line.split('\t')[1];
if (t === undefined) return;
const tparts = t.split('m');

core.debug(tparts[0]);
if (tparts[1] === undefined || !tparts[1].endsWith('s')) return;
return parseFloat(tparts[0]) * 60.0 + parseFloat(tparts[1].substring(-1));
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Critical bug: substring(-1) does not remove the trailing 's'.

String.prototype.substring() treats negative arguments as 0, so tparts[1].substring(-1) returns the entire string including the trailing 's'. This causes parseFloat to fail silently and return NaN for the seconds portion, resulting in incorrect benchmark values.

Use slice(0, -1) instead to correctly remove the trailing character.

🐛 Proposed fix
 function parseTimeOutput(line: string): number | undefined {
     core.debug(`parse time ${line}`);
     const t = line.split('\t')[1];
     if (t === undefined) return;
     const tparts = t.split('m');
 
     core.debug(tparts[0]);
     if (tparts[1] === undefined || !tparts[1].endsWith('s')) return;
-    return parseFloat(tparts[0]) * 60.0 + parseFloat(tparts[1].substring(-1));
+    return parseFloat(tparts[0]) * 60.0 + parseFloat(tparts[1].slice(0, -1));
 }
🤖 Prompt for AI Agents
In `@src/extract.ts` around lines 696 - 705, The parseTimeOutput function is
incorrectly using tparts[1].substring(-1) which returns the whole string
(including the trailing 's') and causes parseFloat to yield NaN; update
parseTimeOutput to remove the trailing 's' using tparts[1].slice(0, -1) before
calling parseFloat (and ensure you still guard for undefined t and tparts[1] as
currently done).

Comment on lines +728 to +781
function extractTimeBenchmarkResult(output: string): BenchmarkResult[] {
const lines = output.split(/\n/);
const results: BenchmarkResult[] = [];
let firstline = true;
let name: string | undefined = undefined;

for (const line of lines) {
core.debug(line);
if (firstline) {
name = line;
firstline = false;
core.debug(`firstline: ${name}`);
continue;
}
if (line.startsWith('real')) {
const v = parseTimeOutput(line);
core.debug(`v: ${v}`);
if (v !== undefined)
results.push({
extra: name,
name: 'real',
value: v,
unit: 's',
});
}
if (line.startsWith('user')) {
const v = parseTimeOutput(line);

core.debug(`v: ${v}`);
if (v !== undefined)
results.push({
extra: name,
name: 'user',
value: v,
unit: 's',
});
}
if (line.startsWith('sys')) {
const v = parseTimeOutput(line);
core.debug(`v: ${v}`);
if (v !== undefined)
results.push({
extra: name,
name: 'sys',
value: v,
unit: 's',
});
firstline = true;
}
core.debug('loop');
}

return results;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Consider handling locale-specific decimal separators.

The example in the comment block (lines 711-713) shows time output with commas as decimal separators (0m0,100s), which is common in European locales. However, parseFloat only recognizes . as a decimal separator. If the time command outputs locale-specific formatting, the parsing will fail.

🔧 Proposed fix to handle both comma and period decimals
 function parseTimeOutput(line: string): number | undefined {
     core.debug(`parse time ${line}`);
     const t = line.split('\t')[1];
     if (t === undefined) return;
     const tparts = t.split('m');

     core.debug(tparts[0]);
     if (tparts[1] === undefined || !tparts[1].endsWith('s')) return;
-    return parseFloat(tparts[0]) * 60.0 + parseFloat(tparts[1].slice(0, -1));
+    // Handle both '.' and ',' as decimal separators for locale compatibility
+    const minutes = parseFloat(tparts[0].replace(',', '.'));
+    const seconds = parseFloat(tparts[1].slice(0, -1).replace(',', '.'));
+    return minutes * 60.0 + seconds;
 }
🤖 Prompt for AI Agents
In `@src/extract.ts` around lines 728 - 781, The parsing of time outputs in
extractTimeBenchmarkResult (which calls parseTimeOutput) fails for locales using
commas as decimal separators (e.g., "0m0,100s"); update parseTimeOutput to
normalize locale decimals by replacing a single comma in the fractional part
with a dot (and strip any thousands separators) before calling parseFloat,
ensuring lines like "0m0,100s" and "0m0.100s" both parse correctly; adjust
parseTimeOutput (referenced by extractTimeBenchmarkResult) to perform this
normalization and add tests for comma and dot decimals.

Comment on lines +746 to +751
results.push({
extra: name,
name: 'real',
value: v,
unit: 's',
});
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

All three benchmark entries will have the same name value.

The current implementation assigns 'real', 'user', and 'sys' as the name field for all benchmarks. If tracking multiple different commands, they will all have the same names, making it difficult to distinguish them in the results. Consider incorporating the command name (from extra) into the benchmark name.

♻️ Proposed improvement to include command context in name
         if (line.startsWith('real')) {
             const v = parseTimeOutput(line);
             core.debug(`v: ${v}`);
             if (v !== undefined)
                 results.push({
                     extra: name,
-                    name: 'real',
+                    name: name ? `${name} - real` : 'real',
                     value: v,
                     unit: 's',
                 });
         }

Apply similar changes for 'user' and 'sys' entries.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
results.push({
extra: name,
name: 'real',
value: v,
unit: 's',
});
results.push({
extra: name,
name: name ? `${name} - real` : 'real',
value: v,
unit: 's',
});
🤖 Prompt for AI Agents
In `@src/extract.ts` around lines 746 - 751, The three benchmark results all use
the literal name values ('real', 'user', 'sys'), losing per-command context;
update the results.push calls (the objects constructed in the results.push in
this snippet) to include the command identifier from the existing extra/name
variable in the benchmark name (e.g. combine the command name variable "name"
with the metric label so the name field becomes commandName + '-real' (and
similarly '-user' and '-sys')), and ensure you make the same change for the
other two pushes that produce 'user' and 'sys' entries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants