快速简单的性能分析器库。
硝基是一个快速简单的性能分析器库。它有助于将应收帐款与不同的功能草案或不同的功能进行比较。
使用硝基很简单。首先使用go get安装库的最新版本。
$ go get github.com/spf13/nitro
下一步在你的申请中加入硝基。
import "github.com/spf13/nitro"
在接近应用程序开始的地方(或者您想开始分析的地方)调用
timer := nitro.Initalize()
然后在整个应用程序中,无论在哪里调用一个主要的工作分工
timer.Step("name of step")
硝基自动添加一个标志到你的应用程序。如果您还没有在应用程序中使用标志,下面的代码是一个如何使用标志的例子。确保导入“标志”。
func main() { flag.Parse() }
一旦在整个应用程序中实现了库,只需运行您的应用程序并将“-stepAnalysis”标志传递给它。它不需要构建来运行,但是可以从go run或二进制形式调用。
$ go run ./my_application -stepAnalysis
以下输出来自hugo静态站点生成器库。硝基是雨果的一个组成部分,并被提取到自己的图书馆。
$ ./main -p spf13 -b http://localhost -d -stepAnalysis initialize & template prep: 4.664481ms (5.887625ms) 0.43 MB 4583 Allocs import pages: 65.196788ms (71.107809ms) 17.13 MB 70151 Allocs build indexes: 1.823434ms (72.960713ms) 0.12 MB 3720 Allocs render and write indexes: 212.06721ms (285.057592ms) 65.72 MB 362557 Allocs render and write lists: 17.796945ms (302.87847ms) 7.76 MB 33122 Allocs render pages: 50.092756ms (352.998539ms) 11.27 MB 139898 Allocs render shortcodes: 11.34692ms (364.386939ms) 6.24 MB 21260 Allocs render and write homepage: 4.075194ms (368.497883ms) 0.84 MB 3906 Allocs write pages: 8.73933ms (377.263888ms) 0.11 MB 1672 Allocs
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)没有特定顺序的名称:
硝基是在Apache 2.0许可下发布的。看见LICENSE.txt