Back to index

cell-binutils  2.17cvs20070401
Functions
call_graph.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void cg_tally (bfd_vma, bfd_vma, unsigned long)
void cg_read_rec (FILE *, const char *)
void cg_write_arcs (FILE *, const char *)

Function Documentation

void cg_read_rec ( FILE *  ,
const char *   
)

Definition at line 80 of file call_graph.c.

{
  bfd_vma from_pc, self_pc;
  unsigned int count;

  if (gmon_io_read_vma (ifp, &from_pc)
      || gmon_io_read_vma (ifp, &self_pc)
      || gmon_io_read_32 (ifp, &count))
    {
      fprintf (stderr, _("%s: %s: unexpected end of file\n"),
              whoami, filename);
      done (1);
    }

  DBG (SAMPLEDEBUG,
       printf ("[cg_read_rec] frompc 0x%lx selfpc 0x%lx count %lu\n",
              (unsigned long) from_pc, (unsigned long) self_pc,
              (unsigned long) count));
  /* Add this arc:  */
  cg_tally (from_pc, self_pc, count);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void cg_tally ( bfd_vma  ,
bfd_vma  ,
unsigned  long 
)

Definition at line 34 of file call_graph.c.

{
  Sym *parent;
  Sym *child;

  parent = sym_lookup (&symtab, from_pc);
  child = sym_lookup (&symtab, self_pc);

  if (child == NULL || parent == NULL)
    return;

  /* If we're doing line-by-line profiling, both the parent and the
     child will probably point to line symbols instead of function
     symbols.  For the parent this is fine, since this identifies the
     line number in the calling routing, but the child should always
     point to a function entry point, so we back up in the symbol
     table until we find it.

     For normal profiling, is_func will be set on all symbols, so this
     code will do nothing.  */
  while (child >= symtab.base && ! child->is_func)
    --child;

  if (child < symtab.base)
    return;

  /* Keep arc if it is on INCL_ARCS table or if the INCL_ARCS table
     is empty and it is not in the EXCL_ARCS table.  */
  if (sym_id_arc_is_present (&syms[INCL_ARCS], parent, child)
      || (syms[INCL_ARCS].len == 0
         && !sym_id_arc_is_present (&syms[EXCL_ARCS], parent, child)))
    {
      child->ncalls += count;
      DBG (TALLYDEBUG,
          printf (_("[cg_tally] arc from %s to %s traversed %lu times\n"),
                 parent->name, child->name, count));
      arc_add (parent, child, count);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void cg_write_arcs ( FILE *  ,
const char *   
)

Definition at line 107 of file call_graph.c.

{
  Arc *arc;
  Sym *sym;

  for (sym = symtab.base; sym < symtab.limit; sym++)
    {
      for (arc = sym->cg.children; arc; arc = arc->next_child)
       {
         if (gmon_io_write_8 (ofp, GMON_TAG_CG_ARC)
             || gmon_io_write_vma (ofp, arc->parent->addr)
             || gmon_io_write_vma (ofp, arc->child->addr)
             || gmon_io_write_32 (ofp, arc->count))
           {
             perror (filename);
             done (1);
           }
         DBG (SAMPLEDEBUG,
            printf ("[cg_write_arcs] frompc 0x%lx selfpc 0x%lx count %lu\n",
                   (unsigned long) arc->parent->addr,
                   (unsigned long) arc->child->addr, arc->count));
       }
    }
}

Here is the call graph for this function:

Here is the caller graph for this function: