xref: /dflybsd-src/usr.bin/flame_graph/flame.h (revision 91dc43dd1215cf13344c65a8f9478bfd31b95814)
1*91dc43ddSMatthew Dillon /*
2*91dc43ddSMatthew Dillon  * Copyright (c) 2020 The DragonFly Project.  All rights reserved.
3*91dc43ddSMatthew Dillon  *
4*91dc43ddSMatthew Dillon  * This code is derived from software contributed to The DragonFly Project
5*91dc43ddSMatthew Dillon  * by Matthew Dillon <dillon@backplane.com>
6*91dc43ddSMatthew Dillon  *
7*91dc43ddSMatthew Dillon  * Redistribution and use in source and binary forms, with or without
8*91dc43ddSMatthew Dillon  * modification, are permitted provided that the following conditions
9*91dc43ddSMatthew Dillon  * are met:
10*91dc43ddSMatthew Dillon  *
11*91dc43ddSMatthew Dillon  * 1. Redistributions of source code must retain the above copyright
12*91dc43ddSMatthew Dillon  *    notice, this list of conditions and the following disclaimer.
13*91dc43ddSMatthew Dillon  * 2. Redistributions in binary form must reproduce the above copyright
14*91dc43ddSMatthew Dillon  *    notice, this list of conditions and the following disclaimer in
15*91dc43ddSMatthew Dillon  *    the documentation and/or other materials provided with the
16*91dc43ddSMatthew Dillon  *    distribution.
17*91dc43ddSMatthew Dillon  * 3. Neither the name of The DragonFly Project nor the names of its
18*91dc43ddSMatthew Dillon  *    contributors may be used to endorse or promote products derived
19*91dc43ddSMatthew Dillon  *    from this software without specific, prior written permission.
20*91dc43ddSMatthew Dillon  *
21*91dc43ddSMatthew Dillon  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22*91dc43ddSMatthew Dillon  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23*91dc43ddSMatthew Dillon  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24*91dc43ddSMatthew Dillon  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
25*91dc43ddSMatthew Dillon  * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26*91dc43ddSMatthew Dillon  * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
27*91dc43ddSMatthew Dillon  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28*91dc43ddSMatthew Dillon  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29*91dc43ddSMatthew Dillon  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30*91dc43ddSMatthew Dillon  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
31*91dc43ddSMatthew Dillon  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32*91dc43ddSMatthew Dillon  * SUCH DAMAGE.
33*91dc43ddSMatthew Dillon  */
34*91dc43ddSMatthew Dillon 
35*91dc43ddSMatthew Dillon #include <sys/types.h>
36*91dc43ddSMatthew Dillon #include <sys/sysctl.h>
37*91dc43ddSMatthew Dillon #include <sys/flame_graph.h>
38*91dc43ddSMatthew Dillon #include <stdio.h>
39*91dc43ddSMatthew Dillon #include <stdlib.h>
40*91dc43ddSMatthew Dillon #include <unistd.h>
41*91dc43ddSMatthew Dillon #include <string.h>
42*91dc43ddSMatthew Dillon #include <time.h>
43*91dc43ddSMatthew Dillon #include <signal.h>
44*91dc43ddSMatthew Dillon 
45*91dc43ddSMatthew Dillon #include "symbols.h"
46*91dc43ddSMatthew Dillon 
47*91dc43ddSMatthew Dillon void flame_collect_loop(void);
48*91dc43ddSMatthew Dillon void flame_process_loop(void);
49