libddprof 0.5.0.1.0.beta1 → 0.6.0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/lib/libddprof/version.rb +2 -2
  3. data/lib/libddprof.rb +0 -5
  4. data/vendor/libddprof-0.6.0/aarch64-linux/libddprof-aarch64-unknown-linux-gnu/LICENSE +202 -0
  5. data/vendor/libddprof-0.6.0/aarch64-linux/libddprof-aarch64-unknown-linux-gnu/LICENSE-3rdparty.yml +1009 -0
  6. data/vendor/libddprof-0.6.0/aarch64-linux/libddprof-aarch64-unknown-linux-gnu/NOTICE +4 -0
  7. data/vendor/libddprof-0.6.0/aarch64-linux/libddprof-aarch64-unknown-linux-gnu/include/ddprof/ffi.h +555 -0
  8. data/vendor/libddprof-0.6.0/aarch64-linux/libddprof-aarch64-unknown-linux-gnu/lib/libddprof_ffi.so +0 -0
  9. data/vendor/libddprof-0.6.0/aarch64-linux/libddprof-aarch64-unknown-linux-gnu/lib/pkgconfig/ddprof_ffi_with_rpath.pc +17 -0
  10. data/vendor/libddprof-0.6.0/aarch64-linux-musl/libddprof-aarch64-alpine-linux-musl/LICENSE +202 -0
  11. data/vendor/libddprof-0.6.0/aarch64-linux-musl/libddprof-aarch64-alpine-linux-musl/LICENSE-3rdparty.yml +1009 -0
  12. data/vendor/libddprof-0.6.0/aarch64-linux-musl/libddprof-aarch64-alpine-linux-musl/NOTICE +4 -0
  13. data/vendor/libddprof-0.6.0/aarch64-linux-musl/libddprof-aarch64-alpine-linux-musl/include/ddprof/ffi.h +555 -0
  14. data/vendor/libddprof-0.6.0/aarch64-linux-musl/libddprof-aarch64-alpine-linux-musl/lib/libddprof_ffi.so +0 -0
  15. data/vendor/libddprof-0.6.0/aarch64-linux-musl/libddprof-aarch64-alpine-linux-musl/lib/pkgconfig/ddprof_ffi_with_rpath.pc +17 -0
  16. data/vendor/libddprof-0.6.0/x86_64-linux/libddprof-x86_64-unknown-linux-gnu/LICENSE +202 -0
  17. data/vendor/libddprof-0.6.0/x86_64-linux/libddprof-x86_64-unknown-linux-gnu/LICENSE-3rdparty.yml +1009 -0
  18. data/vendor/libddprof-0.6.0/x86_64-linux/libddprof-x86_64-unknown-linux-gnu/NOTICE +4 -0
  19. data/vendor/libddprof-0.6.0/x86_64-linux/libddprof-x86_64-unknown-linux-gnu/include/ddprof/ffi.h +555 -0
  20. data/vendor/libddprof-0.6.0/x86_64-linux/libddprof-x86_64-unknown-linux-gnu/lib/libddprof_ffi.so +0 -0
  21. data/vendor/libddprof-0.6.0/x86_64-linux/libddprof-x86_64-unknown-linux-gnu/lib/pkgconfig/ddprof_ffi_with_rpath.pc +17 -0
  22. data/vendor/libddprof-0.6.0/x86_64-linux-musl/libddprof-x86_64-alpine-linux-musl/LICENSE +202 -0
  23. data/vendor/libddprof-0.6.0/x86_64-linux-musl/libddprof-x86_64-alpine-linux-musl/LICENSE-3rdparty.yml +1009 -0
  24. data/vendor/libddprof-0.6.0/x86_64-linux-musl/libddprof-x86_64-alpine-linux-musl/NOTICE +4 -0
  25. data/vendor/libddprof-0.6.0/x86_64-linux-musl/libddprof-x86_64-alpine-linux-musl/include/ddprof/ffi.h +555 -0
  26. data/vendor/libddprof-0.6.0/x86_64-linux-musl/libddprof-x86_64-alpine-linux-musl/lib/libddprof_ffi.so +0 -0
  27. data/vendor/libddprof-0.6.0/x86_64-linux-musl/libddprof-x86_64-alpine-linux-musl/lib/pkgconfig/ddprof_ffi_with_rpath.pc +17 -0
  28. metadata +28 -4
