xref: /netbsd-src/external/gpl3/gcc/dist/libgcc/gcov.h (revision b1e838363e3c6fc78a55519254d99869742dd33c)
1 /* GCOV interface routines.
2    Copyright (C) 2017-2022 Free Software Foundation, Inc.
3 
4    This file is part of GCC.
5 
6    GCC is free software; you can redistribute it and/or modify it under
7    the terms of the GNU General Public License as published by the Free
8    Software Foundation; either version 3, or (at your option) any later
9    version.
10 
11    GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12    WARRANTY; without even the implied warranty of MERCHANTABILITY or
13    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14    for more details.
15 
16    Under Section 7 of GPL version 3, you are granted additional
17    permissions described in the GCC Runtime Library Exception, version
18    3.1, as published by the Free Software Foundation.
19 
20    You should have received a copy of the GNU General Public License and
21    a copy of the GCC Runtime Library Exception along with this program;
22    see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
23    <http://www.gnu.org/licenses/>.  */
24 
25 #ifndef GCC_GCOV_H
26 #define GCC_GCOV_H
27 
28 struct gcov_info;
29 
30 /* Set all counters to zero.  */
31 
32 extern void __gcov_reset (void);
33 
34 /* Write profile information to a file.  */
35 
36 extern void __gcov_dump (void);
37 
38 /* Convert the gcov information referenced by INFO to a gcda data stream.
39    The FILENAME_FN callback is called exactly once with the filename associated
40    with the gcov information.  The filename may be NULL.  Afterwards, the
41    DUMP_FN callback is subsequently called with chunks (the begin and length of
42    the chunk are passed as the first two callback parameters) of the gcda data
43    stream.  The ALLOCATE_FN callback shall allocate memory with a size in
44    characters specified by the first callback parameter.  The ARG parameter is
45    a user-provided argument passed as the last argument to the callback
46    functions.  */
47 
48 extern void
49 __gcov_info_to_gcda (const struct gcov_info *__info,
50 		     void (*__filename_fn) (const char *, void *),
51 		     void (*__dump_fn) (const void *, unsigned, void *),
52 		     void *(*__allocate_fn) (unsigned, void *),
53 		     void *__arg);
54 
55 #endif /* GCC_GCOV_H */
56