mirror of https://github.com/ceph/go-ceph
implements: ignore some C package calls that are just noise
Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
parent
18a134b535
commit
2ebd4bc1d5
|
@ -12,6 +12,26 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// ignoreCCalls is a map of calls from "C" that we know we can just ignore.
|
||||||
|
// ignoring this stuff makes the number of tracked entries smaller, fewer logs,
|
||||||
|
// and less stuff to iterate over in other code.
|
||||||
|
var ignoreCCalls = map[string]bool{
|
||||||
|
// some special cgo calls
|
||||||
|
"CString": true,
|
||||||
|
"CBytes": true,
|
||||||
|
"GoString": true,
|
||||||
|
"GoBytes": true,
|
||||||
|
// common utility functions
|
||||||
|
"free": true,
|
||||||
|
// common types
|
||||||
|
"int": true,
|
||||||
|
"int64_t": true,
|
||||||
|
"uint64_t": true,
|
||||||
|
"size_t": true,
|
||||||
|
"ssize_t": true,
|
||||||
|
"uintptr_t": true,
|
||||||
|
}
|
||||||
|
|
||||||
type goFunction struct {
|
type goFunction struct {
|
||||||
shortName string
|
shortName string
|
||||||
fullName string
|
fullName string
|
||||||
|
@ -89,7 +109,11 @@ func (v *visitor) checkCalled(s *ast.SelectorExpr) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if "C" == ident.String() {
|
if "C" == ident.String() {
|
||||||
v.callMap[s.Sel.String()] = v.currentFunc
|
cname := s.Sel.String()
|
||||||
|
if ignoreCCalls[cname] {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
v.callMap[cname] = v.currentFunc
|
||||||
logger.Printf("updated %s in call map\n", s.Sel.String())
|
logger.Printf("updated %s in call map\n", s.Sel.String())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue