Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gperftools doesn't work #1577

Open
kirillkh opened this issue Jan 8, 2017 · 4 comments
Open

gperftools doesn't work #1577

kirillkh opened this issue Jan 8, 2017 · 4 comments
Labels

Comments

@kirillkh
Copy link

kirillkh commented Jan 8, 2017

gperftools (aka Google Profiler) produces no useful output.

E.g., this code:

#include "gperftools/profiler.h"
#include <iostream>
#include <math.h>
using namespace std;
void bar()
{
  int a,b,c,d,j,k;
  a=0;
  int z=0;
  b = 1000;
  while(z < b)
    {
      while (a < b)
        {
          d = sin(a);
          c = cos(a);
          j = tan(a);
          k = tan(a);
          k = d * c + j *k;
          a++;
        }
      a = 0;
      z++;
    }
}

int main()
{
  ProfilerStart("prof.out");

  bar();
  ProfilerFlush();
  ProfilerStop();
}

produces the following output on a real Ubuntu machine:

$ CPUPROFILE=prof.out ./test
PROFILE: interrupts/evictions/bytes = 26/2/1848

but this output on WSL:

$ CPUPROFILE=prof.out ./test
PROFILE: interrupts/evictions/bytes = 0/0/64

Trying to dump prof.out indeed shows it is empty:

$ google-pprof ./test --svg prof.out
Using local file ./test.
Using local file prof.out.
No nodes to print

I tried running with various levels of PERFTOOLS_VERBOSE, but was not able to obtain any leads on where the problem might be.

@therealkenc
Copy link
Collaborator

therealkenc commented Jan 8, 2017

Lead (given missing #include <gperftools/profiler.h>)...

strace -f ./test 2> test.strace

...
setitimer(ITIMER_PROF, {it_interval={0, 10000}, it_value={0, 10000}}, NULL) = -1 
   EINVAL (Invalid argument)
...

@kirillkh
Copy link
Author

kirillkh commented Jan 8, 2017

Sorry about the missing include, fixed.

@stehufntdev
Copy link
Collaborator

@therealkenc thanks for the great triage!

@kirillkh, WSL currently only supports ITIMER_REAL for setitimer. Please give us feedback for this scenario on the user voice page so we can prioritize - https://wpdev.uservoice.com/forums/266908-command-prompt-console-bash-on-ubuntu-on-windo/.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants