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

cmd/internal/obj: delete Cputime and all its uses #19865

Closed
josharian opened this issue Apr 6, 2017 · 14 comments
Closed

cmd/internal/obj: delete Cputime and all its uses #19865

josharian opened this issue Apr 6, 2017 · 14 comments
Labels
FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@josharian
Copy link
Contributor

obj.Cputime is used to print elapsed time in various places in the assemblers. It is protected by ctxt.Debugvlog. However, toolstash -cmp sets Debugvlog to true, causing rare spurious timing-based failures. They are rare because the elapsed time is basically always ~0. We could introduce a special flag to turn on/off this timing printing, but I'd rather just wipe it all out. We have good profiling and benchmarking tools; we should use them instead, if/when the assemblers ever become an actual performance bottleneck.

Objections? Not sure who quite who to cc here for input, but maybe: @minux @cherrymui @randall77

@cherrymui
Copy link
Member

IIRC obj.Cputime is also used in the linker when -v is set.
Just curious, why toolstash -cmp needs to set Debugvlog?

@josharian
Copy link
Contributor Author

Just curious, why toolstash -cmp needs to set Debugvlog?

Debugvlog is pretty heavily overloaded. toolstash -cmp uses it to ask the compiler to emit much more detailed versions of the generated assembly, to better confirm that it is identical.

Why does the linker need obj.Cputime? Any reason we couldn't use pprof instead?

@cherrymui
Copy link
Member

Why does the linker need obj.Cputime? Any reason we couldn't use pprof instead?

I believe it is just historical reason.

@cherrymui
Copy link
Member

At long time, we probably should get rid of obj.Cputime and use pprof.
As a workaround, could toolstash -cmp filter out Cputime outputs?

@josharian
Copy link
Contributor Author

I guess the question is: Why not now?

@josharian
Copy link
Contributor Author

Slight misdiagnosis: It's not that variance in the timing causes toolstash -cmp failures. Rather, when toolstash -cmp fails, it causes the output to be about timing rather than about something useful.

I'll send a note to golang-dev to see whether anyone is actively using this.

@mdempsky
Copy link
Member

mdempsky commented Apr 7, 2017

Yeah, those timing lines are obnoxious when diffing toolstash log files. I for one wouldn't miss them.

@cherrymui
Copy link
Member

I guess the question is: Why not now?

No problem with me, if you want to take it :)

@josharian
Copy link
Contributor Author

CL 39914 deletes all the assembler usages, which are the ones currently driving me crazy. If no one speaks up on behalf of the linker usages in the next few days, I'll do them too.

@gopherbot
Copy link

CL https://golang.org/cl/39914 mentions this issue.

gopherbot pushed a commit that referenced this issue Apr 7, 2017
Updates #19865

Change-Id: I24fbf5d79b5e4cac09c14cfff678a8215397b670
Reviewed-on: https://go-review.googlesource.com/39914
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
@josharian josharian added this to the Unplanned milestone Apr 10, 2017
lparth pushed a commit to lparth/go that referenced this issue Apr 13, 2017
Updates golang#19865

Change-Id: I24fbf5d79b5e4cac09c14cfff678a8215397b670
Reviewed-on: https://go-review.googlesource.com/39914
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
@ALTree ALTree added NeedsFix The path to resolution is known, but the work has not been done. help wanted labels Sep 22, 2018
@gopherbot
Copy link

Change https://golang.org/cl/171730 mentions this issue: cmd/link/internal: Eliminate all ld.Cputime() usages

@thanm
Copy link
Contributor

thanm commented Oct 20, 2019

@josharian are you still interested in this CL? I can take a closer look and +2 if so.

@josharian
Copy link
Contributor Author

Yes please.

@thanm
Copy link
Contributor

thanm commented Oct 20, 2019

Ok, SGTM. I am in transit at the moment, will take a closer look tomorrow.

@golang golang locked and limited conversation to collaborators Oct 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

6 participants