/* cg_print.c - Print routines for displaying call graphs.
- Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 2000, 2001, 2002, 2004, 2007 Free Software Foundation, Inc.
This file is part of GNU Binutils.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- 02111-1307, USA. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+ 02110-1301, USA. */
\f
-#include "libiberty.h"
#include "gprof.h"
+#include "libiberty.h"
#include "search_list.h"
#include "source.h"
#include "symtab.h"
#define EQUALTO 0
#define GREATERTHAN 1
-static void print_header PARAMS ((void));
-static void print_cycle PARAMS ((Sym *));
-static int cmp_member PARAMS ((Sym *, Sym *));
-static void sort_members PARAMS ((Sym *));
-static void print_members PARAMS ((Sym *));
-static int cmp_arc PARAMS ((Arc *, Arc *));
-static void sort_parents PARAMS ((Sym *));
-static void print_parents PARAMS ((Sym *));
-static void sort_children PARAMS ((Sym *));
-static void print_children PARAMS ((Sym *));
-static void print_line PARAMS ((Sym *));
-static int cmp_name PARAMS ((const PTR, const PTR));
-static int cmp_arc_count PARAMS ((const PTR, const PTR));
-static int cmp_fun_nuses PARAMS ((const PTR, const PTR));
+static void print_header (void);
+static void print_cycle (Sym *);
+static int cmp_member (Sym *, Sym *);
+static void sort_members (Sym *);
+static void print_members (Sym *);
+static int cmp_arc (Arc *, Arc *);
+static void sort_parents (Sym *);
+static void print_parents (Sym *);
+static void sort_children (Sym *);
+static void print_children (Sym *);
+static void print_line (Sym *);
+static int cmp_name (const PTR, const PTR);
+static int cmp_arc_count (const PTR, const PTR);
+static int cmp_fun_nuses (const PTR, const PTR);
static void order_and_dump_functions_by_arcs
- PARAMS ((Arc **, unsigned long, int, Arc **, unsigned long *));
+ (Arc **, unsigned long, int, Arc **, unsigned long *);
/* Declarations of automatically generated functions to output blurbs. */
-extern void bsd_callg_blurb PARAMS ((FILE * fp));
-extern void fsf_callg_blurb PARAMS ((FILE * fp));
+extern void bsd_callg_blurb (FILE * fp);
+extern void fsf_callg_blurb (FILE * fp);
double print_time = 0.0;
}
printf (_("\ngranularity: each sample hit covers %ld byte(s)"),
- (long) hist_scale * sizeof (UNIT));
+ (long) hist_scale * (long) sizeof (UNIT));
if (print_time > 0.0)
printf (_(" for %.2f%% of %.2f seconds\n\n"),
/* Print a cycle header. */
static void
-print_cycle (cyc)
- Sym *cyc;
+print_cycle (Sym *cyc)
{
char buf[BUFSIZ];
CG.PROP.SELF+CG.PROP.CHILD, secondary key is NCALLS+CG.SELF_CALLS. */
static int
-cmp_member (left, right)
- Sym *left;
- Sym *right;
+cmp_member (Sym *left, Sym *right)
{
double left_time = left->cg.prop.self + left->cg.prop.child;
double right_time = right->cg.prop.self + right->cg.prop.child;
/* Sort members of a cycle. */
static void
-sort_members (cyc)
- Sym *cyc;
+sort_members (Sym *cyc)
{
Sym *todo, *doing, *prev;
todo = cyc->cg.cyc.next;
cyc->cg.cyc.next = 0;
- for (doing = todo; doing && doing->cg.cyc.next; doing = todo)
+ for (doing = todo; doing != NULL; doing = todo)
{
todo = doing->cg.cyc.next;
/* Print the members of a cycle. */
static void
-print_members (cyc)
- Sym *cyc;
+print_members (Sym *cyc)
{
Sym *member;
arc count as minor key. */
static int
-cmp_arc (left, right)
- Arc *left;
- Arc *right;
+cmp_arc (Arc *left, Arc *right)
{
Sym *left_parent = left->parent;
Sym *left_child = left->child;
static void
-sort_parents (child)
- Sym * child;
+sort_parents (Sym * child)
{
Arc *arc, *detached, sorted, *prev;
static void
-print_parents (child)
- Sym *child;
+print_parents (Sym *child)
{
Sym *parent;
Arc *arc;
static void
-sort_children (parent)
- Sym *parent;
+sort_children (Sym *parent)
{
Arc *arc, *detached, sorted, *prev;
static void
-print_children (parent)
- Sym *parent;
+print_children (Sym *parent)
{
Sym *child;
Arc *arc;
static void
-print_line (np)
- Sym *np;
+print_line (Sym *np)
{
char buf[BUFSIZ];
/* Print dynamic call graph. */
void
-cg_print (timesortsym)
- Sym ** timesortsym;
+cg_print (Sym ** timesortsym)
{
unsigned int index;
Sym *parent;
static int
-cmp_name (left, right)
- const PTR left;
- const PTR right;
+cmp_name (const PTR left, const PTR right)
{
const Sym **npp1 = (const Sym **) left;
const Sym **npp2 = (const Sym **) right;
We want to sort in descending order. */
static int
-cmp_arc_count (left, right)
- const PTR left;
- const PTR right;
+cmp_arc_count (const PTR left, const PTR right)
{
const Arc **npp1 = (const Arc **) left;
const Arc **npp2 = (const Arc **) right;
We want to sort in descending order. */
static int
-cmp_fun_nuses (left, right)
- const PTR left;
- const PTR right;
+cmp_fun_nuses (const PTR left, const PTR right)
{
const Sym **npp1 = (const Sym **) left;
const Sym **npp2 = (const Sym **) right;