diff --git a/.gitignore b/.gitignore index d3d3d6e..66451b4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,8 @@ .vscode php-parser -*example.php \ No newline at end of file +*example.php + +cpu.prof +mem.prof +php7.test +php5.test diff --git a/Makefile b/Makefile index 61bc49b..5556ac0 100644 --- a/Makefile +++ b/Makefile @@ -32,3 +32,15 @@ compile: ./php5/php5.go ./php7/php7.go ./scanner/scanner.go ./php7/php7.go: ./php7/php7.y goyacc -o $@ $< + +profile5: + GOGC=off go test -cpuprofile cpu.prof -memprofile mem.prof -bench=. -benchmem -benchtime=20s ./php5 + +profile7: + GOGC=off go test -cpuprofile cpu.prof -memprofile mem.prof -bench=. -benchmem -benchtime=20s ./php7 + +cpu_pprof: + go tool pprof cpu.prof + +mem_pprof: + go tool pprof mem.prof