microsoft / microsoft/WSL

gperftools doesn't work

Open
#1,577 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature
Dominant language
C++
Stars
33.7k
Forks
1.8k
Avg merge
3d 17h
Merged PRs (30d)
116

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by compiling and running the provided gperftools example on Ubuntu and WSL, comparing the CPUPROFILE output and the generated prof.out file. Then investigate why WSL reports zero interrupts and why google-pprof reports no nodes. Done means identifying the WSL-specific cause and documenting or fixing profiling so the example produces useful output.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
operating-systems, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.