Skip to content

Report the complexity aggregates in the family's time unit - #2294

Open
lenamonj wants to merge 3 commits into
google:mainfrom
lenamonj:complexity-time-unit
Open

Report the complexity aggregates in the family's time unit#2294
lenamonj wants to merge 3 commits into
google:mainfrom
lenamonj:complexity-time-unit

Conversation

@lenamonj

@lenamonj lenamonj commented Sep 7, 2026

Copy link
Copy Markdown

ComputeBigO never set big_o.time_unit, so the BigO row kept the Run() default of nanoseconds and its coefficient was rendered in ns whatever unit the family declared. It now carries the family's unit, as the RMS row already did.

The new BM_Complexity_O_N_ms family declares milliseconds: on main its BigO row reports "time_unit": "ns". The test fails on main and passes here.

ComputeBigO left big_o.time_unit at the Run() default, so the BigO row was rendered in nanoseconds whatever unit the family declared; CSVReporter rendered the RMS row from the raw, pre-divided field, so it was smaller by the unit multiplier. Both now go through the family unit and the GetAdjusted*Time() accessors, with a millisecond family in complexity_test.cc that fails on main for both.
Comment thread src/complexity.cc Outdated
big_o.cpu_accumulated_time = result_cpu.coef;
big_o.report_big_o = true;
big_o.complexity = result_cpu.complexity;
// The coefficient is a time; reporters render it in the family's unit.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

unnecessary comment

Comment thread test/complexity_test.cc Outdated
const std::string& rms_test_name,
const std::string& big_o, int family_index) {
const std::string& big_o, int family_index,
const std::string& time_unit = "ns",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why are there defaults here?

@lenamonj

lenamonj commented Sep 7, 2026

Copy link
Copy Markdown
Author

Removed the comment and the defaults; each family passes its unit and CSV pattern explicitly.

@LebedevRI LebedevRI left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

CSV reporter is deprecated and should not be used.

The CSV reporter is deprecated, so its RMS row is left as it is and the
test keeps the pattern it had.
@lenamonj

lenamonj commented Sep 7, 2026

Copy link
Copy Markdown
Author

Dropped the CSV reporter change and its test pattern; the PR is now the one-line time_unit fix with the JSON check.

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.

3 participants