2000-07-24 22:59:04 +02:00
|
|
|
|
/* hist.h
|
2001-03-14 04:14:56 +01:00
|
|
|
|
|
2007-07-06 12:40:34 +02:00
|
|
|
|
Copyright 2000, 2001, 2002, 2004, 2005, 2007 Free Software Foundation, Inc.
|
2000-07-24 22:59:04 +02:00
|
|
|
|
|
2007-07-06 12:40:34 +02:00
|
|
|
|
This file is part of GNU Binutils.
|
2000-07-24 22:59:04 +02:00
|
|
|
|
|
2007-07-06 12:40:34 +02:00
|
|
|
|
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 3 of the License, or
|
|
|
|
|
(at your option) any later version.
|
2000-07-24 22:59:04 +02:00
|
|
|
|
|
2007-07-06 12:40:34 +02:00
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
2000-07-24 22:59:04 +02:00
|
|
|
|
|
2007-07-06 12:40:34 +02:00
|
|
|
|
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., 51 Franklin Street - Fifth Floor, Boston,
|
|
|
|
|
MA 02110-1301, USA. */
|
2000-07-24 22:59:04 +02:00
|
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
|
#ifndef hist_h
|
|
|
|
|
#define hist_h
|
|
|
|
|
|
* hist.h (struct histogram)
(histograms, num_histograms): New.
* hist.c (find_histogram, find_histogram_for_pc)
(read_histogram_header): New.
(s_lowpc, s_highpc, lowpc, highpc, hist_num_bins)
(hist_sample): Remove.
(hist_read_rec): Use the above, and handle multiple
histogram records with disjoint address ranges.
(hist_write_hist): Support several histogram records.
(scale_and_align_entries): Adjust for multiple histograms.
(hist_assign_samples_1): New.
(hist_assign_samples): Use the above.
(hist_clip_symbol_address): New.
* hist.h (hist_check_address)
(hist_clip_symbol_address): Declare.
* gmon_io.c (gmon_out_read, gmon_out_write): Adjust handling
of legacy format for multiple histogram changes.
* corefile.c (find_call): Check for core_text_space and
clip symbol address range here.
* vax.c (vax_find_call): Don't check for
core_text_space, or clip the symbol's address range here.
Use hist_check_address to check call's target address.
* sparc.c: Likewise.
* tahoe.c: Likewise.
* i386.c: Likewise.
* mips.c: Likewise. Also use core_text_sect->vma as the base
address for code accesses, just like other machine-specific
routines do.
* gprof.texi: Adjust for the new logic.
2007-04-10 09:57:31 +02:00
|
|
|
|
typedef struct histogram
|
|
|
|
|
{
|
|
|
|
|
bfd_vma lowpc;
|
|
|
|
|
bfd_vma highpc;
|
|
|
|
|
unsigned int num_bins;
|
|
|
|
|
int *sample; /* Histogram samples (shorts in the file!). */
|
|
|
|
|
} histogram;
|
|
|
|
|
|
|
|
|
|
histogram *histograms;
|
|
|
|
|
unsigned num_histograms;
|
2000-07-24 22:59:04 +02:00
|
|
|
|
|
|
|
|
|
/* Scale factor converting samples to pc values:
|
|
|
|
|
each sample covers HIST_SCALE bytes. */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
extern double hist_scale;
|
|
|
|
|
|
* alpha.c, basic_blocks.c, basic_blocks.h, bb_exit_func.c,
call_graph.c, call_graph.h, cg_arcs.c, cg_arcs.h, cg_dfn.c,
cg_dfn.h, cg_print.c, cg_print.h, corefile.c, corefile.h,
gmon_io.c, gmon_io.h, gprof.c, gprof.h, hertz.h, hist.c, hist.h,
i386.c, mips.c, search_list.c, search_list.h, source.c, source.h,
sparc.c, sym_ids.c, sym_ids.h, symtab.c, symtab.h, tahoe.c,
utils.c, utils.h, vax.c, gen-c-prog.awk: Convert K&R C to ANSI C.
2004-05-26 06:55:55 +02:00
|
|
|
|
extern void hist_read_rec (FILE *, const char *);
|
|
|
|
|
extern void hist_write_hist (FILE *, const char *);
|
|
|
|
|
extern void hist_assign_samples (void);
|
|
|
|
|
extern void hist_print (void);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
* hist.h (struct histogram)
(histograms, num_histograms): New.
* hist.c (find_histogram, find_histogram_for_pc)
(read_histogram_header): New.
(s_lowpc, s_highpc, lowpc, highpc, hist_num_bins)
(hist_sample): Remove.
(hist_read_rec): Use the above, and handle multiple
histogram records with disjoint address ranges.
(hist_write_hist): Support several histogram records.
(scale_and_align_entries): Adjust for multiple histograms.
(hist_assign_samples_1): New.
(hist_assign_samples): Use the above.
(hist_clip_symbol_address): New.
* hist.h (hist_check_address)
(hist_clip_symbol_address): Declare.
* gmon_io.c (gmon_out_read, gmon_out_write): Adjust handling
of legacy format for multiple histogram changes.
* corefile.c (find_call): Check for core_text_space and
clip symbol address range here.
* vax.c (vax_find_call): Don't check for
core_text_space, or clip the symbol's address range here.
Use hist_check_address to check call's target address.
* sparc.c: Likewise.
* tahoe.c: Likewise.
* i386.c: Likewise.
* mips.c: Likewise. Also use core_text_sect->vma as the base
address for code accesses, just like other machine-specific
routines do.
* gprof.texi: Adjust for the new logic.
2007-04-10 09:57:31 +02:00
|
|
|
|
/* Checks if ADDRESS is within the range of addresses for which
|
|
|
|
|
we have histogram data. Returns 1 if so and 0 otherwise. */
|
|
|
|
|
extern int hist_check_address (unsigned address);
|
|
|
|
|
|
|
|
|
|
/* Given a range of addresses for a symbol, find a histogram record
|
|
|
|
|
that intersects with this range, and clips the range to that
|
|
|
|
|
histogram record, modifying *P_LOWPC and *P_HIGHPC.
|
|
|
|
|
|
|
|
|
|
If no intersection is found, *P_LOWPC and *P_HIGHPC will be set to
|
|
|
|
|
one unspecified value. If more that one intersection is found,
|
|
|
|
|
an error is emitted. */
|
|
|
|
|
extern void hist_clip_symbol_address (bfd_vma *p_lowpc, bfd_vma *p_highpc);
|
|
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
|
#endif /* hist_h */
|