hyper0x / go_command_tutorial Goto Github PK
View Code? Open in Web Editor NEWGolang command tutorial in Chinese.
Home Page: https://hyper0x.github.io/go_command_tutorial
License: GNU General Public License v3.0
Golang command tutorial in Chinese.
Home Page: https://hyper0x.github.io/go_command_tutorial
License: GNU General Public License v3.0
0.1.md
“插播:Go语言的源码文件有三大类,即:命令源码文件、库源码文件和测试源码文件。他们的功用各不相同”
这里的作用写成了功用
我使用的命令:
go tool pprof -inuse_space http://127.0.0.1:20191/debug/pprof/heap?seconds=10
遇到的问题:
inuse_space 怎么都是负数?该怎么理解?
如果以上图片无法查看,请直接单击图片地址查看:
http://139.196.101.31:2080/images/question1.png
http://139.196.101.31:2080/images/question2.png
相对于我平时的工作生活,很羡慕你可以有时间写自己喜欢的书。
在运行着图形界面软件的Linux操作系统下,会弹出这样一个窗口。如图5-3。
pprof工具的gv命令的执行结果
从命令输出的提示信息可以看出,实际上callgrind命令把统计文件保存到了Linux的临时文件夹/tmp中。然后使用kcachegrind工具进行查看。下图为在pprof工具交互模式下执行callgrind命令后弹出的kcachegrind工具界面。
使用kcachegrind工具查看概要数据
图0-4 使用kcachegrind工具查看概要数据
The book is great and it would be better to make it a gitbook. Right?
丢了赶紧找. 兴许还找的回来, 实在不行就打 110.
:)
在0.1.md go build教程中的 -compiler 介绍中,写的是 “其中,gc编译器即为Go语言自带的编辑器,而gccgo编译器则为GCC提供的Go语言编译器。”
gc编译器即为Go语言自带的编译器吧
您好,为啥我在main函数里添加了如下代码后,用go tool pprof工具输出的结果是空啊?生成的prof文件只有64B...
func main(){
flag.Parse()
if _cpuprofile != "" {
// 根据命令行指定文件名创建 profile 文件
f, err := os.Create(_cpuprofile)
if err != nil {
log.Fatal(err)
}
// 开启 CPU profiling
pprof.StartCPUProfile(f)
defer pprof.StopCPUProfile()
}
.
.
.
}
输出结果如下
go tool pprof metrics_prof mytest.prof
Entering interactive mode (type "help" for commands)
(pprof) list
Total: 0
(pprof) top
0 of 0 total ( 0%)
flat flat% sum% cum cum%
(pprof) q
Firstly,i was run in go1.71
code list:
`func GetSrcDirs(fresh bool) []string {
if len(srcDirsCache) > 0 && !fresh {
return srcDirsCache
}
gorootSrcDir := filepath.Join(GetGoroot(), "src", "pkg")
gopaths := GetAllGopath()
gopathSrcDirs := make([]string, len(gopaths))
for i, v := range gopaths {
gopathSrcDirs[i] = filepath.Join(v, "src")
}
srcDirs := make([]string, 0)
srcDirs = append(srcDirs, gorootSrcDir)
srcDirs = append(srcDirs, gopathSrcDirs...)
srcDirsCache = make([]string, len(srcDirs))
copy(srcDirsCache, srcDirs)
return srcDirs
}`
this function which path is "goc2p/src/pkg/tool" in goc2p project.and the gorootSrcDir := filepath.Join(GetRoot(), "src", "pkg") has a little problem,I think it may be gorootSrcDir := filepath.Join(GetRoot(), "src")
这样在阅读时候就能一目了然啦
比如,go build 那块,-a 参数,我在mac下,从 go1.1 到 1.4,执行结果跟你说的完全不一样。
而且,你对 -a 的解释:强行对所有涉及到的代码包(包括标准库中的代码包)进行重新构建,即使它们已经是最新的了。
我的理解,-a 只是说会重新编译你项目的文件,不会编译标准库的,要不然有点乱了,实际上,我试验了,也不会编译标准库
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.