From 112ef18501494b9d2498b479db5e2e045353d2ab Mon Sep 17 00:00:00 2001 From: z7zmey Date: Tue, 5 Jun 2018 00:09:21 +0300 Subject: [PATCH] added profiling commands to Makefile --- .gitignore | 7 ++++++- Makefile | 12 ++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) 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