Skip to content

Commit 7fcf38d

Browse files
committed
cmd/link: add support for telemetry
Add counters for invocations and provided flag names. For #58894 Change-Id: Ibd4eeca905d277879b601d95bab524fbced6a98b Reviewed-on: https://go-review.googlesource.com/c/go/+/584276 Reviewed-by: Than McIntosh <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Cherry Mui <[email protected]>
1 parent 483a913 commit 7fcf38d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/cmd/link/internal/ld/main.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import (
3636
"cmd/internal/objabi"
3737
"cmd/internal/quoted"
3838
"cmd/internal/sys"
39+
"cmd/internal/telemetry"
3940
"cmd/link/internal/benchmark"
4041
"flag"
4142
"internal/buildcfg"
@@ -155,6 +156,8 @@ func (t *ternaryFlag) IsBoolFlag() bool { return true } // parse like a boolean
155156
func Main(arch *sys.Arch, theArch Arch) {
156157
log.SetPrefix("link: ")
157158
log.SetFlags(0)
159+
telemetry.Start()
160+
telemetry.Inc("link/invocations")
158161

159162
thearch = theArch
160163
ctxt := linknew(arch)
@@ -200,6 +203,7 @@ func Main(arch *sys.Arch, theArch Arch) {
200203
objabi.Flagfn1("importcfg", "read import configuration from `file`", ctxt.readImportCfg)
201204

202205
objabi.Flagparse(usage)
206+
telemetry.CountFlags("link/flag:", *flag.CommandLine)
203207

204208
if ctxt.Debugvlog > 0 {
205209
// dump symbol info on crash

0 commit comments

Comments
 (0)