1183000Smav/* Copyright (C) 2021-2022 Free Software Foundation, Inc.
2183000Smav   Contributed by Oracle.
3162924Sjoel
4162924Sjoel   This file is part of GNU Binutils.
5162924Sjoel
6162924Sjoel   This program is free software; you can redistribute it and/or modify
7162924Sjoel   it under the terms of the GNU General Public License as published by
8162924Sjoel   the Free Software Foundation; either version 3, or (at your option)
9162924Sjoel   any later version.
10162924Sjoel
11162924Sjoel   This program is distributed in the hope that it will be useful,
12162924Sjoel   but WITHOUT ANY WARRANTY; without even the implied warranty of
13162924Sjoel   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14162924Sjoel   GNU General Public License for more details.
15162924Sjoel
16162924Sjoel   You should have received a copy of the GNU General Public License
17162924Sjoel   along with this program; if not, write to the Free Software
18162924Sjoel   Foundation, 51 Franklin Street - Fifth Floor, Boston,
19162924Sjoel   MA 02110-1301, USA.  */
20162924Sjoel
21162924Sjoel#ifndef _COLLECTORAPI_H
22162924Sjoel#define _COLLECTORAPI_H
23162924Sjoel
24162924Sjoel/* This file contains function prototypes for the user-callable API
25162924Sjoel   routines in libcollector.  */
26162924Sjoel
27162924Sjoel#include <pthread.h>
28230551Smav
29162924Sjoel#ifdef __cplusplus
30162924Sjoelextern "C"
31162924Sjoel{
32162924Sjoel#endif
33162924Sjoel  /* Routine to record a sample in the experiment.  */
34162924Sjoel  extern void collector_sample (const char *name);
35162924Sjoel
36162924Sjoel  /* Routine to suspend data collection during an experiment.  */
37162924Sjoel  extern void collector_pause (void);
38162924Sjoel
39162924Sjoel  /* Routine to resume data collection during an experiment.  */
40162924Sjoel  extern void collector_resume (void);
41162924Sjoel
42162924Sjoel  /* Routine to suspend per-thread data collection during an experiment.  */
43162924Sjoel  extern void collector_thread_pause (pthread_t tid);
44162924Sjoel
45162924Sjoel  /* Routine to resume per-thread data collection during an experiment.  */
46162924Sjoel  extern void collector_thread_resume (pthread_t tid);
47162924Sjoel
48162924Sjoel  /* Routine to close the experiment, and stop all data collection.  */
49183000Smav  extern void  collector_terminate_expt (void);
50183000Smav
51183000Smav  typedef struct
52183000Smav  {
53183000Smav    unsigned int offset;
54162924Sjoel    unsigned int lineno;
55162924Sjoel  } Lineno;
56230130Smav
57230130Smav  /* Routines to let libcollector know about dynamically loaded functions.  */
58230130Smav  extern void collector_func_load (const char *name, const char *alias,
59162924Sjoel				   const char *sourcename, void *vaddr,
60183000Smav				   int size, int lntsize, Lineno *lntable);
61184738Smav
62184751Smav  extern void collector_func_unload (void *vaddr);
63199247Smav
64183000Smav#ifdef NEED_COLLECTOR_MODULE
65162924Sjoel  extern void collector_module_load (const char *modulename, void *vaddr);
66162924Sjoel  extern void collector_module_unload (void *vaddr);
67162924Sjoel#endif
68162924Sjoel
69162924Sjoel#ifdef __cplusplus
70162924Sjoel}
71183000Smav#endif
72184738Smav
73183000Smav#endif /* _COLLECTORAPI_H */
74183016Sjoel