mirror of
https://github.com/daeuniverse/dae.git
synced 2024-12-22 14:54:40 +07:00
optimize: reduce memory usage by reading kallsyms only in the trace command (#700)
This commit is contained in:
parent
d3ab0b25e7
commit
53b5fedbc3
@ -31,6 +31,9 @@ func init() {
|
||||
traceCmd := &cobra.Command{
|
||||
Use: "trace",
|
||||
Short: "To trace traffic",
|
||||
PreRun: func(cmd *cobra.Command, args []string) {
|
||||
trace.ReadKallsyms()
|
||||
},
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
internal.AutoSu()
|
||||
|
||||
|
@ -26,11 +26,7 @@ var kallsyms []Symbol
|
||||
var kallsymsByName map[string]Symbol = make(map[string]Symbol)
|
||||
var kallsymsByAddr map[uint64]Symbol = make(map[uint64]Symbol)
|
||||
|
||||
func init() {
|
||||
readKallsyms()
|
||||
}
|
||||
|
||||
func readKallsyms() {
|
||||
func ReadKallsyms() {
|
||||
file, err := os.Open("/proc/kallsyms")
|
||||
if err != nil {
|
||||
logrus.Fatalf("failed to open /proc/kallsyms: %v", err)
|
||||
|
Loading…
Reference in New Issue
Block a user