diff --git a/.gitignore b/.gitignore index 4592fa6..9e6bbd0 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ php-parser cpu.pprof mem.pprof +trace.out \ No newline at end of file diff --git a/README.md b/README.md index c347b95..dbcfff4 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ php-parser [flags] ... | -d |string| dump format: [custom, go, json, pretty-json] | | -p | bool | show positions | | -r | bool | resolve names | -| -prof |string| start profiler: [cpu, mem] | +| -prof |string| start profiler: [cpu, mem, trace] | | -meta | bool | show meta info | | -php5 | bool | parse as PHP5 | diff --git a/main.go b/main.go index 2c46f11..25b8977 100644 --- a/main.go +++ b/main.go @@ -29,7 +29,7 @@ func main() { withMeta = flag.Bool("meta", false, "show meta") showResolvedNs = flag.Bool("r", false, "resolve names") flag.StringVar(&dumpType, "d", "", "dump format: [custom, go, json, pretty_json]") - flag.StringVar(&profiler, "prof", "", "start profiler: [cpu, mem]") + flag.StringVar(&profiler, "prof", "", "start profiler: [cpu, mem, trace]") flag.Parse() @@ -38,6 +38,8 @@ func main() { defer profile.Start(profile.ProfilePath("."), profile.NoShutdownHook).Stop() case "mem": defer profile.Start(profile.MemProfile, profile.ProfilePath("."), profile.NoShutdownHook).Stop() + case "trace": + defer profile.Start(profile.TraceProfile, profile.ProfilePath("."), profile.NoShutdownHook).Stop() } pathCh := make(chan string)