Re: [go-nuts] Measuring cpu usage for a tree of goroutines

2020-05-11 Thread robert engels
Also, you may be interested in github.com/robaho/goanalyzer - I feel it makes latency analysis much easier. > On May 11, 2020, at 11:46 PM, robert engels wrote: > > You don’t need to do it this way. see https://rakyll.org/profiler-labels/ >

Re: [go-nuts] Measuring cpu usage for a tree of goroutines

2020-05-11 Thread robert engels
You don’t need to do it this way. see https://rakyll.org/profiler-labels/ You label the work. The work will be recorded with the labels for analysis. The labels can be nested. This will allow you to use the execution trace to profile wall time, see

Re: [go-nuts] Measuring cpu usage for a tree of goroutines

2020-05-11 Thread Steve Canfield
Thanks, but what about the "I can't enable profiling for every request" bit? Assume it's actually important for me to know the cpu consumption on a per request basis. On Mon, May 11, 2020 at 4:55 PM Robert Engels wrote: > Look at pprof labels. > > On May 11, 2020, at 6:29 PM, Steven Canfield >

Re: [go-nuts] net/http: question about RoundTripper

2020-05-11 Thread Kevin Conway
I'll make an attempt to answer this question but I could be wrong given some deeper historical context between the early Go developers. There are two chunks of the http.RoundTripper comments that folks typically ask about: "should not attempt to handle higher-level protocol details" and "should

Re: [go-nuts] Measuring cpu usage for a tree of goroutines

2020-05-11 Thread Robert Engels
Look at pprof labels. > On May 11, 2020, at 6:29 PM, Steven Canfield wrote: > >  > Hi, > > I have an RPC server which has heterogenous requests, e.g. some calls hit > cache and are cheaper to serve while others need to compute a result. > > Is there any way to keep track of the cpu used

[go-nuts] Measuring cpu usage for a tree of goroutines

2020-05-11 Thread Steven Canfield
Hi, I have an RPC server which has heterogenous requests, e.g. some calls hit cache and are cheaper to serve while others need to compute a result. Is there any way to keep track of the cpu used just by one particular goroutine[1]? It seems like there's not a straightforward way today without

Re: [go-nuts] Trying to port Go to HPE NonStop x86 - Need some guidance

2020-05-11 Thread Ian Lance Taylor
On Mon, May 11, 2020 at 8:45 AM Randall Becker wrote: > > I know the subject has been covered for other platforms, but this one (HPE > NonStop TNS/X) has a few quirks. > > The platform does not support gcc at all. Many have spent years trying > unsuccessfully to port gcc. > The platform does

[go-nuts] Re: suspect or: role != admin || role != superadmin

