Debian Codegraph @

src/libsysprof-capture/sysprof-capture-reader.h

raw
1 /* sysprof-capture-reader.h
2 *
3 * Copyright 2016-2019 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 <stdbool.h>
60
61 #include "sysprof-capture-types.h"
62 #include "sysprof-macros.h"
63 #include "sysprof-version-macros.h"
64
65 SYSPROF_BEGIN_DECLS
66
67 SYSPROF_AVAILABLE_IN_ALL
68 SysprofCaptureReader *sysprof_capture_reader_new (const char *filename);
69 SYSPROF_AVAILABLE_IN_ALL
70 SysprofCaptureReader *sysprof_capture_reader_new_from_fd (int fd);
71 SYSPROF_AVAILABLE_IN_ALL
72 SysprofCaptureReader *sysprof_capture_reader_copy (SysprofCaptureReader *self);
73 SYSPROF_AVAILABLE_IN_ALL
74 SysprofCaptureReader *sysprof_capture_reader_ref (SysprofCaptureReader *self);
75 SYSPROF_AVAILABLE_IN_ALL
76 void sysprof_capture_reader_unref (SysprofCaptureReader *self);
77 SYSPROF_AVAILABLE_IN_ALL
78 int sysprof_capture_reader_get_byte_order (SysprofCaptureReader *self);
79 SYSPROF_AVAILABLE_IN_ALL
80 const char *sysprof_capture_reader_get_filename (SysprofCaptureReader *self);
81 SYSPROF_AVAILABLE_IN_ALL
82 const char *sysprof_capture_reader_get_time (SysprofCaptureReader *self);
83 SYSPROF_AVAILABLE_IN_ALL
84 int64_t sysprof_capture_reader_get_start_time (SysprofCaptureReader *self);
85 SYSPROF_AVAILABLE_IN_ALL
86 int64_t sysprof_capture_reader_get_end_time (SysprofCaptureReader *self);
87 SYSPROF_AVAILABLE_IN_ALL
88 bool sysprof_capture_reader_skip (SysprofCaptureReader *self);
89 SYSPROF_AVAILABLE_IN_ALL
90 bool sysprof_capture_reader_peek_type (SysprofCaptureReader *self,
91 SysprofCaptureFrameType *type);
92 SYSPROF_AVAILABLE_IN_ALL
93 bool sysprof_capture_reader_peek_frame (SysprofCaptureReader *self,
94 SysprofCaptureFrame *frame);
95 SYSPROF_AVAILABLE_IN_ALL
96 const SysprofCaptureLog *sysprof_capture_reader_read_log (SysprofCaptureReader *self);
97 SYSPROF_AVAILABLE_IN_ALL
98 const SysprofCaptureMap *sysprof_capture_reader_read_map (SysprofCaptureReader *self);
99 SYSPROF_AVAILABLE_IN_ALL
100 const SysprofCaptureMark *sysprof_capture_reader_read_mark (SysprofCaptureReader *self);
101 SYSPROF_AVAILABLE_IN_ALL
102 const SysprofCaptureMetadata *sysprof_capture_reader_read_metadata (SysprofCaptureReader *self);
103 SYSPROF_AVAILABLE_IN_ALL
104 const SysprofCaptureDBusMessage *sysprof_capture_reader_read_dbus_message (SysprofCaptureReader *self);
105 SYSPROF_AVAILABLE_IN_ALL
106 const SysprofCaptureExit *sysprof_capture_reader_read_exit (SysprofCaptureReader *self);
107 SYSPROF_AVAILABLE_IN_ALL
108 const SysprofCaptureFork *sysprof_capture_reader_read_fork (SysprofCaptureReader *self);
109 SYSPROF_AVAILABLE_IN_ALL
110 const SysprofCaptureTimestamp *sysprof_capture_reader_read_timestamp (SysprofCaptureReader *self);
111 SYSPROF_AVAILABLE_IN_ALL
112 const SysprofCaptureProcess *sysprof_capture_reader_read_process (SysprofCaptureReader *self);
113 SYSPROF_AVAILABLE_IN_ALL
114 const SysprofCaptureSample *sysprof_capture_reader_read_sample (SysprofCaptureReader *self);
115 SYSPROF_AVAILABLE_IN_ALL
116 const SysprofCaptureTrace *sysprof_capture_reader_read_trace (SysprofCaptureReader *self);
117 SYSPROF_AVAILABLE_IN_ALL
118 const SysprofCaptureJitmap *sysprof_capture_reader_read_jitmap (SysprofCaptureReader *self);
119 SYSPROF_AVAILABLE_IN_ALL
120 const SysprofCaptureCounterDefine *sysprof_capture_reader_read_counter_define (SysprofCaptureReader *self);
121 SYSPROF_AVAILABLE_IN_ALL
122 const SysprofCaptureCounterSet *sysprof_capture_reader_read_counter_set (SysprofCaptureReader *self);
123 SYSPROF_AVAILABLE_IN_ALL
124 const SysprofCaptureFileChunk *sysprof_capture_reader_read_file (SysprofCaptureReader *self);
125 SYSPROF_AVAILABLE_IN_3_36
126 const SysprofCaptureAllocation *sysprof_capture_reader_read_allocation (SysprofCaptureReader *self);
127 SYSPROF_AVAILABLE_IN_3_40
128 const SysprofCaptureOverlay *sysprof_capture_reader_read_overlay (SysprofCaptureReader *self);
129 SYSPROF_AVAILABLE_IN_ALL
130 bool sysprof_capture_reader_reset (SysprofCaptureReader *self);
131 SYSPROF_AVAILABLE_IN_ALL
132 bool sysprof_capture_reader_splice (SysprofCaptureReader *self,
133 SysprofCaptureWriter *dest);
134 SYSPROF_AVAILABLE_IN_ALL
135 bool sysprof_capture_reader_save_as (SysprofCaptureReader *self,
136 const char *filename);
137 SYSPROF_AVAILABLE_IN_ALL
138 bool sysprof_capture_reader_get_stat (SysprofCaptureReader *self,
139 SysprofCaptureStat *st_buf);
140 SYSPROF_AVAILABLE_IN_ALL
141 void sysprof_capture_reader_set_stat (SysprofCaptureReader *self,
142 const SysprofCaptureStat *st_buf);
143 SYSPROF_AVAILABLE_IN_ALL
144 const SysprofCaptureFileChunk *sysprof_capture_reader_find_file (SysprofCaptureReader *self,
145 const char *path);
146 SYSPROF_AVAILABLE_IN_ALL
147 const char **sysprof_capture_reader_list_files (SysprofCaptureReader *self);
148 SYSPROF_AVAILABLE_IN_ALL
149 bool sysprof_capture_reader_read_file_fd (SysprofCaptureReader *self,
150 const char *path,
151 int fd);
152
153 typedef struct {
154 /*< private >*/
155 void *p1;
156 void *p2;
157 unsigned int u1;
158 void *p3;
159 void *p4;
160 } SysprofCaptureJitmapIter;
161
162 SYSPROF_AVAILABLE_IN_3_38
163 void sysprof_capture_jitmap_iter_init (SysprofCaptureJitmapIter *iter,
164 const SysprofCaptureJitmap *jitmap);
165 SYSPROF_AVAILABLE_IN_3_38
166 bool sysprof_capture_jitmap_iter_next (SysprofCaptureJitmapIter *iter,
167 SysprofCaptureAddress *addr,
168 const char **path);
169
170 SYSPROF_END_DECLS