xref: /dflybsd-src/contrib/binutils-2.34/gprof/hist.h (revision b52ef7118d1621abed722c5bbbd542210290ecef)
1*fae548d3Szrj /* hist.h
2*fae548d3Szrj 
3*fae548d3Szrj    Copyright (C) 2000-2020 Free Software Foundation, Inc.
4*fae548d3Szrj 
5*fae548d3Szrj    This file is part of GNU Binutils.
6*fae548d3Szrj 
7*fae548d3Szrj    This program is free software; you can redistribute it and/or modify
8*fae548d3Szrj    it under the terms of the GNU General Public License as published by
9*fae548d3Szrj    the Free Software Foundation; either version 3 of the License, or
10*fae548d3Szrj    (at your option) any later version.
11*fae548d3Szrj 
12*fae548d3Szrj    This program is distributed in the hope that it will be useful,
13*fae548d3Szrj    but WITHOUT ANY WARRANTY; without even the implied warranty of
14*fae548d3Szrj    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15*fae548d3Szrj    GNU General Public License for more details.
16*fae548d3Szrj 
17*fae548d3Szrj    You should have received a copy of the GNU General Public License
18*fae548d3Szrj    along with this program; if not, write to the Free Software
19*fae548d3Szrj    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
20*fae548d3Szrj    MA 02110-1301, USA.  */
21*fae548d3Szrj 
22*fae548d3Szrj #ifndef hist_h
23*fae548d3Szrj #define hist_h
24*fae548d3Szrj 
25*fae548d3Szrj typedef struct histogram
26*fae548d3Szrj {
27*fae548d3Szrj   bfd_vma lowpc;
28*fae548d3Szrj   bfd_vma highpc;
29*fae548d3Szrj   unsigned int num_bins;
30*fae548d3Szrj   int *sample;           /* Histogram samples (shorts in the file!).  */
31*fae548d3Szrj } histogram;
32*fae548d3Szrj 
33*fae548d3Szrj extern histogram * histograms;
34*fae548d3Szrj extern unsigned    num_histograms;
35*fae548d3Szrj 
36*fae548d3Szrj /* Scale factor converting samples to pc values:
37*fae548d3Szrj    each sample covers HIST_SCALE bytes.  */
38*fae548d3Szrj extern double hist_scale;
39*fae548d3Szrj 
40*fae548d3Szrj extern void hist_read_rec        (FILE *, const char *);
41*fae548d3Szrj extern void hist_write_hist      (FILE *, const char *);
42*fae548d3Szrj extern void hist_assign_samples  (void);
43*fae548d3Szrj extern void hist_print           (void);
44*fae548d3Szrj 
45*fae548d3Szrj /* Checks if ADDRESS is within the range of addresses for which
46*fae548d3Szrj    we have histogram data.  Returns 1 if so and 0 otherwise.  */
47*fae548d3Szrj extern int hist_check_address (unsigned address);
48*fae548d3Szrj 
49*fae548d3Szrj /* Given a range of addresses for a symbol, find a histogram record
50*fae548d3Szrj    that intersects with this range, and clips the range to that
51*fae548d3Szrj    histogram record, modifying *P_LOWPC and *P_HIGHPC.
52*fae548d3Szrj 
53*fae548d3Szrj    If no intersection is found, *P_LOWPC and *P_HIGHPC will be set to
54*fae548d3Szrj    one unspecified value.  If more that one intersection is found,
55*fae548d3Szrj    an error is emitted.  */
56*fae548d3Szrj extern void hist_clip_symbol_address (bfd_vma *p_lowpc, bfd_vma *p_highpc);
57*fae548d3Szrj 
58*fae548d3Szrj #endif /* hist_h */
59