2020-05-11 Thread Saied Seghatoleslami
Thank you, guys. I walked myself into a logical trap. Professor Isapovich is probably turning in his grave and giving me an F in some heavenly grade book. On Monday, May 11, 2020 at 2:53:02 PM UTC-4, Saied Seghatoleslami wrote: > > I have seen a ticket on this topic (or something related to

Re: [go-nuts] Image Resize and Crop

2020-05-11 Thread Robert Engels
That’s assuming the image is displayed. It is easier to keep portions of the image on disk with certain formats (eg tiled). > On May 11, 2020, at 2:40 PM, Robert Engels wrote: > > That means there is a memory leak. Once an image is decoded it takes the > same amount of memory based on

Re: [go-nuts] Image Resize and Crop

2020-05-11 Thread Robert Engels
That means there is a memory leak. Once an image is decoded it takes the same amount of memory based on resolution and bit depth. > On May 11, 2020, at 11:59 AM, Vivi wrote: > > It will make sense when you change PNG to JPG and loop 100x to see the > actual memory consumption with grtme -v

[go-nuts] net/http: question about RoundTripper

2020-05-11 Thread Anuj Agrawal
I am trying to understand in what cases would it make sense to implement my own RoundTripper. If I search about it, I come across examples of RoundTripper that try to do things like caching, retries, authentication, etc. I also read somewhere that there are many RoundTripper implementations that

Re: [go-nuts] suspect or: role != admin || role != superadmin

2020-05-11 Thread Ian Lance Taylor
On Mon, May 11, 2020 at 11:53 AM Saied Seghatoleslami wrote: > > I have seen a ticket on this topic (or something related to it) on Github but > I thought I would ask this community first: > > In first instance, I got "suspect or: role != admin || role != superadmin" > In the second instance, it

Re: [go-nuts] suspect or: role != admin || role != superadmin

2020-05-11 Thread Kurtis Rader
The inverse of validRole := role == admin || role == superadmin is invalidRole := role != admin && role != superadmin or invalidRole := !(role == admin || role == superadmin) It is not invalidRole := role != admin || role != superadmin Think about it. No matter what value `role`

[go-nuts] suspect or: role != admin || role != superadmin

2020-05-11 Thread Saied Seghatoleslami
I have seen a ticket on this topic (or something related to it) on Github but I thought I would ask this community first: In first instance, I got "suspect or: role != admin || role != superadmin" In the second instance, it works just fine. I have verified that role is string type (with %T

Re: [go-nuts] Re: How can stop a Read of net.Conn without closing it

2020-05-11 Thread Andrei Tudor Călin
That would work, yes. net/http, for example, has var aLongTimeAgo = time.Unix(1, 0), which is used for cancellation. On Mon, May 11, 2020 at 4:47 AM wrote: > > > On Wednesday, June 5, 2019 at 10:14:22 AM UTC-4, Ian Lance Taylor wrote: >> >> On Wed, Jun 5, 2019 at 12:10 AM Kurtis Rader >>

Re: [go-nuts] Image Resize and Crop

2020-05-11 Thread Vivi
It will make sense when you change PNG to JPG and loop 100x to see the actual memory consumption with grtme -v ... -- 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

[go-nuts] Trying to port Go to HPE NonStop x86 - Need some guidance

2020-05-11 Thread Randall Becker
Hi All, I know the subject has been covered for other platforms, but this one (HPE NonStop TNS/X) has a few quirks. 1. The platform does not support gcc at all. Many have spent years trying unsuccessfully to port gcc. 2. The platform does support a solid and POSIX compliant

Re: [go-nuts] Image Resize and Crop

2020-05-11 Thread Robert Engels
I’m sorry but that makes no sense. Do you mean file size is smaller? Depends on jpeg compression options. It can be many times smaller than a png. > On May 11, 2020, at 10:22 AM, Vivi wrote: > >  > > I found a snippet, memory usage with PNG vs JPG (more than 2x memory than PNG) >

Re: [go-nuts] Image Resize and Crop

2020-05-11 Thread Vivi
I found a snippet, memory usage with PNG vs JPG (more than 2x memory than PNG) https://gist.github.com/logrusorgru/570d64fd6a051e0441014387b89286ca Why does JPG consume more memory? Is it fine to have libvips as a dependency for content management system in the same way as PHP require with

[go-nuts] Re: Methods to serve static files under a path other than the root

2020-05-11 Thread Brian Candler
What your code does is when you access localhost:8080/h, it will serve the contents of the file ./data/h If ./data/h does not exist, it will give a 404. If ./data/h is a directory, it will redirect to /h/ - but then there's no route which matches that path, so after following the redirect

[go-nuts] Methods to serve static files under a path other than the root

2020-05-11 Thread Jingguo Yao
The following code serves the files inside ./data directory on localhost:8080/: log.Fatal(http.ListenAndServe(":8080", http.FileServer(http.Dir("./data" The following code does the same: http.Handle("/", http.FileServer(http.Dir("./data"))) log.Fatal(http.ListenAndServe(":8080", nil))

Re: [go-nuts] Image Resize and Crop

2020-05-11 Thread Nick
Quoth Vivi: > How do you advice to resize and crop JPEG and PNG or probably WebP images > without rely on 3rd parties dependencies? > > It was hard to find a good snippet or could be useful to have basic API > function in Go standard library since it's a common feature. I'd encourage you to

Re: [go-nuts] Request to update https://github.com/gonuts/go-shellquote

2020-05-11 Thread Sebastien Binet
On Sun, May 10, 2020 at 12:27 AM wrote: > https://github.com/gonuts/go-shellquote is 9 commits behind > https://github.com/kballard/go-shellquote. > > Could someone push the latest commits to the gonuts branch? > done. -s -- You received this message because you are subscribed to the Google

[go-nuts] Re: interface vs functions for mocking

2020-05-11 Thread Volker Dobler
On Saturday, 9 May 2020 09:57:50 UTC+2, Amarjeet Anand wrote: > > While writing unit test, what should be the preferred way to mock an > external(database, http...) call, *function based approach* or *interface > based approach?* > > I don't understand when to use function way and when to use

Re: [go-nuts] Can we maintain a per P epoll fd to make netpoll scalable?

2020-05-11 Thread Cholerae Hu
Thanks for responding. I will dig deeper about kernel contention later. 在 2020年5月10日星期日 UTC+8上午6:54:30,Ian Lance Taylor写道: > > On Sat, May 9, 2020 at 8:32 AM Cholerae Hu > wrote: > > > > I'm maintaining a highly-loaded proxy-like service, which serves huge > amount of small rpc requests every

[go-nuts] Re: Why I fear Go

2020-05-11 Thread shammah Zealsham Agwor
Looks like a wonderful challenge, -- 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

Re: [go-nuts] Failed to schedule cron job at night

2020-05-11 Thread 'Vikram Ingawale' via golang-nuts
Using ("15 2 * * ?") this exp it works properly for me. Thanks On Sat, May 9, 2020 at 1:42 PM Vikram Ingawale wrote: > > Thanks for your help. > > I am using go 1.14.0 > > Ok I’m updates it to 1.14.2 and then checking Tonight > > On Sat, 9 May 2020 at 1:01 PM, Brian Candler wrote: > >> I

Re: [go-nuts] Image Resize and Crop

2020-05-11 Thread Randall O'Reilly
https://github.com/anthonynsimon/bild has parallel image ops of all sorts and is widely used & well supported. - Randy > On May 10, 2020, at 9:52 PM, robert engels wrote: > > I don’t know and I doubt anyone else does off the top of their head, so why > don’t you write a test and see? > >