[go-nuts] Is it possible to produce coverage profiles for *_test.go files?
I'm working on a project with some quite complex test code and I'd like to be able to understand what parts of it are executing for certain tests. I generated coverage using the go test -coverprofile=coverage.out command but the coverage file only seems to contain information for non test files. Is it possible to extend the coverage to cover *_test.go files as well? Thanks, Piers -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/8b8ebbac-10fe-4fde-9f54-30cf53e2321dn%40googlegroups.com.
Re: [go-nuts] pprof not showing call hierarchy for time.now and time.Until
| runtime.timerproc 0.01s 100% | time.sendTime --+- 0.02s 50.00% | github.com/piersy/new_project/network.(*Connection).read 0.01s 25.00% | github.com/piersy/new_project/network.(*Connection).write 0.01s 25.00% | time.sendTime 0 0% 15.59% 0.04s 0.03%| time.Now 0.04s 100% | time.now --+- 0.01s 100% | runtime.timerproc 0 0% 15.59% 0.01s 0.0075%| time.sendTime 0.01s 100% | time.Now --+- On Mon, Oct 21, 2019 at 2:11 PM Robert Engels wrote: > Yes, that’s what I was referring to. It is much easier then the graph in > some cases. > > Also github.com/robaho/goanalyzer might help depending on the workload > > On Oct 21, 2019, at 2:10 AM, Than McIntosh wrote: > > > It can sometimes be useful in such situations to look at the pprof "tree" > output style (as opposed to graph). > > Than > > > On Sat, Oct 19, 2019 at 4:14 AM Piers Powlesland < > pierspowlesl...@gmail.com> wrote: > >> Kind of, but due to the sheer number of nodes and edged the edges end up >> lying on top of each other so in certain cases you end up having to check >> the source of several nodes to see which is the caller. >> >> On Sat, 19 Oct 2019, 03:08 Robert Engels, wrote: >> >>> But also can’t you just find that node in the graph and see the callers? >>> >>> On Oct 18, 2019, at 8:54 PM, Robert Engels >>> wrote: >>> >>> >>> Yes. When using the command pprof viewer there is a way to show the >>> hotspots with the callers. Again I don’t have access to dev at the moment. >>> >>> On Oct 18, 2019, at 8:44 PM, Piers Powlesland >>> wrote: >>> >>> >>> Hi Robert, >>> >>> I think I found the options you were referring to, and I was able to get >>> the whole overview with the following. >>> >>> go tool pprof -http : -edgefraction 0 -nodefraction 0 -nodecount >>> 10 cpu.prof >>> >>> Its a bit of a screenfull though, and I was wondering if there is any >>> simpler way to find out who is calling what? >>> So that I could dig down through top and if the function isn't in my >>> code follow the callstack to find what part of my code >>> initiated the call. >>> >>> On Fri, Oct 18, 2019 at 8:52 PM Robert Engels >>> wrote: >>> >>>> I am pretty sure there is a way to filter nodes that are less than X %, >>>> and some of that filtering is on by default - so you may want to turn that >>>> off (can't say for sure since not at dev machine right now). >>>> >>>> >>>> >>>> >>>> >>>> -Original Message- >>>> >From: Ian Lance Taylor >>>> >Sent: Oct 18, 2019 2:43 PM >>>> >To: Piers Powlesland >>>> >Cc: golang-nuts >>>> >Subject: Re: [go-nuts] pprof not showing call hierarchy for time.now >>>> and time.Until >>>> > >>>> >On Fri, Oct 18, 2019 at 12:37 PM wrote: >>>> >> >>>> >> I used pprof to get an overview of where time is being spent in my >>>> latest project and I'm >>>> >> getting a result I don't understand. When using the web view, there >>>> are certain function >>>> >> calls that are taking up a large percentage of the time but they >>>> appear un-rooted as in >>>> >> there seems to be no parent call calling them. >>>> >> >>>> >> I have attached a picture of the web view showing just the un-rooted >>>> functions. >>>> >> >>>> >> I generated the profile with the following command. >>>> >> >>>> >> go test -cpuprofile cpu.prof -count 4 . -run MyTest >>>> >> >>>> >> and I viewed the profile with the following command. >>>> >> >>>> >> go tool pprof -http : cpu.prof >>>> >> >>>> >> I'd really like to track down what is causin
Re: [go-nuts] pprof not showing call hierarchy for time.now and time.Until
Hi Than, Thanks for the tip. I actually discovered that selecting a node and using the Focus option from the Refine in the web view gets me a clear view of the callers and callees for the selected node. I have tried the tree view, passing the focus option on the command line but I' don't understand how to read it. Here is a snippet from the top of the output for tree Showing nodes accounting for 20.68s, 15.59% of 132.61s total --+- flat flat% sum%cum cum% calls calls% + context --+- 0.04s 0.19% | time.Now 20.65s 15.57% 15.57% 20.68s 15.59%| time.now 0.03s 0.15% | runtime.nanotime --+- 0.03s 100% | time.now 0.03s 0.023% 15.59% 0.03s 0.023%| runtime.nanotime --+- 0.02s 100% | github.com/piersy/new_project/worker.NewWorker.func1 0 0% 15.59% 0.02s 0.015%| github.com/piersy/new_project/network.(*Connection).Read 0.02s 100% | github.com/piersy/new_project/network.(*Connection).read --+- 0.01s 100% | github.com/piersy/new_project/worker.(*Listener).listen.func1 0 0% 15.59% 0.01s 0.0075%| github.com/piersy/new_project/network.(*Connection).Write 0.01s 100% | github.com/piersy/new_project/network.(*Connection).write --+- 0.02s 100% | github.com/piersy/new_project/network.(*Connection).Read 0 0% 15.59% 0.02s 0.015%| github.com/piersy/new_project/network.(*Connection).read 0.02s 100% | time.Now --+- 0.01s 100% | github.com/piersy/new_project/network.(*Connection).Write 0 0% 15.59% 0.01s 0.0075%| github.com/piersy/new_project/network.(*Connection).write 0.01s 100% | time.Now --+- In the web view when focused on time.now I can see the lower entries entries appearing in the call hierarchy leading to time.now, but here in the tree view they appear disconnected, the only hint that these entries call time.now is that I used the focus flag to focus on time.now. In the case that I haven't used the focus flag, I'm wondering how I would be able to relate entries in the tree to one another? I also tried using the peek flag, which if set to time.now, only prints the first entry from the tree output above. On Mon, Oct 21, 2019 at 8:10 AM Than McIntosh wrote: > It can sometimes be useful in such situations to look at the pprof "tree" > output style (as opposed to graph). > > Than > > > On Sat, Oct 19, 2019 at 4:14 AM Piers Powlesland < > pierspowlesl...@gmail.com> wrote: > >> Kind of, but due to the sheer number of nodes and edged the edges end up >> lying on top of each other so in certain cases you end up having to check >> the source of several nodes to see which is the caller. >> >> On Sat, 19 Oct 2019, 03:08 Robert Engels, wrote: >> >>> But also can’t you just find that node in the graph and see the callers? >>> >>> On Oct 18, 2019, at 8:54 PM, Robert Engels >>> wrote: >>> >>> >>> Yes. When using the command pprof viewer there is a way to show the >>> hotspots with the callers. Again I don’t have access to dev at the moment. >>> >>> On Oct 18, 2019, at 8:44 PM, Piers Powlesland >>> wrote: >>> >>> >>> Hi Robert, >>> >>> I think I found the options you were referring to, and I was able to get >>> the whole overview with the following. >>> >>> go tool pprof -http : -edgefraction 0 -nodefraction 0 -nodecount >>> 10 cpu.prof >>> >>> Its a bit of a screenfull though, and I was wondering if there is any >>> simpler way to find out who is calling what? >>> So that I could dig down through top and if the function isn't in my >>> code follow the callstack to f
Re: [go-nuts] pprof not showing call hierarchy for time.now and time.Until
Kind of, but due to the sheer number of nodes and edged the edges end up lying on top of each other so in certain cases you end up having to check the source of several nodes to see which is the caller. On Sat, 19 Oct 2019, 03:08 Robert Engels, wrote: > But also can’t you just find that node in the graph and see the callers? > > On Oct 18, 2019, at 8:54 PM, Robert Engels wrote: > > > Yes. When using the command pprof viewer there is a way to show the > hotspots with the callers. Again I don’t have access to dev at the moment. > > On Oct 18, 2019, at 8:44 PM, Piers Powlesland > wrote: > > > Hi Robert, > > I think I found the options you were referring to, and I was able to get > the whole overview with the following. > > go tool pprof -http : -edgefraction 0 -nodefraction 0 -nodecount > 10 cpu.prof > > Its a bit of a screenfull though, and I was wondering if there is any > simpler way to find out who is calling what? > So that I could dig down through top and if the function isn't in my code > follow the callstack to find what part of my code > initiated the call. > > On Fri, Oct 18, 2019 at 8:52 PM Robert Engels > wrote: > >> I am pretty sure there is a way to filter nodes that are less than X %, >> and some of that filtering is on by default - so you may want to turn that >> off (can't say for sure since not at dev machine right now). >> >> >> >> >> >> -Original Message- >> >From: Ian Lance Taylor >> >Sent: Oct 18, 2019 2:43 PM >> >To: Piers Powlesland >> >Cc: golang-nuts >> >Subject: Re: [go-nuts] pprof not showing call hierarchy for time.now and >> time.Until >> > >> >On Fri, Oct 18, 2019 at 12:37 PM wrote: >> >> >> >> I used pprof to get an overview of where time is being spent in my >> latest project and I'm >> >> getting a result I don't understand. When using the web view, there >> are certain function >> >> calls that are taking up a large percentage of the time but they >> appear un-rooted as in >> >> there seems to be no parent call calling them. >> >> >> >> I have attached a picture of the web view showing just the un-rooted >> functions. >> >> >> >> I generated the profile with the following command. >> >> >> >> go test -cpuprofile cpu.prof -count 4 . -run MyTest >> >> >> >> and I viewed the profile with the following command. >> >> >> >> go tool pprof -http : cpu.prof >> >> >> >> I'd really like to track down what is causing all this time in the >> time package, but I'm >> >> at a bit of a loss. >> > >> >Which version of Go and which GOOS/GOARCH? There have been bugs in >> >this area in the past, and at least some of them are fixed in 1.13. >> > >> >Ian >> > >> >-- >> >You received this message because you are subscribed to the Google >> Groups "golang-nuts" group. >> >To unsubscribe from this group and stop receiving emails from it, send >> an email to golang-nuts+unsubscr...@googlegroups.com. >> >To view this discussion on the web visit >> https://groups.google.com/d/msgid/golang-nuts/CAOyqgcWReW9e79szp29F11nmvVEzhZr7O%3D1Qp5WXkGBLwWprBA%40mail.gmail.com >> . >> > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/876AA5BF-E048-4A7D-8842-9E40B3F9FA26%40ix.netcom.com > <https://groups.google.com/d/msgid/golang-nuts/876AA5BF-E048-4A7D-8842-9E40B3F9FA26%40ix.netcom.com?utm_medium=email_source=footer> > . > > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAFXacX%3DJrvC8VqUs%2BCQr0SOBgfH4vtO5fyrYGVFidduH067OrA%40mail.gmail.com.
Re: [go-nuts] pprof not showing call hierarchy for time.now and time.Until
Hi Robert, I think I found the options you were referring to, and I was able to get the whole overview with the following. go tool pprof -http : -edgefraction 0 -nodefraction 0 -nodecount 10 cpu.prof Its a bit of a screenfull though, and I was wondering if there is any simpler way to find out who is calling what? So that I could dig down through top and if the function isn't in my code follow the callstack to find what part of my code initiated the call. On Fri, Oct 18, 2019 at 8:52 PM Robert Engels wrote: > I am pretty sure there is a way to filter nodes that are less than X %, > and some of that filtering is on by default - so you may want to turn that > off (can't say for sure since not at dev machine right now). > > > > > > -Original Message- > >From: Ian Lance Taylor > >Sent: Oct 18, 2019 2:43 PM > >To: Piers Powlesland > >Cc: golang-nuts > >Subject: Re: [go-nuts] pprof not showing call hierarchy for time.now and > time.Until > > > >On Fri, Oct 18, 2019 at 12:37 PM wrote: > >> > >> I used pprof to get an overview of where time is being spent in my > latest project and I'm > >> getting a result I don't understand. When using the web view, there are > certain function > >> calls that are taking up a large percentage of the time but they appear > un-rooted as in > >> there seems to be no parent call calling them. > >> > >> I have attached a picture of the web view showing just the un-rooted > functions. > >> > >> I generated the profile with the following command. > >> > >> go test -cpuprofile cpu.prof -count 4 . -run MyTest > >> > >> and I viewed the profile with the following command. > >> > >> go tool pprof -http : cpu.prof > >> > >> I'd really like to track down what is causing all this time in the time > package, but I'm > >> at a bit of a loss. > > > >Which version of Go and which GOOS/GOARCH? There have been bugs in > >this area in the past, and at least some of them are fixed in 1.13. > > > >Ian > > > >-- > >You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > >To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > >To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/CAOyqgcWReW9e79szp29F11nmvVEzhZr7O%3D1Qp5WXkGBLwWprBA%40mail.gmail.com > . > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAFXacX%3DTCLJp6TTic9GDwZ46KceUow2%3DUq0o6NMKt17YY%3Dp6Sw%40mail.gmail.com.
Re: [go-nuts] pprof not showing call hierarchy for time.now and time.Until
Hi Ian, I was on go1.13.2 linux/amd64 so i upgraded to go1.13.3 linux/amd64. I'm still seeing the same problem. On Fri, Oct 18, 2019 at 8:43 PM Ian Lance Taylor wrote: > On Fri, Oct 18, 2019 at 12:37 PM wrote: > > > > I used pprof to get an overview of where time is being spent in my > latest project and I'm > > getting a result I don't understand. When using the web view, there are > certain function > > calls that are taking up a large percentage of the time but they appear > un-rooted as in > > there seems to be no parent call calling them. > > > > I have attached a picture of the web view showing just the un-rooted > functions. > > > > I generated the profile with the following command. > > > > go test -cpuprofile cpu.prof -count 4 . -run MyTest > > > > and I viewed the profile with the following command. > > > > go tool pprof -http : cpu.prof > > > > I'd really like to track down what is causing all this time in the time > package, but I'm > > at a bit of a loss. > > Which version of Go and which GOOS/GOARCH? There have been bugs in > this area in the past, and at least some of them are fixed in 1.13. > > Ian > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAFXacX%3DWe9X4vBywmqG07ntiy76J%2BYJ%3DKS2%2BL-Jzq6zt_eNbtA%40mail.gmail.com.
[go-nuts] ycbcr.go YCbCrToRGB implementation.
Hi I have been looking at go's implementation YCbCr to RGB conversion and there are a few details that are not clear to me. The implementation follows the JFIF spec // The JFIF specification says: // R = Y' + 1.40200*(Cr-128) // G = Y' - 0.34414*(Cb-128) - 0.71414*(Cr-128) // B = Y' + 1.77200*(Cb-128) // http://www.w3.org/Graphics/JPEG/jfif3.pdf says Y but means Y'. It seems that all constants above are multiplied by 2^16 to allow the calculation to be performed with integer arithmetic, before being shifted back into an 8 bit range. But Y' is multiplied by 0x010100 which is equivalent to Y' * 2^16 + Y' * 2^8. I can't see why Y' in this case is scaled differently to the other components of the equation. If anyone could shed some light, it would be greatly appreciated. Thanks Piers -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.