此处将为大家介绍关于DebuggingperformanceissuesinGoprograms的详细内容,此外,我们还将为您介绍关于.netcoreDockerCompose启动问题:Debuggi
此处将为大家介绍关于Debugging performance issues in Go programs的详细内容,此外,我们还将为您介绍关于.net core Docker Compose启动问题: Debugging Error, The program to be debug con not be found in the conta、AN4771, Integrating FreeMASTER-Time Debugging Tool with CodeWarrior® for Microcon...、android performance debug、BI Publisher Performance Issue caused by ancestor-or-self tag的有用信息。
本文目录一览:- Debugging performance issues in Go programs
- .net core Docker Compose启动问题: Debugging Error, The program to be debug con not be found in the conta
- AN4771, Integrating FreeMASTER-Time Debugging Tool with CodeWarrior® for Microcon...
- android performance debug
- BI Publisher Performance Issue caused by ancestor-or-self tag
Debugging performance issues in Go programs
Let's assume you have a Go program and want to improve its performance. There are several tools available that can help with this task. These tools can help you to identify varIoUs types of hotspots (cpu,IO,memory),hotspots are the places that you need to concentrate on in order to significantly improve performance. However,another outcome is possible -- the tools can help you identify obvIoUs performance defects in the program. For example,you prepare an sql statement before each query while you Could prepare it once at program startup. Another example is if an O(N^2) algorithm somehow slipped into where an obvIoUs O(N) exists and is expected. In order to identify such cases you need to sanity check what you see in profiles. For example for the first case significant time spent in sql statement preparation would be the red flag.
It's also important to understand varIoUs bounding factors for performance. For example,if the program communicates via 100 Mbps network link and it is already utilizes >90Mbps,there is not much you can do with the program to improve its performance. There are similar bounding factors for disk IO,memory consumption and computational tasks.
With that in mind we can look at the available tools.
Note: The tools can interfere with each other. For example,precise memory profiling skews cpu profiles,goroutine blocking profiling affects scheduler trace,etc. Use tools in isolation to get more precise info.
Note: the formats described here are based on Go1.3 release.
cpu Profiler
Go runtime contains built-in cpu profiler,which shows what functions consume what percent of cpu time. There are 3 ways you can get access to it:
1. The simplest one is-cpuprofileflag of 'go test' command. For example,the following command:
$ go test -run=none -bench=ClientServerParallel4 -cpuprofile=cprof net/http
will profile the given benchmark and write cpu profile into 'cprof' file.
Then:
$ go tool pprof --text http.test cprof
will print a list of the hottest functions.
There are several output types available,the most useful ones are: --text,--web and --list. Run 'go tool pprof' to get the complete list.
The obvIoUs drawback of this option is that it works only for tests.
2.net/http/pprofpackage. This is the ideal solution for network servers. You merely need to import net/http/pprof,and collect profiles with:
$ go tool pprof --text mybinhttp://myserver:6060:/debug/pprof/profile
3. Manual profile collection. You need to importruntime/pprofand add the following code to main function:
1 |
if *flagcpuprofile != "" { |
2 |
f,err := os.Create(*flagcpuprofile) |
3 | err != nil { |
log
.Fatal(err)
5 | } |
7 | defer pprof.StopcpuProfile() |
}
The profile will be written to the specified file,visualize it the same way as in the first option.
Here is an example of a profile visualized with --web option:
You can investigate a single function with --list=funcname option. For example,the following profile shows that the time was spent in the append function:
03 | 5 5 95: *bp = append(*bp,byte(r)) |
05 | . . 97: } |
07 | . . 99: b := *bp |
09 | . . 101: for n+utf8.UTFMax > cap(b) { |
11 | . . 103: } |
13 | . . 105: *bp = b[:n+w] |
15 | . . 107: } |
.net core Docker Compose启动问题: Debugging Error, The program to be debug con not be found in the conta
背景
本地环境:VS2019 + Docker Compose启动并调试程序;
问题:F5启动的时候,时不时会出现如下报错,笔者尝试以下几种路径去寻找问题点;
1)网页浏览时有些api无法访问;
2)docker ps :该api的容器是正常启动的;
3)docker logs containerid : 该api的容器没有任何日志;
4)查看VS的build以及debug输出框里的日志也无任何迹象;
5)尝试修改docker-compose.yml的内容,时不时会出现该问题很不稳定;
6)百度该提示,没有任何匹配问题;
7)bing国际版能搜到该提示问题,stackoverflow和github上有一些提问,但是没人解答;
8)google该问题,在.net社区有人提了该问题,https://developercommunity.visualstudio.com/t/the-program-to-be-debug-con-not-be-found-in-the-co/1089201
问题跟我一致,.net core 3.1 + docker compose
原来是VS的bug,官方团队说在最新版的VS2019上有修复该问题了,回答时间是2020.11
然后检查本地的VS版本,16.5.1,发布时间是2020.5,那难怪会有bug了,更新最新版本的VS 16.9.4
原因与结果
最终查到是低版本的VS2019的bug导致了,更新最新版的VS2019即可!
更细的原因是找不到containerid命名的问题,在笔者的项目中有webapitest和webapitest2两个containerid相近,导致了VS找不到webapitest这个容器,不过这都是VS自己的bug,难道要用户去迁就它吗,所以还是最好更新最新版VS2019
AN4771, Integrating FreeMASTER-Time Debugging Tool with CodeWarrior® for Microcon...


AN4771: This application note describes the steps to integrate the project created in the CodeWarrior for Microcontrollers v10.x product with FreeMASTER-Time Debugging Tool v1.3 (formerly known as PC

android performance debug
1 检查kernel中的deconfig
将deconfig中以上这些文件去掉,这些主要用于debug和log,对系统性能有一定的影响。
CONfig_PREEMPT_COUNT=y
CONfig_PREEMPT_TRACER=y
CONfig_SCHED_DEBUG=y
CONfig_DEBUG_KMEMLEAK=y
CONfig_DEBUG_KMEMLEAK_EARLY_LOG_SIZE=400
CONfig_DEBUG_KMEMLEAK_DEFAULT_OFF=y
CONfig_DEBUG_SPINLOCK=y
CONfig_DEBUG_MUTEXES=y
CONfig_DEBUG_ATOMIC_SLEEP=y
CONfig_DEBUG_STACK_USAGE=y
CONfig_DEBUG_LIST=y
CONfig_FAULT_INJECTION_DEBUG_FS=y
CONfig_LOCKUP_DETECTOR
BI Publisher Performance Issue caused by ancestor-or-self tag
Solution:把ancestor-or-self标签转换成绝对路径。
比如: <?ancestor-or-self::*/LP_FROMDATE?> 改成 <?/INVARCLI/LP_FROMDATE?>
测试报表的改动,可以参考:Update Data Template(xml file) and RTF(rtf file) Template for BI Publisher Report
Reference: R12: Troubleshooting KNown XML Publisher and E-Business Suite (EBS) Integration Issues [ID 1410160.1]
Common RTF Optimization issuesPlease make sure that "ancestor-or-self" is not used in RTF Template as it is very costly and time consuming.
今天关于Debugging performance issues in Go programs的讲解已经结束,谢谢您的阅读,如果想了解更多关于.net core Docker Compose启动问题: Debugging Error, The program to be debug con not be found in the conta、AN4771, Integrating FreeMASTER-Time Debugging Tool with CodeWarrior® for Microcon...、android performance debug、BI Publisher Performance Issue caused by ancestor-or-self tag的相关知识,请在本站搜索。
本文标签: