Skip to content

Commit aea4229

Browse files
committed
gentypes: display emitted object count instead of dumping all entries
This made the build output relatively crowded. Only display a count from now on, as builds are easy to troubleshoot and reproduce locally. Signed-off-by: Timo Beckers <[email protected]>
1 parent bf609aa commit aea4229

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

internal/cmd/gentypes/main.go

+15-7
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ func run(args []string) error {
3737
return fmt.Errorf("expect location of compressed vmlinux .BTF as argument")
3838
}
3939

40+
fmt.Println("Running gentypes..")
41+
4042
raw, err := internal.ReadAllCompressed(args[0])
4143
if err != nil {
4244
return err
@@ -127,12 +129,14 @@ import (
127129
return consts[i].Name < consts[j].Name
128130
})
129131

132+
var nconsts uint32
130133
w.WriteString("const (\n")
131134
for _, c := range consts {
132-
fmt.Println("const", c.Name)
133135
fmt.Fprintf(w, "\t%s = %v\n", c.Name, c.Value)
136+
nconsts++
134137
}
135138
w.WriteString(")\n")
139+
fmt.Printf("Generated %d constants\n", nconsts)
136140

137141
// Typed constants (aka named enums)
138142
enums := []struct {
@@ -161,10 +165,9 @@ import (
161165
return enums[i].goType < enums[j].goType
162166
})
163167

168+
var nenums uint32
164169
enumTypes := make(map[string]btf.Type)
165170
for _, o := range enums {
166-
fmt.Println("enum", o.goType)
167-
168171
var t *btf.Enum
169172
if err := spec.TypeByName(o.cType, &t); err != nil {
170173
return nil, err
@@ -185,7 +188,10 @@ import (
185188

186189
w.WriteString(decl)
187190
w.WriteRune('\n')
191+
192+
nenums++
188193
}
194+
fmt.Printf("Generated %d enums\n", nenums)
189195

190196
// Assorted structs
191197

@@ -249,9 +255,8 @@ import (
249255
return structs[i].goType < structs[j].goType
250256
})
251257

258+
var nstructs uint32
252259
for _, s := range structs {
253-
fmt.Println("struct", s.goType)
254-
255260
var t *btf.Struct
256261
if err := spec.TypeByName(s.cType, &t); err != nil {
257262
return nil, err
@@ -260,7 +265,9 @@ import (
260265
if err := outputPatchedStruct(gf, w, s.goType, t, s.patches); err != nil {
261266
return nil, fmt.Errorf("output %q: %w", s.goType, err)
262267
}
268+
nstructs++
263269
}
270+
fmt.Printf("Generated %d structs\n", nstructs)
264271

265272
// Attrs
266273

@@ -592,9 +599,8 @@ import (
592599
return nil, fmt.Errorf("split bpf_attr: %w", err)
593600
}
594601

602+
var nattrs uint32
595603
for _, s := range attrs {
596-
fmt.Println("attr", s.goType)
597-
598604
t := attrTypes[s.cType]
599605
if t == nil {
600606
return nil, fmt.Errorf("unknown attr %q", s.cType)
@@ -611,7 +617,9 @@ import (
611617
case retFd:
612618
fmt.Fprintf(w, "func %s(attr *%s) (*FD, error) { fd, err := BPF(%s, unsafe.Pointer(attr), unsafe.Sizeof(*attr)); if err != nil { return nil, err }; return NewFD(int(fd)) }\n\n", s.goType, goAttrType, s.cmd)
613619
}
620+
nattrs++
614621
}
622+
fmt.Printf("Generated %d attrs\n", nattrs)
615623

616624
// Link info type specific
617625
linkInfoExtraTypes := []struct {

0 commit comments

Comments
 (0)