Skip to content

Report the CPU affinity mask size in the run context (#1812) - #2302

Open
renvins wants to merge 1 commit into
google:mainfrom
renvins:affinity-context
Open

renvins wants to merge 1 commit into
google:mainfrom
renvins:affinity-context

Conversation

@renvins

@renvins renvins commented Sep 21, 2026

Copy link
Copy Markdown

Run on (24 X 4700 MHz CPU s) reports the machine CPU's count, so a benchmark restricted with taskset -c 0 gives no indication that the restriction took effect.

So as discussed in the related issue, we decided to add a new field to CPUInfo, num_cpus_in_affinity_mask (0 when it cannot be determined, e.g. macOS), using the same path used in ThreadAffinityGuard.

Now the console reporter appends , N in affinity mask only when N < num_cpus, so the output is unchanged when a restriction is not applied. On the other hand, the JSON reporter emits the field as well, whenever it is known, next to num_cpus.

I ran all the tests and everything passes as expected.

Fixes #1812

@renvins

renvins commented Sep 21, 2026

Copy link
Copy Markdown
Author

@dmah42 tagging for visibility :)

This branch has not been deployed

No deployments
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.

[BUG] Core Affinity doesn't seem to work (Or Reporter wrong?)

1 participant