Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generating a comprehensive callgraph using GCC & Egypt

I am trying to generate a comprehensive callgraph (complete with low level calls to Linux, runtime, the lot).

I have statically compiled my source files with "-fdump-rtl-expand" and created RTL files, which I passed to a PERL script called Egypt (which I believe is Graphviz/Dot) and generated a PDF file of the callgraph. This works perfectly, no problems at all.

Except, there are calls being made into some libraries that are getting shown as built-in. I was looking to see if there is a way for the callgraph not to be printed as and instead the real calls made into the libraries ?

Please let me know if the question is unclear.

http://i.imgur.com/sp58v.jpg

Basically, I am trying to avoid the callgraph from generating < built-in >

Is there a way to do that ?

-------- CODE ---------

#include <cilk/cilk.h>
#include <stdio.h>
#include <stdlib.h>

unsigned long int t0, t5;
unsigned int NOSPAWN_THRESHOLD = 32;

int fib_nospawn(int n)
{
  if (n < 2) 
    return n;
  else 
    {
      int x = fib_nospawn(n-1);
      int y = fib_nospawn(n-2);
      return x + y;
    }
}

// spawning fibonacci function
int fib(long int n)
{
  long int x, y;
  if (n < 2) 
    return n;
  else if (n <= NOSPAWN_THRESHOLD)
    {
      x = fib_nospawn(n-1);
      y = fib_nospawn(n-2);
      return x + y;
    }
  else 
    {
      x = cilk_spawn fib(n-1);
      y = cilk_spawn fib(n-2);
      cilk_sync;
      return x + y;
    }
}

int main(int argc, char *argv[])
{
  int n;
  long int result;
  long int exec_time;

  n = atoi(argv[1]);
  NOSPAWN_THRESHOLD = atoi(argv[2]);
  result = fib(n);

  printf("%ld\n", result);
  return 0;
}

I compiled the Cilk Library from source.

like image 835
boffin Avatar asked Apr 17 '12 02:04

boffin


1 Answers

I might have found the partial solution to the problem:

You need to pass the following option to egypt

--include-external

This produced a slightly more comprehensive callgraph, although there still is the " visible

http://i.imgur.com/GWPJO.jpg?1

Can anyone suggest if I get more depth in the callgraph ?

like image 72
boffin Avatar answered Oct 07 '22 00:10

boffin