Home | History | Annotate | Line # | Download | only in include
      1  1.1.1.3  christos /* Copyright (C) 2021-2025 Free Software Foundation, Inc.
      2      1.1  christos    Contributed by Oracle.
      3      1.1  christos 
      4      1.1  christos    This file is part of GNU Binutils.
      5      1.1  christos 
      6      1.1  christos    This program is free software; you can redistribute it and/or modify
      7      1.1  christos    it under the terms of the GNU General Public License as published by
      8      1.1  christos    the Free Software Foundation; either version 3, or (at your option)
      9      1.1  christos    any later version.
     10      1.1  christos 
     11      1.1  christos    This program is distributed in the hope that it will be useful,
     12      1.1  christos    but WITHOUT ANY WARRANTY; without even the implied warranty of
     13      1.1  christos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14      1.1  christos    GNU General Public License for more details.
     15      1.1  christos 
     16      1.1  christos    You should have received a copy of the GNU General Public License
     17      1.1  christos    along with this program; if not, write to the Free Software
     18      1.1  christos    Foundation, 51 Franklin Street - Fifth Floor, Boston,
     19      1.1  christos    MA 02110-1301, USA.  */
     20      1.1  christos 
     21      1.1  christos #ifndef _LIBCOLLECTOR_H
     22      1.1  christos #define _LIBCOLLECTOR_H
     23      1.1  christos 
     24      1.1  christos typedef struct
     25      1.1  christos {
     26      1.1  christos   unsigned int offset;
     27      1.1  christos   unsigned int lineno;
     28      1.1  christos } Lineno;
     29      1.1  christos 
     30      1.1  christos #ifdef __cplusplus
     31      1.1  christos extern "C"
     32      1.1  christos {
     33      1.1  christos #endif
     34      1.1  christos 
     35      1.1  christos   /* This file contains function prototypes for the user-callable API
     36      1.1  christos      routines in libcollector for C and C++ codes.  */
     37      1.1  christos 
     38      1.1  christos   /* Routine to record a sample in the experiment.  */
     39      1.1  christos   void collector_sample (char *name);
     40      1.1  christos 
     41      1.1  christos   /* Routine to suspend data collection during an experiment.  */
     42      1.1  christos   void collector_pause (void);
     43      1.1  christos 
     44      1.1  christos   /* Routine to resume data collection during an experiment.  */
     45      1.1  christos   void collector_resume (void);
     46      1.1  christos 
     47      1.1  christos   /* Routine to suspend per-thread data collection during an experiment.  */
     48      1.1  christos   void collector_thread_pause (unsigned int tid);
     49      1.1  christos 
     50      1.1  christos   /* Routine to resume per-thread data collection during an experiment.  */
     51      1.1  christos   void collector_thread_resume (unsigned int tid);
     52      1.1  christos 
     53      1.1  christos   /* Routine to close the experiment, and stop all data collection.  */
     54      1.1  christos   void collector_terminate_expt (void);
     55      1.1  christos 
     56      1.1  christos   /* Routines to let libcollector know about a dynamically loaded function.  */
     57      1.1  christos   void collector_func_load (char *name, char *alias, char *sourcename,
     58      1.1  christos 			  void *vaddr, int size, int lntsize, Lineno *lntable);
     59      1.1  christos   void collector_func_unload (void *vaddr);
     60      1.1  christos 
     61      1.1  christos   /* Define the weak symbols for the API.  */
     62      1.1  christos   void collector_sample () __attribute__ ((weak));
     63      1.1  christos   void collector_pause () __attribute__ ((weak));
     64      1.1  christos   void collector_resume () __attribute__ ((weak));
     65      1.1  christos   void collector_thread_pause () __attribute__ ((weak));
     66      1.1  christos   void collector_thread_resume () __attribute__ ((weak));
     67      1.1  christos   void collector_terminate_expt () __attribute__ ((weak));
     68      1.1  christos   void collector_func_load () __attribute__ ((weak));
     69      1.1  christos   void collector_func_unload () __attribute__ ((weak));
     70      1.1  christos 
     71      1.1  christos #ifdef __cplusplus
     72      1.1  christos }
     73      1.1  christos #endif
     74      1.1  christos 
     75      1.1  christos /* Define the macros that actually get inserted in the caller's code.  */
     76      1.1  christos #define collector_sample(x)	(collector_sample ? collector_sample(x), 0 : 0)
     77      1.1  christos #define collector_pause()	(collector_pause ? collector_pause(), 0 : 0)
     78      1.1  christos #define collector_resume()	(collector_resume ? collector_resume(),0 : 0
     79      1.1  christos #define collector_thread_pause(tid) \
     80      1.1  christos 	(collector_thread_pause ? collector_thread_pause(tid), 0 : 0)
     81      1.1  christos #define collector_thread_resume(tid) \
     82      1.1  christos 	(collector_thread_resume ? collector_thread_resume(tid), 0 : 0)
     83      1.1  christos #define collector_terminate_expt() \
     84      1.1  christos 	(collector_terminate_expt ? collector_terminate_expt(), 0 : 0)
     85      1.1  christos #define collector_func_load(x0,x1,x2,x3,x4,x5,x6) \
     86      1.1  christos 	collector_func_load ? collector_func_load(x0,x1,x2,x3,x4,x5,x6), 0 : 0)
     87      1.1  christos #define collector_func_unload(x) \
     88      1.1  christos 	(collector_func_unload ? collector_func_unload(x), 0 : 0)
     89      1.1  christos #endif /* _LIBCOLLECTOR_H */
     90