Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[backport] Collect statistics without printing them #10798

Merged
merged 1 commit into from
Jul 15, 2024

Conversation

szeiger
Copy link
Contributor

@szeiger szeiger commented Jun 26, 2024

Backport of #10795:

This change adds a new flag -Ycollect-statistics that enables the same statistics gathering as -Ystatistics but without dumping all the statistics to the console. This is useful for build tools that want to collect statistics via a compiler plugin without interfering with the console output or the operation of -Ystatistics (if specified explicitly by the user).

Note that there is an internal YstatisticsEnabled setting that may appear to do this already, but in fact it controls both collecting and printing together. Even if you switched it on internally (without enabling any phase statistics via -Ystatistics / -Yhot-statistics) you would still get at least the phase timings summary.

@scala-jenkins scala-jenkins added this to the 2.12.20 milestone Jun 26, 2024
Copy link
Member

@lrytz lrytz left a comment

Choose a reason for hiding this comment

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

would that also work?

src/compiler/scala/tools/nsc/settings/ScalaSettings.scala Outdated Show resolved Hide resolved
src/compiler/scala/tools/nsc/settings/ScalaSettings.scala Outdated Show resolved Hide resolved
@szeiger
Copy link
Contributor Author

szeiger commented Jul 2, 2024

Yes, that should work. I'll run some tests with it to make sure.

Backport of scala#10795:

This change adds a new flag `-Ycollect-statistics` that enables the same statistics gathering as `-Ystatistics` but without dumping all the statistics to the console. This is useful for build tools that want to collect statistics via a compiler plugin without interfering with the console output or the operation of `-Ystatistics` (if specified explicitly by the user).

Note that there is an internal `YstatisticsEnabled` setting that may appear to do this already, but in fact it controls both collecting and printing together. Even if you switched it on internally (without enabling any phase statistics via `-Ystatistics` / `-Yhot-statistics`) you would still get at least the phase timings summary.
@szeiger szeiger force-pushed the wip/collect-statistics-2.12 branch from 8a1b5d9 to 9944eb8 Compare July 11, 2024 15:14
@szeiger szeiger changed the title Collect statistics without printing them [backport] Collect statistics without printing them Jul 11, 2024
@szeiger
Copy link
Contributor Author

szeiger commented Jul 11, 2024

I confirmed that the suggested changes are working fine. PR updated.

@lrytz lrytz merged commit a77e7b7 into scala:2.12.x Jul 15, 2024
3 checks passed
@SethTisue SethTisue added the release-notes worth highlighting in next release notes label Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-notes worth highlighting in next release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants