Skip to content

Fix #24 per thread throughput - #31

Open
ashish (ashyx12) wants to merge 3 commits into
microsoft:mainfrom
ashyx12:fix/per-thread-throughput
Open

Fix #24 per thread throughput#31
ashish (ashyx12) wants to merge 3 commits into
microsoft:mainfrom
ashyx12:fix/per-thread-throughput

Conversation

@ashyx12

@ashyx12 ashish (ashyx12) commented Aug 14, 2026

Copy link
Copy Markdown

Summary

Fixes per-thread throughput is always 0.00 with ntttcp version 5.40.

In v5.40, worker start/end timing was tied to tcp_row, which is only
initialized when TCP EStats are enabled. As a result, normal runs without
-es left worker_time as zero, causing per-thread Time(s) and
Throughput(KB/s) to print as 0.000 even though total throughput was
reported correctly.

This change records worker timing independently from EStats collection while
keeping EStats calls guarded by tcp_row.

Fixes #24 .

Validation

  • Built locally in Visual Studio using the ntttcp.sln file.
  • Manually ran the reported sender/receiver command pattern.
  • Reproduced the issue without -es: per-thread Time(s) and
    Throughput(KB/s) were 0.000 while total throughput was nonzero.
  • Confirmed the suspected cause by running with -es: per-thread timing was
    recorded because tcp_row was initialized.
  • Confirmed the fix by running without -es: per-thread Time(s) and
    Throughput(KB/s) are now nonzero.
  • Confirmed the -es path still reports nonzero per-thread Time(s) and
    Throughput(KB/s) after the fix.

Screenshots

Before: without -es

Per-thread Time(s) and Throughput(KB/s) were reported as 0.000, while
total throughput was still nonzero.

recv_without_es sender_without_es

Confirmation: with -es

Running the same command pattern with -es recorded nonzero per-thread time,
confirming that timing was incorrectly coupled to tcp_row.

recv_with_es sender_with_es

After fix: without -es

After the fix, the same command pattern works without -es: per-thread
Time(s) and Throughput(KB/s) are nonzero.

recv_after_fix sender_after_fix

After fix: with -es

The -es path still records nonzero per-thread Time(s) and
Throughput(KB/s) after the timing change.

recv_after_fix_with_es sender_after_fix_with_es

Follow-up for a0a7d6e

This addresses the Copilot code review:

  • Added a guard requiring both begin and end EStats snapshots to be valid
    before marking EStats as available.
  • Validated the EStats initialization failure path with -es using XML output:
    before the fix, zero-initialized EStats were emitted; after the fix,
    per-thread Time(s) and Throughput(KB/s) remain nonzero and EStats are
    not emitted.
  • Confirmed normal -es runs after the fix still emit valid EStats data.
  • EStats are marked available only when both the begin and end EStats snapshots were successfully collected; worker timing is independent of EStats collection.

@ashyx12

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Decouples worker timing from optional TCP EStats collection to restore per-thread throughput reporting.

Changes:

  • Records synchronous and asynchronous worker timing without -es.
  • Keeps EStats snapshots conditional on tcp_row.
  • Marks GetEstats input as optional.
Suppressed comments (1)

src/ntttcp.c:3739

  • The asynchronous path has the same EStats failure regression: a null tcp_row no longer prevents time0_was_set, so the exit block marks zero-initialized EStats available whenever -es was requested. Preserve the independent worker timer, but gate estats_available on successful begin/end EStats collection rather than the option flag.
            time0_was_set = TRUE;

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/ntttcp.c
@ashyx12

Copy link
Copy Markdown
Author

Guillaume Hetier (@guhetier) i’ve addressed the copilot review in the latest commit, including the EStats failure-path issue, and validated the changes requesting a review when you get a chance.

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.

per-thread throughput is always 0.00 with ntttcp version 5.40.

2 participants