@@ -0,0 +1,4 @@
1
+ Datadog libddprof
2
+ Copyright 2021 Datadog, Inc.
3
+
4
+ This product includes software developed at Datadog (<https://www.datadoghq.com/>).
@@ -0,0 +1,555 @@
1
+ // Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
2
+ // This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2021-Present Datadog, Inc.
3
+
4
+
5
+ #ifndef DDPROF_FFI_H
6
+ #define DDPROF_FFI_H
7
+
8
+ #include <stdbool.h>
9
+ #include <stddef.h>
10
+ #include <stdint.h>
11
+
12
+ #define DDPROF_FFI_CHARSLICE_C(string) \
13
+ /* NOTE: Compilation fails if you pass in a char* instead of a literal */ ((ddprof_ffi_CharSlice) {.ptr = "" string, .len = sizeof(string) - 1})
14
+
15
+ typedef struct ddprof_ffi_CancellationToken ddprof_ffi_CancellationToken;
16
+
17
+ typedef struct ddprof_ffi_Profile ddprof_ffi_Profile;
18
+
19
+ typedef struct ddprof_ffi_ProfileExporterV3 ddprof_ffi_ProfileExporterV3;
20
+
21
+ /**
22
+ * This type only exists to workaround a bug in cbindgen; may be removed in the
23
+ * future.
24
+ */
25
+ typedef struct ddprof_ffi_Request ddprof_ffi_Request;
26
+
27
+ typedef struct ddprof_ffi_Tag ddprof_ffi_Tag;
28
+
29
+ /**
30
+ * Holds the raw parts of a Rust Vec; it should only be created from Rust,
31
+ * never from C.
32
+ * The names ptr and len were chosen to minimize conversion from a previous
33
+ * Buffer type which this has replaced to become more general.
34
+ */
35
+ typedef struct ddprof_ffi_Vec_u8 {
36
+ const uint8_t *ptr;
37
+ uintptr_t len;
38
+ uintptr_t capacity;
39
+ } ddprof_ffi_Vec_u8;
40
+
41
+ typedef enum ddprof_ffi_NewProfileExporterV3Result_Tag {
42
+ DDPROF_FFI_NEW_PROFILE_EXPORTER_V3_RESULT_OK,
43
+ DDPROF_FFI_NEW_PROFILE_EXPORTER_V3_RESULT_ERR,
44
+ } ddprof_ffi_NewProfileExporterV3Result_Tag;
45
+
46
+ typedef struct ddprof_ffi_NewProfileExporterV3Result {
47
+ ddprof_ffi_NewProfileExporterV3Result_Tag tag;
48
+ union {
49
+ struct {
50
+ struct ddprof_ffi_ProfileExporterV3 *ok;
51
+ };
52
+ struct {
53
+ struct ddprof_ffi_Vec_u8 err;
54
+ };
55
+ };
56
+ } ddprof_ffi_NewProfileExporterV3Result;
57
+
58
+ /**
59
+ * Remember, the data inside of each member is potentially coming from FFI,
60
+ * so every operation on it is unsafe!
61
+ */
62
+ typedef struct ddprof_ffi_Slice_c_char {
63
+ const char *ptr;
64
+ uintptr_t len;
65
+ } ddprof_ffi_Slice_c_char;
66
+
67
+ typedef struct ddprof_ffi_Slice_c_char ddprof_ffi_CharSlice;
68
+
69
+ typedef enum ddprof_ffi_EndpointV3_Tag {
70
+ DDPROF_FFI_ENDPOINT_V3_AGENT,
71
+ DDPROF_FFI_ENDPOINT_V3_AGENTLESS,
72
+ } ddprof_ffi_EndpointV3_Tag;
73
+
74
+ typedef struct ddprof_ffi_EndpointV3_ddprof_ffi_Agentless_Body {
75
+ ddprof_ffi_CharSlice _0;
76
+ ddprof_ffi_CharSlice _1;
77
+ } ddprof_ffi_EndpointV3_ddprof_ffi_Agentless_Body;
78
+
79
+ typedef struct ddprof_ffi_EndpointV3 {
80
+ ddprof_ffi_EndpointV3_Tag tag;
81
+ union {
82
+ struct {
83
+ ddprof_ffi_CharSlice agent;
84
+ };
85
+ ddprof_ffi_EndpointV3_ddprof_ffi_Agentless_Body AGENTLESS;
86
+ };
87
+ } ddprof_ffi_EndpointV3;
88
+
89
+ /**
90
+ * Holds the raw parts of a Rust Vec; it should only be created from Rust,
91
+ * never from C.
92
+ * The names ptr and len were chosen to minimize conversion from a previous
93
+ * Buffer type which this has replaced to become more general.
94
+ */
95
+ typedef struct ddprof_ffi_Vec_tag {
96
+ const struct ddprof_ffi_Tag *ptr;
97
+ uintptr_t len;
98
+ uintptr_t capacity;
99
+ } ddprof_ffi_Vec_tag;
100
+
101
+ /**
102
+ * Represents time since the Unix Epoch in seconds plus nanoseconds.
103
+ */
104
+ typedef struct ddprof_ffi_Timespec {
105
+ int64_t seconds;
106
+ uint32_t nanoseconds;
107
+ } ddprof_ffi_Timespec;
108
+
109
+ /**
110
+ * Remember, the data inside of each member is potentially coming from FFI,
111
+ * so every operation on it is unsafe!
112
+ */
113
+ typedef struct ddprof_ffi_Slice_u8 {
114
+ const uint8_t *ptr;
115
+ uintptr_t len;
116
+ } ddprof_ffi_Slice_u8;
117
+
118
+ /**
119
+ * Use to represent bytes -- does not need to be valid UTF-8.
120
+ */
121
+ typedef struct ddprof_ffi_Slice_u8 ddprof_ffi_ByteSlice;
122
+
123
+ typedef struct ddprof_ffi_File {
124
+ ddprof_ffi_CharSlice name;
125
+ ddprof_ffi_ByteSlice file;
126
+ } ddprof_ffi_File;
127
+
128
+ /**
129
+ * Remember, the data inside of each member is potentially coming from FFI,
130
+ * so every operation on it is unsafe!
131
+ */
132
+ typedef struct ddprof_ffi_Slice_file {
133
+ const struct ddprof_ffi_File *ptr;
134
+ uintptr_t len;
135
+ } ddprof_ffi_Slice_file;
136
+
137
+ typedef struct ddprof_ffi_HttpStatus {
138
+ uint16_t code;
139
+ } ddprof_ffi_HttpStatus;
140
+
141
+ typedef enum ddprof_ffi_SendResult_Tag {
142
+ DDPROF_FFI_SEND_RESULT_HTTP_RESPONSE,
143
+ DDPROF_FFI_SEND_RESULT_FAILURE,
144
+ } ddprof_ffi_SendResult_Tag;
145
+
146
+ typedef struct ddprof_ffi_SendResult {
147
+ ddprof_ffi_SendResult_Tag tag;
148
+ union {
149
+ struct {
150
+ struct ddprof_ffi_HttpStatus http_response;
151
+ };
152
+ struct {
153
+ struct ddprof_ffi_Vec_u8 failure;
154
+ };
155
+ };
156
+ } ddprof_ffi_SendResult;
157
+
158
+ typedef struct ddprof_ffi_ValueType {
159
+ ddprof_ffi_CharSlice type_;
160
+ ddprof_ffi_CharSlice unit;
161
+ } ddprof_ffi_ValueType;
162
+
163
+ /**
164
+ * Remember, the data inside of each member is potentially coming from FFI,
165
+ * so every operation on it is unsafe!
166
+ */
167
+ typedef struct ddprof_ffi_Slice_value_type {
168
+ const struct ddprof_ffi_ValueType *ptr;
169
+ uintptr_t len;
170
+ } ddprof_ffi_Slice_value_type;
171
+
172
+ typedef struct ddprof_ffi_Period {
173
+ struct ddprof_ffi_ValueType type_;
174
+ int64_t value;
175
+ } ddprof_ffi_Period;
176
+
177
+ typedef struct ddprof_ffi_Mapping {
178
+ /**
179
+ * Address at which the binary (or DLL) is loaded into memory.
180
+ */
181
+ uint64_t memory_start;
182
+ /**
183
+ * The limit of the address range occupied by this mapping.
184
+ */
185
+ uint64_t memory_limit;
186
+ /**
187
+ * Offset in the binary that corresponds to the first mapped address.
188
+ */
189
+ uint64_t file_offset;
190
+ /**
191
+ * The object this entry is loaded from. This can be a filename on
192
+ * disk for the main binary and shared libraries, or virtual
193
+ * abstractions like "[vdso]".
194
+ */
195
+ ddprof_ffi_CharSlice filename;
196
+ /**
197
+ * A string that uniquely identifies a particular program version
198
+ * with high probability. E.g., for binaries generated by GNU tools,
199
+ * it could be the contents of the .note.gnu.build-id field.
200
+ */
201
+ ddprof_ffi_CharSlice build_id;
202
+ } ddprof_ffi_Mapping;
203
+
204
+ typedef struct ddprof_ffi_Function {
205
+ /**
206
+ * Name of the function, in human-readable form if available.
207
+ */
208
+ ddprof_ffi_CharSlice name;
209
+ /**
210
+ * Name of the function, as identified by the system.
211
+ * For instance, it can be a C++ mangled name.
212
+ */
213
+ ddprof_ffi_CharSlice system_name;
214
+ /**
215
+ * Source file containing the function.
216
+ */
217
+ ddprof_ffi_CharSlice filename;
218
+ /**
219
+ * Line number in source file.
220
+ */
221
+ int64_t start_line;
222
+ } ddprof_ffi_Function;
223
+
224
+ typedef struct ddprof_ffi_Line {
225
+ /**
226
+ * The corresponding profile.Function for this line.
227
+ */
228
+ struct ddprof_ffi_Function function;
229
+ /**
230
+ * Line number in source code.
231
+ */
232
+ int64_t line;
233
+ } ddprof_ffi_Line;
234
+
235
+ /**
236
+ * Remember, the data inside of each member is potentially coming from FFI,
237
+ * so every operation on it is unsafe!
238
+ */
239
+ typedef struct ddprof_ffi_Slice_line {
240
+ const struct ddprof_ffi_Line *ptr;
241
+ uintptr_t len;
242
+ } ddprof_ffi_Slice_line;
243
+
244
+ typedef struct ddprof_ffi_Location {
245
+ /**
246
+ * todo: how to handle unknown mapping?
247
+ */
248
+ struct ddprof_ffi_Mapping mapping;
249
+ /**
250
+ * The instruction address for this location, if available. It
251
+ * should be within [Mapping.memory_start...Mapping.memory_limit]
252
+ * for the corresponding mapping. A non-leaf address may be in the
253
+ * middle of a call instruction. It is up to display tools to find
254
+ * the beginning of the instruction if necessary.
255
+ */
256
+ uint64_t address;
257
+ /**
258
+ * Multiple line indicates this location has inlined functions,
259
+ * where the last entry represents the caller into which the
260
+ * preceding entries were inlined.
261
+ *
262
+ * E.g., if memcpy() is inlined into printf:
263
+ * line[0].function_name == "memcpy"
264
+ * line[1].function_name == "printf"
265
+ */
266
+ struct ddprof_ffi_Slice_line lines;
267
+ /**
268
+ * Provides an indication that multiple symbols map to this location's
269
+ * address, for example due to identical code folding by the linker. In that
270
+ * case the line information above represents one of the multiple
271
+ * symbols. This field must be recomputed when the symbolization state of the
272
+ * profile changes.
273
+ */
274
+ bool is_folded;
275
+ } ddprof_ffi_Location;
276
+
277
+ /**
278
+ * Remember, the data inside of each member is potentially coming from FFI,
279
+ * so every operation on it is unsafe!
280
+ */
281
+ typedef struct ddprof_ffi_Slice_location {
282
+ const struct ddprof_ffi_Location *ptr;
283
+ uintptr_t len;
284
+ } ddprof_ffi_Slice_location;
285
+
286
+ /**
287
+ * Remember, the data inside of each member is potentially coming from FFI,
288
+ * so every operation on it is unsafe!
289
+ */
290
+ typedef struct ddprof_ffi_Slice_i64 {
291
+ const int64_t *ptr;
292
+ uintptr_t len;
293
+ } ddprof_ffi_Slice_i64;
294
+
295
+ typedef struct ddprof_ffi_Label {
296
+ ddprof_ffi_CharSlice key;
297
+ /**
298
+ * At most one of the following must be present
299
+ */
300
+ ddprof_ffi_CharSlice str;
301
+ int64_t num;
302
+ /**
303
+ * Should only be present when num is present.
304
+ * Specifies the units of num.
305
+ * Use arbitrary string (for example, "requests") as a custom count unit.
306
+ * If no unit is specified, consumer may apply heuristic to deduce the unit.
307
+ * Consumers may also interpret units like "bytes" and "kilobytes" as memory
308
+ * units and units like "seconds" and "nanoseconds" as time units,
309
+ * and apply appropriate unit conversions to these.
310
+ */
311
+ ddprof_ffi_CharSlice num_unit;
312
+ } ddprof_ffi_Label;
313
+
314
+ /**
315
+ * Remember, the data inside of each member is potentially coming from FFI,
316
+ * so every operation on it is unsafe!
317
+ */
318
+ typedef struct ddprof_ffi_Slice_label {
319
+ const struct ddprof_ffi_Label *ptr;
320
+ uintptr_t len;
321
+ } ddprof_ffi_Slice_label;
322
+
323
+ typedef struct ddprof_ffi_Sample {
324
+ /**
325
+ * The leaf is at locations[0].
326
+ */
327
+ struct ddprof_ffi_Slice_location locations;
328
+ /**
329
+ * The type and unit of each value is defined by the corresponding
330
+ * entry in Profile.sample_type. All samples must have the same
331
+ * number of values, the same as the length of Profile.sample_type.
332
+ * When aggregating multiple samples into a single sample, the
333
+ * result has a list of values that is the element-wise sum of the
334
+ * lists of the originals.
335
+ */
336
+ struct ddprof_ffi_Slice_i64 values;
337
+ /**
338
+ * label includes additional context for this sample. It can include
339
+ * things like a thread id, allocation size, etc
340
+ */
341
+ struct ddprof_ffi_Slice_label labels;
342
+ } ddprof_ffi_Sample;
343
+
344
+ typedef struct ddprof_ffi_EncodedProfile {
345
+ struct ddprof_ffi_Timespec start;
346
+ struct ddprof_ffi_Timespec end;
347
+ struct ddprof_ffi_Vec_u8 buffer;
348
+ } ddprof_ffi_EncodedProfile;
349
+
350
+ typedef enum ddprof_ffi_SerializeResult_Tag {
351
+ DDPROF_FFI_SERIALIZE_RESULT_OK,
352
+ DDPROF_FFI_SERIALIZE_RESULT_ERR,
353
+ } ddprof_ffi_SerializeResult_Tag;
354
+
355
+ typedef struct ddprof_ffi_SerializeResult {
356
+ ddprof_ffi_SerializeResult_Tag tag;
357
+ union {
358
+ struct {
359
+ struct ddprof_ffi_EncodedProfile ok;
360
+ };
361
+ struct {
362
+ struct ddprof_ffi_Vec_u8 err;
363
+ };
364
+ };
365
+ } ddprof_ffi_SerializeResult;
366
+
367
+ typedef enum ddprof_ffi_PushTagResult_Tag {
368
+ DDPROF_FFI_PUSH_TAG_RESULT_OK,
369
+ DDPROF_FFI_PUSH_TAG_RESULT_ERR,
370
+ } ddprof_ffi_PushTagResult_Tag;
371
+
372
+ typedef struct ddprof_ffi_PushTagResult {
373
+ ddprof_ffi_PushTagResult_Tag tag;
374
+ union {
375
+ struct {
376
+ struct ddprof_ffi_Vec_u8 err;
377
+ };
378
+ };
379
+ } ddprof_ffi_PushTagResult;
380
+
381
+ typedef struct ddprof_ffi_ParseTagsResult {
382
+ struct ddprof_ffi_Vec_tag tags;
383
+ struct ddprof_ffi_Vec_u8 *error_message;
384
+ } ddprof_ffi_ParseTagsResult;
385
+
386
+ void ddprof_ffi_NewProfileExporterV3Result_drop(struct ddprof_ffi_NewProfileExporterV3Result result);
387
+
388
+ /**
389
+ * Creates an endpoint that uses the agent.
390
+ * # Arguments
391
+ * * `base_url` - Contains a URL with scheme, host, and port e.g. "https://agent:8126/".
392
+ */
393
+ struct ddprof_ffi_EndpointV3 ddprof_ffi_EndpointV3_agent(ddprof_ffi_CharSlice base_url);
394
+
395
+ /**
396
+ * Creates an endpoint that uses the Datadog intake directly aka agentless.
397
+ * # Arguments
398
+ * * `site` - Contains a host and port e.g. "datadoghq.com".
399
+ * * `api_key` - Contains the Datadog API key.
400
+ */
401
+ struct ddprof_ffi_EndpointV3 ddprof_ffi_EndpointV3_agentless(ddprof_ffi_CharSlice site,
402
+ ddprof_ffi_CharSlice api_key);
403
+
404
+ __attribute__((warn_unused_result))
405
+ struct ddprof_ffi_NewProfileExporterV3Result ddprof_ffi_ProfileExporterV3_new(ddprof_ffi_CharSlice family,
406
+ const struct ddprof_ffi_Vec_tag *tags,
407
+ struct ddprof_ffi_EndpointV3 endpoint);
408
+
409
+ void ddprof_ffi_ProfileExporterV3_delete(struct ddprof_ffi_ProfileExporterV3 *exporter);
410
+
411
+ /**
412
+ * Builds a Request object based on the profile data supplied.
413
+ *
414
+ * # Safety
415
+ * The `exporter` and the files inside of the `files` slice need to have been
416
+ * created by this module.
417
+ */
418
+ struct ddprof_ffi_Request *ddprof_ffi_ProfileExporterV3_build(struct ddprof_ffi_ProfileExporterV3 *exporter,
419
+ struct ddprof_ffi_Timespec start,
420
+ struct ddprof_ffi_Timespec end,
421
+ struct ddprof_ffi_Slice_file files,
422
+ const struct ddprof_ffi_Vec_tag *additional_tags,
423
+ uint64_t timeout_ms);
424
+
425
+ /**
426
+ * Sends the request, returning the HttpStatus.
427
+ *
428
+ * # Arguments
429
+ * * `exporter` - borrows the exporter for sending the request
430
+ * * `request` - takes ownership of the request
431
+ * * `cancel` - borrows the cancel, if any
432
+ *
433
+ * # Safety
434
+ * All non-null arguments MUST have been created by created by apis in this module.
435
+ */
436
+ __attribute__((warn_unused_result))
437
+ struct ddprof_ffi_SendResult ddprof_ffi_ProfileExporterV3_send(struct ddprof_ffi_ProfileExporterV3 *exporter,
438
+ struct ddprof_ffi_Request *request,
439
+ struct ddprof_ffi_CancellationToken *cancel);
440
+
441
+ /**
442
+ * Can be passed as an argument to send and then be used to asynchronously cancel it from a different thread.
443
+ */
444
+ __attribute__((warn_unused_result))
445
+ struct ddprof_ffi_CancellationToken *ddprof_ffi_CancellationToken_new(void);
446
+
447
+ /**
448
+ * A cloned CancellationToken is connected to the CancellationToken it was created from.
449
+ * Either the cloned or the original token can be used to cancel or provided as arguments to send.
450
+ * The useful part is that they have independent lifetimes and can be dropped separately.
451
+ *
452
+ * Thus, it's possible to do something like:
453
+ * ```c
454
+ * cancel_t1 = ddprof_ffi_CancellationToken_new();
455
+ * cancel_t2 = ddprof_ffi_CancellationToken_clone(cancel_t1);
456
+ *
457
+ * // On thread t1:
458
+ * ddprof_ffi_ProfileExporterV3_send(..., cancel_t1);
459
+ * ddprof_ffi_CancellationToken_drop(cancel_t1);
460
+ *
461
+ * // On thread t2:
462
+ * ddprof_ffi_CancellationToken_cancel(cancel_t2);
463
+ * ddprof_ffi_CancellationToken_drop(cancel_t2);
464
+ * ```
465
+ *
466
+ * Without clone, both t1 and t2 would need to synchronize to make sure neither was using the cancel
467
+ * before it could be dropped. With clone, there is no need for such synchronization, both threads
468
+ * have their own cancel and should drop that cancel after they are done with it.
469
+ */
470
+ __attribute__((warn_unused_result))
471
+ struct ddprof_ffi_CancellationToken *ddprof_ffi_CancellationToken_clone(struct ddprof_ffi_CancellationToken *cancel);
472
+
473
+ /**
474
+ * Cancel send that is being called in another thread with the given token.
475
+ * Note that cancellation is a terminal state; cancelling a token more than once does nothing.
476
+ * Returns `true` if token was successfully cancelled.
477
+ */
478
+ bool ddprof_ffi_CancellationToken_cancel(struct ddprof_ffi_CancellationToken *cancel);
479
+
480
+ void ddprof_ffi_CancellationToken_drop(struct ddprof_ffi_CancellationToken *_cancel);
481
+
482
+ void ddprof_ffi_SendResult_drop(struct ddprof_ffi_SendResult result);
483
+
484
+ /**
485
+ * Create a new profile with the given sample types. Must call
486
+ * `ddprof_ffi_Profile_free` when you are done with the profile.
487
+ * # Safety
488
+ * All slices must be have pointers that are suitably aligned for their type
489
+ * and must have the correct number of elements for the slice.
490
+ */
491
+ __attribute__((warn_unused_result))
492
+ struct ddprof_ffi_Profile *ddprof_ffi_Profile_new(struct ddprof_ffi_Slice_value_type sample_types,
493
+ const struct ddprof_ffi_Period *period);
494
+
495
+ /**
496
+ * # Safety
497
+ * The `profile` must point to an object created by another FFI routine in this
498
+ * module, such as `ddprof_ffi_Profile_with_sample_types`.
499
+ */
500
+ void ddprof_ffi_Profile_free(struct ddprof_ffi_Profile *profile);
501
+
502
+ /**
503
+ * # Safety
504
+ * The `profile` ptr must point to a valid Profile object created by this
505
+ * module. All pointers inside the `sample` need to be valid for the duration
506
+ * of this call.
507
+ * This call is _NOT_ thread-safe.
508
+ */
509
+ uint64_t ddprof_ffi_Profile_add(struct ddprof_ffi_Profile *profile,
510
+ struct ddprof_ffi_Sample sample);
511
+
512
+ /**
513
+ * Serialize the aggregated profile. Don't forget to clean up the result by
514
+ * calling ddprof_ffi_SerializeResult_drop.
515
+ */
516
+ __attribute__((warn_unused_result))
517
+ struct ddprof_ffi_SerializeResult ddprof_ffi_Profile_serialize(const struct ddprof_ffi_Profile *profile);
518
+
519
+ void ddprof_ffi_SerializeResult_drop(struct ddprof_ffi_SerializeResult result);
520
+
521
+ __attribute__((warn_unused_result))
522
+ struct ddprof_ffi_Slice_u8 ddprof_ffi_Vec_u8_as_slice(const struct ddprof_ffi_Vec_u8 *vec);
523
+
524
+ /**
525
+ * Resets all data in `profile` except the sample types and period. Returns
526
+ * true if it successfully reset the profile and false otherwise. The profile
527
+ * remains valid if false is returned.
528
+ */
529
+ bool ddprof_ffi_Profile_reset(struct ddprof_ffi_Profile *profile);
530
+
531
+ __attribute__((warn_unused_result)) struct ddprof_ffi_Vec_tag ddprof_ffi_Vec_tag_new(void);
532
+
533
+ void ddprof_ffi_Vec_tag_drop(struct ddprof_ffi_Vec_tag);
534
+
535
+ void ddprof_ffi_PushTagResult_drop(struct ddprof_ffi_PushTagResult);
536
+
537
+ /**
538
+ * Creates a new Tag from the provided `key` and `value` by doing a utf8
539
+ * lossy conversion, and pushes into the `vec`. The strings `key` and `value`
540
+ * are cloned to avoid FFI lifetime issues.
541
+ *
542
+ * # Safety
543
+ * The `vec` must be a valid reference.
544
+ * The CharSlices `key` and `value` must point to at least many bytes as their
545
+ * `.len` properties claim.
546
+ */
547
+ __attribute__((warn_unused_result))
548
+ struct ddprof_ffi_PushTagResult ddprof_ffi_Vec_tag_push(struct ddprof_ffi_Vec_tag *vec,
549
+ ddprof_ffi_CharSlice key,
550
+ ddprof_ffi_CharSlice value);
551
+
552
+ __attribute__((warn_unused_result))
553
+ struct ddprof_ffi_ParseTagsResult ddprof_ffi_Vec_tag_parse(ddprof_ffi_CharSlice string);
554
+
555
+ #endif /* DDPROF_FFI_H */
@@ -0,0 +1,17 @@
1
+ # Unless explicitly stated otherwise all files in this repository are licensed
2
+ # under the Apache License Version 2.0. This product includes software
3
+ # developed at Datadog (https://www.datadoghq.com/). Copyright 2021-Present
4
+ # Datadog, Inc.
5
+
6
+ prefix=${pcfiledir}/../..
7
+ exec_prefix=${prefix}
8
+ libdir=${exec_prefix}/lib
9
+ includedir=${prefix}/include
10
+
11
+ Name: ddprof_ffi
12
+ Description: Contains common code used to implement Datadog's Continuous Profilers. (Dynamic linking variant, sets rpath)
13
+ Version: 0.6.0
14
+ Requires:
15
+ Libs: -L${libdir} -lddprof_ffi -Wl,-rpath,${libdir}
16
+ Libs.private:
17
+ Cflags: -I${includedir}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libddprof
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0.1.0.beta1
4
+ version: 0.6.0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Datadog, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-18 00:00:00.000000000 Z
11
+ date: 2022-05-16 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: libddprof contains implementation bits used by Datadog's ddtrace gem
14
14
  as part of its Continuous Profiler feature.
@@ -20,6 +20,30 @@ extra_rdoc_files: []
20
20
  files:
21
21
  - lib/libddprof.rb
22
22
  - lib/libddprof/version.rb
23
+ - vendor/libddprof-0.6.0/aarch64-linux-musl/libddprof-aarch64-alpine-linux-musl/LICENSE
24
+ - vendor/libddprof-0.6.0/aarch64-linux-musl/libddprof-aarch64-alpine-linux-musl/LICENSE-3rdparty.yml
25
+ - vendor/libddprof-0.6.0/aarch64-linux-musl/libddprof-aarch64-alpine-linux-musl/NOTICE
26
+ - vendor/libddprof-0.6.0/aarch64-linux-musl/libddprof-aarch64-alpine-linux-musl/include/ddprof/ffi.h
27
+ - vendor/libddprof-0.6.0/aarch64-linux-musl/libddprof-aarch64-alpine-linux-musl/lib/libddprof_ffi.so
28
+ - vendor/libddprof-0.6.0/aarch64-linux-musl/libddprof-aarch64-alpine-linux-musl/lib/pkgconfig/ddprof_ffi_with_rpath.pc
29
+ - vendor/libddprof-0.6.0/aarch64-linux/libddprof-aarch64-unknown-linux-gnu/LICENSE
30
+ - vendor/libddprof-0.6.0/aarch64-linux/libddprof-aarch64-unknown-linux-gnu/LICENSE-3rdparty.yml
31
+ - vendor/libddprof-0.6.0/aarch64-linux/libddprof-aarch64-unknown-linux-gnu/NOTICE
32
+ - vendor/libddprof-0.6.0/aarch64-linux/libddprof-aarch64-unknown-linux-gnu/include/ddprof/ffi.h
33
+ - vendor/libddprof-0.6.0/aarch64-linux/libddprof-aarch64-unknown-linux-gnu/lib/libddprof_ffi.so
34
+ - vendor/libddprof-0.6.0/aarch64-linux/libddprof-aarch64-unknown-linux-gnu/lib/pkgconfig/ddprof_ffi_with_rpath.pc
35
+ - vendor/libddprof-0.6.0/x86_64-linux-musl/libddprof-x86_64-alpine-linux-musl/LICENSE
36
+ - vendor/libddprof-0.6.0/x86_64-linux-musl/libddprof-x86_64-alpine-linux-musl/LICENSE-3rdparty.yml
37
+ - vendor/libddprof-0.6.0/x86_64-linux-musl/libddprof-x86_64-alpine-linux-musl/NOTICE
38
+ - vendor/libddprof-0.6.0/x86_64-linux-musl/libddprof-x86_64-alpine-linux-musl/include/ddprof/ffi.h
39
+ - vendor/libddprof-0.6.0/x86_64-linux-musl/libddprof-x86_64-alpine-linux-musl/lib/libddprof_ffi.so
40
+ - vendor/libddprof-0.6.0/x86_64-linux-musl/libddprof-x86_64-alpine-linux-musl/lib/pkgconfig/ddprof_ffi_with_rpath.pc
41
+ - vendor/libddprof-0.6.0/x86_64-linux/libddprof-x86_64-unknown-linux-gnu/LICENSE
42
+ - vendor/libddprof-0.6.0/x86_64-linux/libddprof-x86_64-unknown-linux-gnu/LICENSE-3rdparty.yml
43
+ - vendor/libddprof-0.6.0/x86_64-linux/libddprof-x86_64-unknown-linux-gnu/NOTICE
44
+ - vendor/libddprof-0.6.0/x86_64-linux/libddprof-x86_64-unknown-linux-gnu/include/ddprof/ffi.h
45
+ - vendor/libddprof-0.6.0/x86_64-linux/libddprof-x86_64-unknown-linux-gnu/lib/libddprof_ffi.so
46
+ - vendor/libddprof-0.6.0/x86_64-linux/libddprof-x86_64-unknown-linux-gnu/lib/pkgconfig/ddprof_ffi_with_rpath.pc
23
47
  homepage: https://docs.datadoghq.com/tracing/profiler/
24
48
  licenses:
25
49
  - Apache-2.0
@@ -39,9 +63,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
39
63
  version: 2.1.0
40
64
  required_rubygems_version: !ruby/object:Gem::Requirement
41
65
  requirements:
42
- - - ">"
66
+ - - ">="
43
67
  - !ruby/object:Gem::Version
44
- version: 1.3.1
68
+ version: '0'
45
69
  requirements: []
46
70
  rubygems_version: 3.3.7
47
71
  signing_key: