GithubHelp home page GithubHelp logo

Empty CPU Profile about profile HOT 8 CLOSED

pkg avatar pkg commented on August 28, 2024 1
Empty CPU Profile

from profile.

Comments (8)

davisford avatar davisford commented on August 28, 2024 1

Hi @davecheney I have a similar problem. The memory and block profiles work ok for me, but

$ls -al cpu.pprof 
-rw-r--r--  1 davisford  staff  64 Apr  5 13:49 cpu.pprof
$cat cpu.pprof 
~/$

I don't necessarily have some way to peg the server I'm trying to profile (other than writing an expensive loop/func, but that isn't interesting for me to profile). I was able to instrument some things in the browser (it's a webapp) that caused some spikes up near the 30% mark, but still nothing in the cpu.pprof file. Is it possible to tune the threshold where it starts recording like you can with the memory?

EDIT -- for anyone else that arrives here, on a Mac, check if runtime/pprof has any issues on your platform. I'm guessing that might be the issue with my situation.

from profile.

davecheney avatar davecheney commented on August 28, 2024 1

"github.com/davecheney/profile"

You are using the old version of this package. Please use
github.com/pkg/profile.

On Tue, Jul 26, 2016 at 8:14 AM, Dave Cheney [email protected] wrote:

I haven't had a chance to run your sample yet.

Which version of Go are you using? Is it possible that the conpiler has
optimised away those loops leaving you with just the sleep?

On Mon, 25 Jul 2016, 17:51 Tamer Tas [email protected] wrote:

@davecheney https://github.com/davecheney sorry for the confusion, but
the first draft of my comment had the wrong code, which I fixed
immediately. But since you're viewing it by e-mail, you saw the old
version. I'm quoting my up-to-date comment here again:

@davecheney https://github.com/davecheney I am able to reproduce this
issue with the following main.go and go 1.6.2 in OSX 10.11 (contains the
kernel fix for pprof) and Ubuntu 16.04

package main
import (
"time"
"github.com/davecheney/profile"
)
func main() {
defer profile.Start(profile.CPUProfile).Stop()

    for i := 0; i < 918231333 i++ {
            i *= 2
            i /= 2
    }

<-time.After(time.Second*3)

    for i := 0; i < 9182312232; i++ {
            i *= 2
            i /= 2
    }

}


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#16 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAAcA9abAqHYSoNgEYspQHWKy1q-lt27ks5qZGsAgaJpZM4Gq83x
.

from profile.

davecheney avatar davecheney commented on August 28, 2024

Maybe the program is not running long enough to generate useful profiling information. What happens if you use a program that does real work.

On 29 Nov 2015, at 17:37, Ian Walter [email protected] wrote:

I'm trying to profile a simple application:

package main

import (
"github.com/pkg/profile"
"github.com/spf13/cobra"
"strings"
)

/*
Tokenize TODO
*/
func Tokenize(text string) []string {
return strings.Split(text, "\n")
}

func main() {
profileCommand := &cobra.Command{
Use: "profile",
Run: func(cmd *cobra.Command, args []string) {
defer profile.Start(profile.CPUProfile, profile.ProfilePath(".")).Stop()

        Tokenize("Hello\nWorld")
    },
}

rootCommand := &cobra.Command{Use: "bern"}
rootCommand.AddCommand(profileCommand)
rootCommand.Execute()

}
But when I look at the cpu.pprof file it simply contains ' and nothing else.
What am I doing incorrectly?


Reply to this email directly or view it on GitHub.

from profile.

davecheney avatar davecheney commented on August 28, 2024

@ianwalter i've not been able to reproduce this issue, and haven't had other reports of it. I'm keen to close this issue if you cannot reproduce it further.

from profile.

tmrts avatar tmrts commented on August 28, 2024

@davecheney I am able to reproduce this issue with the following main.go and go 1.6.2 in OSX 10.11 (contains the kernel fix for pprof) and Ubuntu 16.04

package main

import (
        "time"
        "github.com/pkg/profile"
)

func main() {
        defer profile.Start(profile.CPUProfile).Stop()

        for i := 0; i < 918231333 i++ {
                i *= 2
                i /= 2
        }

<-time.After(time.Second*3)

        for i := 0; i < 9182312232; i++ {
                i *= 2
                i /= 2
        }
}

from profile.

davecheney avatar davecheney commented on August 28, 2024

What happens if you remove the call to set block profile rate?

On Mon, 25 Jul 2016, 00:51 Tamer Tas [email protected] wrote:

@davecheney https://github.com/davecheney I am able to reproduce this
issue with the following main.go and go 1.6.2

package main
import (
"runtime"
"github.com/davecheney/profile"
)
func main() {
runtime.SetBlockProfileRate(1)

defer profile.Start(profile.CPUProfile).Stop()

for i := 0; i < 9182319231998989889; i++ {
    i *= 2
    i /= 2
}

}


You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub
#16 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAAcA9oQgfBnncRToJApyCSRRnBAYMEZks5qY3vqgaJpZM4Gq83x
.

from profile.

tmrts avatar tmrts commented on August 28, 2024

@davecheney sorry for the confusion, but the first draft of my comment had the wrong code, which I fixed immediately. But since you're viewing it by e-mail, you saw the old version. I'm quoting my up-to-date comment here again:

@davecheney I am able to reproduce this issue with the following main.go and go 1.6.2 in OSX 10.11 (contains the kernel fix for pprof) and Ubuntu 16.04

package main

import (
        "time"
        "github.com/pkg/profile"
)

func main() {
        defer profile.Start(profile.CPUProfile).Stop()

        for i := 0; i < 918231333 i++ {
                i *= 2
                i /= 2
        }

<-time.After(time.Second*3)

        for i := 0; i < 9182312232; i++ {
                i *= 2
                i /= 2
        }
}

from profile.

davecheney avatar davecheney commented on August 28, 2024

I haven't had a chance to run your sample yet.

Which version of Go are you using? Is it possible that the conpiler has
optimised away those loops leaving you with just the sleep?

On Mon, 25 Jul 2016, 17:51 Tamer Tas [email protected] wrote:

@davecheney https://github.com/davecheney sorry for the confusion, but
the first draft of my comment had the wrong code, which I fixed
immediately. But since you're viewing it by e-mail, you saw the old
version. I'm quoting my up-to-date comment here again:

@davecheney https://github.com/davecheney I am able to reproduce this
issue with the following main.go and go 1.6.2 in OSX 10.11 (contains the
kernel fix for pprof) and Ubuntu 16.04

package main
import (
"time"
"github.com/davecheney/profile"
)
func main() {
defer profile.Start(profile.CPUProfile).Stop()

    for i := 0; i < 918231333 i++ {
            i *= 2
            i /= 2
    }

<-time.After(time.Second*3)

    for i := 0; i < 9182312232; i++ {
            i *= 2
            i /= 2
    }

}


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#16 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAAcA9abAqHYSoNgEYspQHWKy1q-lt27ks5qZGsAgaJpZM4Gq83x
.

from profile.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.