1/* Copyright (C) 2021-2022 Free Software Foundation, Inc.
2   Contributed by Oracle.
3
4   This file is part of GNU Binutils.
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 3, or (at your option)
9   any later version.
10
11   This program is distributed in the hope that it will be useful,
12   but WITHOUT ANY WARRANTY; without even the implied warranty of
13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   GNU General Public License for more details.
15
16   You should have received a copy of the GNU General Public License
17   along with this program; if not, write to the Free Software
18   Foundation, 51 Franklin Street - Fifth Floor, Boston,
19   MA 02110-1301, USA.  */
20
21#ifndef _COLLECTORAPI_H
22#define _COLLECTORAPI_H
23
24/* This file contains function prototypes for the user-callable API
25   routines in libcollector.  */
26
27#include <pthread.h>
28
29#ifdef __cplusplus
30extern "C"
31{
32#endif
33  /* Routine to record a sample in the experiment.  */
34  extern void collector_sample (const char *name);
35
36  /* Routine to suspend data collection during an experiment.  */
37  extern void collector_pause (void);
38
39  /* Routine to resume data collection during an experiment.  */
40  extern void collector_resume (void);
41
42  /* Routine to suspend per-thread data collection during an experiment.  */
43  extern void collector_thread_pause (pthread_t tid);
44
45  /* Routine to resume per-thread data collection during an experiment.  */
46  extern void collector_thread_resume (pthread_t tid);
47
48  /* Routine to close the experiment, and stop all data collection.  */
49  extern void  collector_terminate_expt (void);
50
51  typedef struct
52  {
53    unsigned int offset;
54    unsigned int lineno;
55  } Lineno;
56
57  /* Routines to let libcollector know about dynamically loaded functions.  */
58  extern void collector_func_load (const char *name, const char *alias,
59				   const char *sourcename, void *vaddr,
60				   int size, int lntsize, Lineno *lntable);
61
62  extern void collector_func_unload (void *vaddr);
63
64#ifdef NEED_COLLECTOR_MODULE
65  extern void collector_module_load (const char *modulename, void *vaddr);
66  extern void collector_module_unload (void *vaddr);
67#endif
68
69#ifdef __cplusplus
70}
71#endif
72
73#endif /* _COLLECTORAPI_H */
74