Debian Codegraph @

src/libsysprof-capture/sysprof-collector.h

raw
1 /* sysprof-collector.h
2 *
3 * Copyright 2020 Christian Hergert <[email protected]>
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met:
8 *
9 * 1. Redistributions of source code must retain the above copyright notice,
10 * this list of conditions and the following disclaimer.
11 *
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * Subject to the terms and conditions of this license, each copyright holder
17 * and contributor hereby grants to those receiving rights under this license
18 * a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
19 * irrevocable (except for failure to satisfy the conditions of this license)
20 * patent license to make, have made, use, offer to sell, sell, import, and
21 * otherwise transfer this software, where such license applies only to those
22 * patent claims, already acquired or hereafter acquired, licensable by such
23 * copyright holder or contributor that are necessarily infringed by:
24 *
25 * (a) their Contribution(s) (the licensed copyrights of copyright holders
26 * and non-copyrightable additions of contributors, in source or binary
27 * form) alone; or
28 *
29 * (b) combination of their Contribution(s) with the work of authorship to
30 * which such Contribution(s) was added by such copyright holder or
31 * contributor, if, at the time the Contribution is added, such addition
32 * causes such combination to be necessarily infringed. The patent license
33 * shall not apply to any other combinations which include the
34 * Contribution.
35 *
36 * Except as expressly stated above, no rights or licenses from any copyright
37 * holder or contributor is granted under this license, whether expressly, by
38 * implication, estoppel or otherwise.
39 *
40 * DISCLAIMER
41 *
42 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
43 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
44 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
45 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
46 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
47 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
48 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
49 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
50 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
51 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
52 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
53 *
54 * SPDX-License-Identifier: BSD-2-Clause-Patent
55 */
56
57 #pragma once
58
59 #include <stdarg.h>
60
61 #include "sysprof-capture-types.h"
62 #include "sysprof-macros.h"
63
64 SYSPROF_BEGIN_DECLS
65
66 SYSPROF_AVAILABLE_IN_3_36
67 void sysprof_collector_init (void);
68 SYSPROF_AVAILABLE_IN_3_38
69 bool sysprof_collector_is_active (void);
70 SYSPROF_AVAILABLE_IN_3_36
71 void sysprof_collector_allocate (SysprofCaptureAddress alloc_addr,
72 int64_t alloc_size,
73 SysprofBacktraceFunc backtrace_func,
74 void *backtrace_data);
75 SYSPROF_AVAILABLE_IN_3_36
76 void sysprof_collector_sample (SysprofBacktraceFunc backtrace_func,
77 void *backtrace_data);
78 SYSPROF_AVAILABLE_IN_ALL
79 void sysprof_collector_trace (SysprofBacktraceFunc backtrace_func,
80 void *backtrace_data,
81 bool entering);
82 SYSPROF_AVAILABLE_IN_3_36
83 void sysprof_collector_mark (int64_t time,
84 int64_t duration,
85 const char *group,
86 const char *mark,
87 const char *message);
88 SYSPROF_AVAILABLE_IN_3_38
89 void sysprof_collector_mark_printf (int64_t time,
90 int64_t duration,
91 const char *group,
92 const char *mark,
93 const char *message_format,
94 ...) SYSPROF_PRINTF(5, 6);
95 SYSPROF_AVAILABLE_IN_3_38
96 void sysprof_collector_mark_vprintf (int64_t time,
97 int64_t duration,
98 const char *group,
99 const char *mark,
100 const char *message_format,
101 va_list args) SYSPROF_PRINTF(5, 0);
102 SYSPROF_AVAILABLE_IN_3_36
103 void sysprof_collector_log (int severity,
104 const char *domain,
105 const char *message);
106 SYSPROF_AVAILABLE_IN_3_38
107 void sysprof_collector_log_printf (int severity,
108 const char *domain,
109 const char *format,
110 ...) SYSPROF_PRINTF (3, 4);
111 SYSPROF_AVAILABLE_IN_3_38
112 unsigned int sysprof_collector_request_counters (unsigned int n_counters);
113 SYSPROF_AVAILABLE_IN_3_38
114 void sysprof_collector_define_counters (const SysprofCaptureCounter *counters,
115 unsigned int n_counters);
116 SYSPROF_AVAILABLE_IN_3_38
117 void sysprof_collector_set_counters (const unsigned int *counters_ids,
118 const SysprofCaptureCounterValue *values,
119 unsigned int n_counters);
120
121 SYSPROF_END_DECLS